From d7a87d0ea46bcac6f55e3df3e7525a488e4c0694 Mon Sep 17 00:00:00 2001 From: antirez Date: Thu, 12 Dec 2019 09:40:36 +0100 Subject: [PATCH] redis-cli: some refactoring about not logging AUTH & co. --- src/redis-cli.c | 18 +++++++++++++----- 1 file 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); }