diff options
author | zhaozhao.zz <zhaozhao.zz@alibaba-inc.com> | 2018-01-26 22:49:39 +0800 |
---|---|---|
committer | zhaozhao.zz <zhaozhao.zz@alibaba-inc.com> | 2018-01-26 22:49:39 +0800 |
commit | 968cb2669346ebcb20016ac16923dcd31e31ad2f (patch) | |
tree | c27f5bec74b7c33612eeb976050524e277af634e | |
parent | 4aa2ecd98b5993fcd6967aa002f0f7d8a577735d (diff) | |
download | redis-968cb2669346ebcb20016ac16923dcd31e31ad2f.tar.gz |
config: handle special configuration "" for auth
-rw-r--r-- | src/config.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c index eddfe1f11..1e3fd1848 100644 --- a/src/config.c +++ b/src/config.c @@ -390,7 +390,7 @@ void loadServerConfigFromString(char *config) { } } else if (!strcasecmp(argv[0],"masterauth") && argc == 2) { zfree(server.masterauth); - server.masterauth = zstrdup(argv[1]); + server.masterauth = argv[1][0] ? zstrdup(argv[1]) : NULL; } else if (!strcasecmp(argv[0],"slave-serve-stale-data") && argc == 2) { if ((server.repl_serve_stale_data = yesnotoi(argv[1])) == -1) { err = "argument must be 'yes' or 'no'"; goto loaderr; @@ -496,7 +496,7 @@ void loadServerConfigFromString(char *config) { err = "Password is longer than CONFIG_AUTHPASS_MAX_LEN"; goto loaderr; } - server.requirepass = zstrdup(argv[1]); + server.requirepass = argv[1][0] ? zstrdup(argv[1]) : NULL; } else if (!strcasecmp(argv[0],"pidfile") && argc == 2) { zfree(server.pidfile); server.pidfile = zstrdup(argv[1]); |