summaryrefslogtreecommitdiff
path: root/src/redis-cli.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-12-12 09:40:36 +0100
committerantirez <antirez@gmail.com>2019-12-12 09:40:36 +0100
commitd7a87d0ea46bcac6f55e3df3e7525a488e4c0694 (patch)
tree16b6f46a0b7f5e8fd771577d94fa6d7c6e23898a /src/redis-cli.c
parent81dc180323759998335df1f5aa91c64198c97bf4 (diff)
downloadredis-d7a87d0ea46bcac6f55e3df3e7525a488e4c0694.tar.gz
redis-cli: some refactoring about not logging AUTH & co.
Diffstat (limited to 'src/redis-cli.c')
-rw-r--r--src/redis-cli.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index b421344fa..065c389c6 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -1946,11 +1946,19 @@ static void repl(void) {
}
/* Won't save auth or acl setuser commands in history file */
- if (!(argv && argc > 0 &&
- (!strcasecmp(argv[0+skipargs], "auth") ||
- (skipargs + 1 < argc &&
- !strcasecmp(argv[0+skipargs], "acl") &&
- !strcasecmp(argv[0+skipargs+1], "setuser"))))) {
+ int dangerous = 0;
+ if (argv && argc > 0) {
+ if (!strcasecmp(argv[skipargs], "auth")) {
+ dangerous = 1;
+ } else if (skipargs+1 < argc &&
+ !strcasecmp(argv[skipargs], "acl") &&
+ !strcasecmp(argv[skipargs+1], "setuser"))
+ {
+ dangerous = 1;
+ }
+ }
+
+ if (!dangerous) {
if (history) linenoiseHistoryAdd(line);
if (historyfile) linenoiseHistorySave(historyfile);
}