[SENTINEL] reset sentinel-user/pass to NULL when user config with empty string (#8958)
(cherry picked from commit ae6f58690b91010d003cdf5552d74b8e5b428d53)
This commit is contained in:
parent
f8938d868b
commit
efb7a5c630
@ -3175,11 +3175,13 @@ void sentinelConfigSetCommand(client *c) {
|
|||||||
sentinel.announce_port = numval;
|
sentinel.announce_port = numval;
|
||||||
} else if (!strcasecmp(o->ptr, "sentinel-user")) {
|
} else if (!strcasecmp(o->ptr, "sentinel-user")) {
|
||||||
sdsfree(sentinel.sentinel_auth_user);
|
sdsfree(sentinel.sentinel_auth_user);
|
||||||
sentinel.sentinel_auth_user = sdsnew(val->ptr);
|
sentinel.sentinel_auth_user = sdslen(val->ptr) == 0 ?
|
||||||
|
sdsdup(val->ptr) : NULL;
|
||||||
drop_conns = 1;
|
drop_conns = 1;
|
||||||
} else if (!strcasecmp(o->ptr, "sentinel-pass")) {
|
} else if (!strcasecmp(o->ptr, "sentinel-pass")) {
|
||||||
sdsfree(sentinel.sentinel_auth_pass);
|
sdsfree(sentinel.sentinel_auth_pass);
|
||||||
sentinel.sentinel_auth_pass = sdsnew(val->ptr);
|
sentinel.sentinel_auth_pass = sdslen(val->ptr) == 0 ?
|
||||||
|
sdsdup(val->ptr) : NULL;
|
||||||
drop_conns = 1;
|
drop_conns = 1;
|
||||||
} else {
|
} else {
|
||||||
addReplyErrorFormat(c, "Invalid argument '%s' to SENTINEL CONFIG SET",
|
addReplyErrorFormat(c, "Invalid argument '%s' to SENTINEL CONFIG SET",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user