From 9ae8e3fefa034952fac2910628b5a7f3fb4277a0 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 30 Jan 2019 08:09:05 +0100 Subject: [PATCH] ACL: clear the subcommands array when setting category bits. --- src/acl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/acl.c b/src/acl.c index d90ef8df..b7426be9 100644 --- a/src/acl.c +++ b/src/acl.c @@ -67,6 +67,8 @@ struct ACLCategoryItem { {"",0} /* Terminator. */ }; +void ACLResetSubcommandsForCommand(user *u, unsigned long id); + /* ============================================================================= * Helper functions for the rest of the ACL implementation * ==========================================================================*/ @@ -222,7 +224,10 @@ int ACLSetUserCommandBitsForCategory(user *u, const char *category, int value) { dictEntry *de; while ((de = dictNext(di)) != NULL) { struct redisCommand *cmd = dictGetVal(de); - if (cmd->flags & cflag) ACLSetUserCommandBit(u,cmd->id,value); + if (cmd->flags & cflag) { + ACLSetUserCommandBit(u,cmd->id,value); + ACLResetSubcommandsForCommand(u,cmd->id); + } } dictReleaseIterator(di); return C_OK;