mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
ACL: implement the key match opcode in ACLSetUser().
This commit is contained in:
parent
ff92c06947
commit
0db42d4ba8
@ -203,6 +203,12 @@ int ACLSetUser(user *u, const char *op, ssize_t oplen) {
|
||||
listNode *ln = listSearchKey(u->passwords,delpass);
|
||||
if (ln) listDelNode(u->passwords,ln);
|
||||
sdsfree(delpass);
|
||||
} else if (op[0] == '~') {
|
||||
sds newpat = sdsnewlen(op+1,oplen-1);
|
||||
listNode *ln = listSearchKey(u->patterns,newpat);
|
||||
/* Avoid re-adding the same pattern multiple times. */
|
||||
if (ln == NULL) listAddNodeTail(u->patterns,newpat);
|
||||
u->flags &= ~USER_FLAG_ALLKEYS;
|
||||
} else {
|
||||
return C_ERR;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user