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
b9c97c0b
Commit
b9c97c0b
authored
Feb 12, 2019
by
antirez
Browse files
ACL: CAT subcommand implemented.
parent
a22815b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/acl.c
View file @
b9c97c0b
...
@@ -1437,6 +1437,32 @@ void aclCommand(client *c) {
...
@@ -1437,6 +1437,32 @@ void aclCommand(client *c) {
sdsfree
(
errors
);
sdsfree
(
errors
);
}
}
}
}
}
else
if
(
!
strcasecmp
(
sub
,
"cat"
)
&&
c
->
argc
==
2
)
{
void
*
dl
=
addReplyDeferredLen
(
c
);
int
j
;
for
(
j
=
0
;
ACLCommandCategories
[
j
].
flag
!=
0
;
j
++
)
addReplyBulkCString
(
c
,
ACLCommandCategories
[
j
].
name
);
setDeferredArrayLen
(
c
,
dl
,
j
);
}
else
if
(
!
strcasecmp
(
sub
,
"cat"
)
&&
c
->
argc
==
3
)
{
uint64_t
cflag
=
ACLGetCommandCategoryFlagByName
(
c
->
argv
[
2
]
->
ptr
);
if
(
cflag
==
0
)
{
addReplyErrorFormat
(
c
,
"Unknown category '%s'"
,
c
->
argv
[
2
]
->
ptr
);
return
;
}
int
arraylen
=
0
;
void
*
dl
=
addReplyDeferredLen
(
c
);
dictIterator
*
di
=
dictGetIterator
(
server
.
orig_commands
);
dictEntry
*
de
;
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
struct
redisCommand
*
cmd
=
dictGetVal
(
de
);
if
(
cmd
->
flags
&
CMD_MODULE
)
continue
;
if
(
cmd
->
flags
&
cflag
)
{
addReplyBulkCString
(
c
,
cmd
->
name
);
arraylen
++
;
}
}
dictReleaseIterator
(
di
);
setDeferredArrayLen
(
c
,
dl
,
arraylen
);
}
else
if
(
!
strcasecmp
(
sub
,
"help"
))
{
}
else
if
(
!
strcasecmp
(
sub
,
"help"
))
{
const
char
*
help
[]
=
{
const
char
*
help
[]
=
{
"LIST -- Show user details in config file format."
,
"LIST -- Show user details in config file format."
,
...
...
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