Commit 25dbc219 authored by 严风's avatar 严风

Reture ParseError while auth failed.

parent 38a2bc07
...@@ -85,17 +85,16 @@ ParseResult ParseRedisMessage(butil::IOBuf* source, Socket* socket, ...@@ -85,17 +85,16 @@ ParseResult ParseRedisMessage(butil::IOBuf* source, Socket* socket,
} }
if (pi.with_auth) { if (pi.with_auth) {
if (msg->response.reply_size() != 1) { if (msg->response.reply_size() != 1 ||
socket->GivebackPipelinedInfo(pi); (!(msg->response.reply(0).type() == brpc::REDIS_REPLY_STATUS &&
return MakeParseError(PARSE_ERROR_ABSOLUTELY_WRONG); msg->response.reply(0).data().compare("OK") == 0))) {
LOG(ERROR) << "Redis Auth failed: " << msg->response;
return MakeParseError(PARSE_ERROR_NO_RESOURCE,
"Fail to authenticate with Redis");
} }
DestroyingPtr<InputResponse> auth_msg( DestroyingPtr<InputResponse> auth_msg(
static_cast<InputResponse*>(socket->release_parsing_context())); static_cast<InputResponse*>(socket->release_parsing_context()));
if (!(auth_msg->response.reply(0).type() == brpc::REDIS_REPLY_STATUS &&
auth_msg->response.reply(0).data().compare("OK") == 0)) {
LOG(ERROR) << "Redis Auth failed: " << auth_msg->response.reply(0);
}
pi.with_auth = false; pi.with_auth = false;
continue; continue;
} }
......
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