summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-01-29 18:51:04 +0100
committerantirez <antirez@gmail.com>2020-01-29 18:51:04 +0100
commit30a466ba38759e8deb5ed79c18bb3d3dec352ad7 (patch)
treee501017dfbdb644dfd06c11ba1ad6aa9565eef38
parent6671032fafc82be04b4ca564790753b26f96780e (diff)
downloadredis-30a466ba38759e8deb5ed79c18bb3d3dec352ad7.tar.gz
ACL LOG: implement LOG RESET.
-rw-r--r--src/acl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/acl.c b/src/acl.c
index d03599a79..16acd4d3e 100644
--- a/src/acl.c
+++ b/src/acl.c
@@ -95,6 +95,7 @@ struct ACLUserFlag {
void ACLResetSubcommandsForCommand(user *u, unsigned long id);
void ACLResetSubcommands(user *u);
void ACLAddAllowedSubcommand(user *u, unsigned long id, const char *sub);
+void ACLFreeLogEntry(void *le);
/* The length of the string representation of a hashed password. */
#define HASH_PASSWORD_LEN SHA256_BLOCK_SIZE*2
@@ -1493,7 +1494,8 @@ int ACLLogMatchEntry(ACLLogEntry *a, ACLLogEntry *b) {
}
/* Release an ACL log entry. */
-void ACLFreeLogEntry(ACLLogEntry *le) {
+void ACLFreeLogEntry(void *leptr) {
+ ACLLogEntry *le = leptr;
sdsfree(le->object);
sdsfree(le->username);
sdsfree(le->cinfo);
@@ -1774,7 +1776,9 @@ void aclCommand(client *c) {
* the "RESET" command in order to flush the old entires. */
if (c->argc == 3) {
if (!strcasecmp(c->argv[2]->ptr,"reset")) {
- /* TODO: reset the log. */
+ listSetFreeMethod(ACLLog,ACLFreeLogEntry);
+ listEmpty(ACLLog);
+ listSetFreeMethod(ACLLog,NULL);
addReply(c,shared.ok);
return;
} else if (getLongFromObjectOrReply(c,c->argv[2],&count,NULL)