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
943008eb
Commit
943008eb
authored
Jan 29, 2020
by
antirez
Browse files
ACL LOG: implement LOG RESET.
parent
e271a611
Changes
1
Show whitespace changes
Inline
Side-by-side
src/acl.c
View file @
943008eb
...
@@ -95,6 +95,7 @@ struct ACLUserFlag {
...
@@ -95,6 +95,7 @@ struct ACLUserFlag {
void ACLResetSubcommandsForCommand(user *u, unsigned long id);
void ACLResetSubcommandsForCommand(user *u, unsigned long id);
void ACLResetSubcommands(user *u);
void ACLResetSubcommands(user *u);
void ACLAddAllowedSubcommand(user *u, unsigned long id, const char *sub);
void ACLAddAllowedSubcommand(user *u, unsigned long id, const char *sub);
void ACLFreeLogEntry(void *le);
/* The length of the string representation of a hashed password. */
/* The length of the string representation of a hashed password. */
#define HASH_PASSWORD_LEN SHA256_BLOCK_SIZE*2
#define HASH_PASSWORD_LEN SHA256_BLOCK_SIZE*2
...
@@ -1493,7 +1494,8 @@ int ACLLogMatchEntry(ACLLogEntry *a, ACLLogEntry *b) {
...
@@ -1493,7 +1494,8 @@ int ACLLogMatchEntry(ACLLogEntry *a, ACLLogEntry *b) {
}
}
/* Release an ACL log entry. */
/* Release an ACL log entry. */
void
ACLFreeLogEntry
(
ACLLogEntry
*
le
)
{
void ACLFreeLogEntry(void *leptr) {
ACLLogEntry *le = leptr;
sdsfree(le->object);
sdsfree(le->object);
sdsfree(le->username);
sdsfree(le->username);
sdsfree(le->cinfo);
sdsfree(le->cinfo);
...
@@ -1774,7 +1776,9 @@ void aclCommand(client *c) {
...
@@ -1774,7 +1776,9 @@ void aclCommand(client *c) {
* the "RESET" command in order to flush the old entires. */
* the "RESET" command in order to flush the old entires. */
if (c->argc == 3) {
if (c->argc == 3) {
if (!strcasecmp(c->argv[2]->ptr,"reset")) {
if (!strcasecmp(c->argv[2]->ptr,"reset")) {
/* TODO: reset the log. */
listSetFreeMethod(ACLLog,ACLFreeLogEntry);
listEmpty(ACLLog);
listSetFreeMethod(ACLLog,NULL);
addReply(c,shared.ok);
addReply(c,shared.ok);
return;
return;
} else if (getLongFromObjectOrReply(c,c->argv[2],&count,NULL)
} else if (getLongFromObjectOrReply(c,c->argv[2],&count,NULL)
...
...
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