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
23a85ba1
Unverified
Commit
23a85ba1
authored
May 19, 2020
by
Salvatore Sanfilippo
Committed by
GitHub
May 19, 2020
Browse files
Merge pull request #7276 from hujiecs/fix-clear-all-command-flag-in-acl
fix clear USER_FLAG_ALLCOMMANDS flag in acl
parents
d949e8fe
edc1f7b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/acl.c
View file @
23a85ba1
...
@@ -375,12 +375,13 @@ int ACLUserCanExecuteFutureCommands(user *u) {
...
@@ -375,12 +375,13 @@ int ACLUserCanExecuteFutureCommands(user *u) {
* to skip the command bit explicit test. */
* 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
;
else
}
else
{
u
->
allowed_commands
[
word
]
&=
~
bit
;
u
->
allowed_commands
[
word
]
&=
~
bit
;
u
->
flags
&=
~
USER_FLAG_ALLCOMMANDS
;
}
}
}
/* This is like ACLSetUserCommandBit(), but instead of setting the specified
/* This is like ACLSetUserCommandBit(), but instead of setting the specified
...
@@ -845,7 +846,6 @@ int ACLSetUser(user *u, const char *op, ssize_t oplen) {
...
@@ -845,7 +846,6 @@ int ACLSetUser(user *u, const char *op, ssize_t oplen) {
errno
=
ENOENT
;
errno
=
ENOENT
;
return
C_ERR
;
return
C_ERR
;
}
}
unsigned
long
id
=
ACLGetCommandID
(
copy
);
/* The subcommand cannot be empty, so things like DEBUG|
/* The subcommand cannot be empty, so things like DEBUG|
* are syntax errors of course. */
* are syntax errors of course. */
...
@@ -858,6 +858,7 @@ int ACLSetUser(user *u, const char *op, ssize_t oplen) {
...
@@ -858,6 +858,7 @@ int ACLSetUser(user *u, const char *op, ssize_t oplen) {
/* The command should not be set right now in the command
/* The command should not be set right now in the command
* bitmap, because adding a subcommand of a fully added
* bitmap, because adding a subcommand of a fully added
* command is probably an error on the user side. */
* command is probably an error on the user side. */
unsigned
long
id
=
ACLGetCommandID
(
copy
);
if
(
ACLGetUserCommandBit
(
u
,
id
)
==
1
)
{
if
(
ACLGetUserCommandBit
(
u
,
id
)
==
1
)
{
zfree
(
copy
);
zfree
(
copy
);
errno
=
EBUSY
;
errno
=
EBUSY
;
...
...
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