ACL: set the command ID while populating the commands table.

This commit is contained in:
antirez 2019-01-09 17:23:23 +01:00
parent 91f1d8026b
commit 010b24f864

View File

@ -2202,6 +2202,8 @@ void populateCommandTable(void) {
char *f = c->sflags; char *f = c->sflags;
int retval1, retval2; int retval1, retval2;
/* Translate the command string flags description into an actual
* set of flags. */
while(*f != '\0') { while(*f != '\0') {
switch(*f) { switch(*f) {
case 'w': c->flags |= CMD_WRITE; break; case 'w': c->flags |= CMD_WRITE; break;
@ -2222,6 +2224,8 @@ void populateCommandTable(void) {
f++; f++;
} }
c->id = j; /* Sequential ID for each command. Used for ACLs. */
retval1 = dictAdd(server.commands, sdsnew(c->name), c); retval1 = dictAdd(server.commands, sdsnew(c->name), c);
/* Populate an additional dictionary that will be unaffected /* Populate an additional dictionary that will be unaffected
* by rename-command statements in redis.conf. */ * by rename-command statements in redis.conf. */