Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
f311a529
Commit
f311a529
authored
Feb 27, 2019
by
antirez
Browse files
Make PR #5872 more compatible with Redis coding style.
parent
0dcb0038
Changes
1
Show whitespace changes
Inline
Side-by-side
src/acl.c
View file @
f311a529
...
@@ -1394,12 +1394,11 @@ void aclCommand(client *c) {
...
@@ -1394,12 +1394,11 @@ void aclCommand(client *c) {
char
*
sub
=
c
->
argv
[
1
]
->
ptr
;
char
*
sub
=
c
->
argv
[
1
]
->
ptr
;
if
(
!
strcasecmp
(
sub
,
"setuser"
)
&&
c
->
argc
>=
3
)
{
if
(
!
strcasecmp
(
sub
,
"setuser"
)
&&
c
->
argc
>=
3
)
{
sds
username
=
c
->
argv
[
2
]
->
ptr
;
sds
username
=
c
->
argv
[
2
]
->
ptr
;
/* Create a temporary user to validate and stage all changes against
before
/* Create a temporary user to validate and stage all changes against
* applying to an existing user or creating a new user. If all
arguments
*
before
applying to an existing user or creating a new user. If all
* are valid the user parameters will all be applied together.
If there are
*
arguments
are valid the user parameters will all be applied together.
* any errors then none of the changes will be applied. */
*
If there are
any errors then none of the changes will be applied. */
user
*
tempu
=
ACLCreateUnlinkedUser
();
user
*
tempu
=
ACLCreateUnlinkedUser
();
user
*
u
=
ACLGetUserByName
(
username
,
sdslen
(
username
));
user
*
u
=
ACLGetUserByName
(
username
,
sdslen
(
username
));
if
(
u
)
ACLCopyUser
(
tempu
,
u
);
if
(
u
)
ACLCopyUser
(
tempu
,
u
);
...
@@ -1415,12 +1414,11 @@ void aclCommand(client *c) {
...
@@ -1415,12 +1414,11 @@ void aclCommand(client *c) {
}
}
}
}
/* Overwrite the user with the temporary user we modified above. */
if
(
!
u
)
u
=
ACLCreateUser
(
username
,
sdslen
(
username
));
if
(
!
u
)
u
=
ACLCreateUser
(
username
,
sdslen
(
username
));
serverAssert
(
u
!=
NULL
);
serverAssert
(
u
!=
NULL
);
ACLCopyUser
(
u
,
tempu
);
ACLCopyUser
(
u
,
tempu
);
ACLFreeUser
(
tempu
);
ACLFreeUser
(
tempu
);
addReply
(
c
,
shared
.
ok
);
addReply
(
c
,
shared
.
ok
);
}
else
if
(
!
strcasecmp
(
sub
,
"deluser"
)
&&
c
->
argc
>=
3
)
{
}
else
if
(
!
strcasecmp
(
sub
,
"deluser"
)
&&
c
->
argc
>=
3
)
{
int
deleted
=
0
;
int
deleted
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment