From efce73a001ab8f30a8191814d1dadb55c7974d02 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 30 Jan 2019 08:17:33 +0100 Subject: [PATCH] ACL: ACLDescribeUserCommandRules(): emit subcommands. --- src/acl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/acl.c b/src/acl.c index b7426be9..674d3921 100644 --- a/src/acl.c +++ b/src/acl.c @@ -325,6 +325,19 @@ sds ACLDescribeUserCommandRules(user *u) { rules = sdscatlen(rules," ",1); ACLSetUserCommandBit(fakeuser,cmd->id,userbit); } + + /* Emit the subcommands if there are any. */ + if (userbit == 0 && u->allowed_subcommands && + u->allowed_subcommands[cmd->id]) + { + for (int j = 0; u->allowed_subcommands[cmd->id][j]; j++) { + rules = sdscatlen(rules,"+",1); + rules = sdscat(rules,cmd->name); + rules = sdscatlen(rules,"|",1); + rules = sdscatsds(rules,u->allowed_subcommands[cmd->id][j]); + rules = sdscatlen(rules," ",1); + } + } } dictReleaseIterator(di);