Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
dbae3710
Commit
dbae3710
authored
Jan 16, 2019
by
antirez
Browse files
ACL: create the user pattern list ASAP.
parent
f78b3ede
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/acl.c
View file @
dbae3710
...
...
@@ -107,11 +107,9 @@ user *ACLCreateUser(const char *name, size_t namelen) {
u
->
flags
=
0
;
u
->
allowed_subcommands
=
NULL
;
u
->
passwords
=
listCreate
();
u
->
patterns
=
listCreate
();
listSetMatchMethod
(
u
->
passwords
,
ACLListMatchSds
);
u
->
patterns
=
NULL
;
/* Just created users cannot access to any key, however
if the "~*" directive was enabled to match all the
keys, the user will be flagged with the ALLKEYS
flag. */
listSetMatchMethod
(
u
->
patterns
,
ACLListMatchSds
);
memset
(
u
->
allowed_commands
,
0
,
sizeof
(
u
->
allowed_commands
));
raxInsert
(
Users
,(
unsigned
char
*
)
name
,
namelen
,
u
,
NULL
);
return
u
;
...
...
@@ -338,7 +336,7 @@ int ACLCheckCommandPerm(client *c) {
listRewind
(
u
->
passwords
,
&
li
);
/* Test this key against every pattern. */
match
=
0
;
int
match
=
0
;
while
((
ln
=
listNext
(
&
li
)))
{
sds
pattern
=
listNodeValue
(
ln
);
size_t
plen
=
sdslen
(
pattern
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment