Commit 9ae8e3fe authored by antirez's avatar antirez
Browse files

ACL: clear the subcommands array when setting category bits.

parent feba39d3
...@@ -67,6 +67,8 @@ struct ACLCategoryItem { ...@@ -67,6 +67,8 @@ struct ACLCategoryItem {
{"",0} /* Terminator. */ {"",0} /* Terminator. */
}; };
void ACLResetSubcommandsForCommand(user *u, unsigned long id);
/* ============================================================================= /* =============================================================================
* Helper functions for the rest of the ACL implementation * Helper functions for the rest of the ACL implementation
* ==========================================================================*/ * ==========================================================================*/
...@@ -222,7 +224,10 @@ int ACLSetUserCommandBitsForCategory(user *u, const char *category, int value) { ...@@ -222,7 +224,10 @@ int ACLSetUserCommandBitsForCategory(user *u, const char *category, int value) {
dictEntry *de; dictEntry *de;
while ((de = dictNext(di)) != NULL) { while ((de = dictNext(di)) != NULL) {
struct redisCommand *cmd = dictGetVal(de); 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); dictReleaseIterator(di);
return C_OK; return C_OK;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment