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
dbdc68a6
Commit
dbdc68a6
authored
Jan 18, 2019
by
antirez
Browse files
ACL: handle command IDs in case insensitive way.
parent
94460440
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/acl.c
View file @
dbdc68a6
...
...
@@ -284,10 +284,17 @@ unsigned long ACLGetCommandID(const char *cmdname) {
static
rax
*
map
=
NULL
;
static
unsigned
long
nextid
=
0
;
sds
lowername
=
sdsnew
(
cmdname
);
sdstolower
(
lowername
);
if
(
map
==
NULL
)
map
=
raxNew
();
void
*
id
=
raxFind
(
map
,(
unsigned
char
*
)
cmdname
,
strlen
(
cmdname
));
if
(
id
!=
raxNotFound
)
return
(
unsigned
long
)
id
;
raxInsert
(
map
,(
unsigned
char
*
)
cmdname
,
strlen
(
cmdname
),(
void
*
)
nextid
,
NULL
);
void
*
id
=
raxFind
(
map
,(
unsigned
char
*
)
lowername
,
sdslen
(
lowername
));
if
(
id
!=
raxNotFound
)
{
sdsfree
(
lowername
);
return
(
unsigned
long
)
id
;
}
raxInsert
(
map
,(
unsigned
char
*
)
lowername
,
strlen
(
lowername
),
(
void
*
)
nextid
,
NULL
);
sdsfree
(
lowername
);
return
nextid
++
;
}
...
...
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