HDFS-12104: libhdfs++: Make sure all steps in SaslProtocol end up calling AuthComplete. Contributed by James Clampffer.

This commit is contained in:
James Clampffer 2017-07-10 12:09:30 -04:00
parent 3c743b475e
commit e64ba87486
1 changed files with 2 additions and 0 deletions

View File

@ -87,6 +87,7 @@ void SaslProtocol::Authenticate(std::function<void(const Status & status, const
// We cheat here since this is always called while holding the RpcConnection's lock
std::shared_ptr<RpcConnection> connection = connection_.lock();
if (!connection) {
AuthComplete(Status::AuthenticationFailed("Lost RPC Connection"), AuthInfo());
return;
}
@ -335,6 +336,7 @@ bool SaslProtocol::SendSaslMessage(RpcSaslProto & message)
std::shared_ptr<RpcConnection> connection = connection_.lock();
if (!connection) {
LOG_DEBUG(kRPC, << "Tried sending a SASL Message but the RPC connection was gone");
AuthComplete(Status::AuthenticationFailed("Lost RPC Connection"), AuthInfo());
return false;
}