summaryrefslogtreecommitdiff
path: root/src/acl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/acl.c')
-rw-r--r--src/acl.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/acl.c b/src/acl.c
index aecd0629b..16f8606d3 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -1360,6 +1360,22 @@ int ACLCheckPubsubPerm(client *c, int idx, int count, int literal, int *idxptr)
}
+/* Check whether the command is ready to be exceuted by ACLCheckCommandPerm.
+ * If check passes, then check whether pub/sub channels of the command is
+ * ready to be executed by ACLCheckPubsubPerm */
+int ACLCheckAllPerm(client *c, int *idxptr) {
+ int acl_retval = ACLCheckCommandPerm(c,idxptr);
+ if (acl_retval != ACL_OK)
+ return acl_retval;
+ if (c->cmd->proc == publishCommand)
+ acl_retval = ACLCheckPubsubPerm(c,1,1,0,idxptr);
+ else if (c->cmd->proc == subscribeCommand)
+ acl_retval = ACLCheckPubsubPerm(c,1,c->argc-1,0,idxptr);
+ else if (c->cmd->proc == psubscribeCommand)
+ acl_retval = ACLCheckPubsubPerm(c,1,c->argc-1,1,idxptr);
+ return acl_retval;
+}
+
/* =============================================================================
* ACL loading / saving functions
* ==========================================================================*/