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
fd7484cd
Unverified
Commit
fd7484cd
authored
Feb 13, 2019
by
Salvatore Sanfilippo
Committed by
GitHub
Feb 13, 2019
Browse files
Merge pull request #5836 from soloestoy/fix-acl-warning
ACL: show categories in COMMAND reply
parents
e819c2ef
14507457
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/acl.c
View file @
fd7484cd
...
@@ -1446,7 +1446,7 @@ void aclCommand(client *c) {
...
@@ -1446,7 +1446,7 @@ void aclCommand(client *c) {
}
else
if
(
!
strcasecmp
(
sub
,
"cat"
)
&&
c
->
argc
==
3
)
{
}
else
if
(
!
strcasecmp
(
sub
,
"cat"
)
&&
c
->
argc
==
3
)
{
uint64_t
cflag
=
ACLGetCommandCategoryFlagByName
(
c
->
argv
[
2
]
->
ptr
);
uint64_t
cflag
=
ACLGetCommandCategoryFlagByName
(
c
->
argv
[
2
]
->
ptr
);
if
(
cflag
==
0
)
{
if
(
cflag
==
0
)
{
addReplyErrorFormat
(
c
,
"Unknown category '%s'"
,
c
->
argv
[
2
]
->
ptr
);
addReplyErrorFormat
(
c
,
"Unknown category '%s'"
,
(
char
*
)
c
->
argv
[
2
]
->
ptr
);
return
;
return
;
}
}
int
arraylen
=
0
;
int
arraylen
=
0
;
...
@@ -1480,3 +1480,15 @@ NULL
...
@@ -1480,3 +1480,15 @@ NULL
addReplySubcommandSyntaxError
(
c
);
addReplySubcommandSyntaxError
(
c
);
}
}
}
}
void
addReplyCommandCategories
(
client
*
c
,
struct
redisCommand
*
cmd
)
{
int
flagcount
=
0
;
void
*
flaglen
=
addReplyDeferredLen
(
c
);
for
(
int
j
=
0
;
ACLCommandCategories
[
j
].
flag
!=
0
;
j
++
)
{
if
(
cmd
->
flags
&
ACLCommandCategories
[
j
].
flag
)
{
addReplyStatusFormat
(
c
,
"@%s"
,
ACLCommandCategories
[
j
].
name
);
flagcount
++
;
}
}
setDeferredSetLen
(
c
,
flaglen
,
flagcount
);
}
src/server.c
View file @
fd7484cd
...
@@ -3698,8 +3698,8 @@ void addReplyCommand(client *c, struct redisCommand *cmd) {
...
@@ -3698,8 +3698,8 @@ void addReplyCommand(client *c, struct redisCommand *cmd) {
if
(
!
cmd
)
{
if
(
!
cmd
)
{
addReplyNull
(
c
);
addReplyNull
(
c
);
}
else
{
}
else
{
/* We are adding: command name, arg count, flags, first, last, offset */
/* We are adding: command name, arg count, flags, first, last, offset
, categories
*/
addReplyArrayLen
(
c
,
6
);
addReplyArrayLen
(
c
,
7
);
addReplyBulkCString
(
c
,
cmd
->
name
);
addReplyBulkCString
(
c
,
cmd
->
name
);
addReplyLongLong
(
c
,
cmd
->
arity
);
addReplyLongLong
(
c
,
cmd
->
arity
);
...
@@ -3729,6 +3729,8 @@ void addReplyCommand(client *c, struct redisCommand *cmd) {
...
@@ -3729,6 +3729,8 @@ void addReplyCommand(client *c, struct redisCommand *cmd) {
addReplyLongLong
(
c
,
cmd
->
firstkey
);
addReplyLongLong
(
c
,
cmd
->
firstkey
);
addReplyLongLong
(
c
,
cmd
->
lastkey
);
addReplyLongLong
(
c
,
cmd
->
lastkey
);
addReplyLongLong
(
c
,
cmd
->
keystep
);
addReplyLongLong
(
c
,
cmd
->
keystep
);
addReplyCommandCategories
(
c
,
cmd
);
}
}
}
}
...
...
src/server.h
View file @
fd7484cd
...
@@ -1748,6 +1748,7 @@ char *ACLSetUserStringError(void);
...
@@ -1748,6 +1748,7 @@ char *ACLSetUserStringError(void);
int
ACLLoadConfiguredUsers
(
void
);
int
ACLLoadConfiguredUsers
(
void
);
sds
ACLDescribeUser
(
user
*
u
);
sds
ACLDescribeUser
(
user
*
u
);
void
ACLLoadUsersAtStartup
(
void
);
void
ACLLoadUsersAtStartup
(
void
);
void
addReplyCommandCategories
(
client
*
c
,
struct
redisCommand
*
cmd
);
/* Sorted sets data type */
/* Sorted sets data type */
...
...
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