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
b7750a93
Commit
b7750a93
authored
Jan 25, 2019
by
antirez
Browse files
ACL: remove the ALLCOMMANDS user flag at a safer place.
This fixes -@<category> as a side effect.
parent
eb840f9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/acl.c
View file @
b7750a93
...
@@ -189,9 +189,12 @@ int ACLUserCanExecuteFutureCommands(user *u) {
...
@@ -189,9 +189,12 @@ int ACLUserCanExecuteFutureCommands(user *u) {
/* Set the specified command bit for the specified user to 'value' (0 or 1).
/* Set the specified command bit for the specified user to 'value' (0 or 1).
* If the bit overflows the user internal represetation, no operation
* If the bit overflows the user internal represetation, no operation
* is performed. */
* is performed. As a side effect of calling this function with a value of
* zero, the user flag ALLCOMMANDS is cleared since it is no longer possible
* to skip the command bit explicit test. */
void
ACLSetUserCommandBit
(
user
*
u
,
unsigned
long
id
,
int
value
)
{
void
ACLSetUserCommandBit
(
user
*
u
,
unsigned
long
id
,
int
value
)
{
uint64_t
word
,
bit
;
uint64_t
word
,
bit
;
if
(
value
==
0
)
u
->
flags
&=
~
USER_FLAG_ALLCOMMANDS
;
if
(
ACLGetCommandBitCoordinates
(
id
,
&
word
,
&
bit
)
==
C_ERR
)
return
;
if
(
ACLGetCommandBitCoordinates
(
id
,
&
word
,
&
bit
)
==
C_ERR
)
return
;
if
(
value
)
if
(
value
)
u
->
allowed_commands
[
word
]
|=
bit
;
u
->
allowed_commands
[
word
]
|=
bit
;
...
@@ -412,7 +415,6 @@ int ACLSetUser(user *u, const char *op, ssize_t oplen) {
...
@@ -412,7 +415,6 @@ int ACLSetUser(user *u, const char *op, ssize_t oplen) {
}
}
unsigned
long
id
=
ACLGetCommandID
(
op
+
1
);
unsigned
long
id
=
ACLGetCommandID
(
op
+
1
);
ACLSetUserCommandBit
(
u
,
id
,
0
);
ACLSetUserCommandBit
(
u
,
id
,
0
);
u
->
flags
&=
~
USER_FLAG_ALLCOMMANDS
;
ACLResetSubcommandsForCommand
(
u
,
id
);
ACLResetSubcommandsForCommand
(
u
,
id
);
}
else
if
((
op
[
0
]
==
'+'
||
op
[
0
]
==
'-'
)
&&
op
[
1
]
==
'@'
)
{
}
else
if
((
op
[
0
]
==
'+'
||
op
[
0
]
==
'-'
)
&&
op
[
1
]
==
'@'
)
{
int
bitval
=
op
[
0
]
==
'+'
?
1
:
0
;
int
bitval
=
op
[
0
]
==
'+'
?
1
:
0
;
...
...
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