summaryrefslogtreecommitdiff
path: root/src/acl.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-02-27 09:34:50 +0100
committerantirez <antirez@gmail.com>2019-02-27 09:34:50 +0100
commitf311a529be198f1c844dc4b5dcaf59da684a69ca (patch)
treee509ab26303503d686cc3ffab645b942dc65a7ac /src/acl.c
parent0dcb00388723cfc4e136bec8457235c84d74f0c8 (diff)
downloadredis-f311a529be198f1c844dc4b5dcaf59da684a69ca.tar.gz
Make PR #5872 more compatible with Redis coding style.
Diffstat (limited to 'src/acl.c')
-rw-r--r--src/acl.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/acl.c b/src/acl.c
index 12c49c74d..3cca50027 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -1394,12 +1394,11 @@ void aclCommand(client *c) {
char *sub = c->argv[1]->ptr;
if (!strcasecmp(sub,"setuser") && c->argc >= 3) {
sds username = c->argv[2]->ptr;
- /* Create a temporary user to validate and stage all changes against before
- * applying to an existing user or creating a new user. If all arguments
- * are valid the user parameters will all be applied together. If there are
- * any errors then none of the changes will be applied. */
+ /* Create a temporary user to validate and stage all changes against
+ * before applying to an existing user or creating a new user. If all
+ * arguments are valid the user parameters will all be applied together.
+ * If there are any errors then none of the changes will be applied. */
user *tempu = ACLCreateUnlinkedUser();
-
user *u = ACLGetUserByName(username,sdslen(username));
if (u) ACLCopyUser(tempu, u);
@@ -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));
serverAssert(u != NULL);
-
ACLCopyUser(u, tempu);
ACLFreeUser(tempu);
-
addReply(c,shared.ok);
} else if (!strcasecmp(sub,"deluser") && c->argc >= 3) {
int deleted = 0;