Unverified Commit 56eef6fb authored by polaris-alioth's avatar polaris-alioth Committed by GitHub
Browse files

passwords printed in the crash log (#11930)

When the server crashes during the AUTH command, or another command with
an AUTH argument, the password was recorded in the log.

Now, when the `auth` keyword is detected (could be in HELLO or MIGRATE, etc),
the loop exits before printing any additional arguments.
parent 6cf8fc08
...@@ -1859,11 +1859,17 @@ void logCurrentClient(client *cc, const char *title) { ...@@ -1859,11 +1859,17 @@ void logCurrentClient(client *cc, const char *title) {
client = catClientInfoString(sdsempty(),cc); client = catClientInfoString(sdsempty(),cc);
serverLog(LL_WARNING|LL_RAW,"%s\n", client); serverLog(LL_WARNING|LL_RAW,"%s\n", client);
sdsfree(client); sdsfree(client);
serverLog(LL_WARNING|LL_RAW,"argc: '%d'\n", cc->argc);
for (j = 0; j < cc->argc; j++) { for (j = 0; j < cc->argc; j++) {
robj *decoded; robj *decoded;
decoded = getDecodedObject(cc->argv[j]); decoded = getDecodedObject(cc->argv[j]);
sds repr = sdscatrepr(sdsempty(),decoded->ptr, min(sdslen(decoded->ptr), 128)); sds repr = sdscatrepr(sdsempty(),decoded->ptr, min(sdslen(decoded->ptr), 128));
serverLog(LL_WARNING|LL_RAW,"argv[%d]: '%s'\n", j, (char*)repr); serverLog(LL_WARNING|LL_RAW,"argv[%d]: '%s'\n", j, (char*)repr);
if (!strcasecmp(decoded->ptr, "auth") || !strcasecmp(decoded->ptr, "auth2")) {
sdsfree(repr);
decrRefCount(decoded);
break;
}
sdsfree(repr); sdsfree(repr);
decrRefCount(decoded); decrRefCount(decoded);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment