Skip to content

Commit

Permalink
[XrdCl] Make sure to try all available authentication options before …
Browse files Browse the repository at this point in the history
…failing
  • Loading branch information
ljanyst committed Jun 6, 2013
1 parent 83179d7 commit 78df604
Showing 1 changed file with 34 additions and 21 deletions.
55 changes: 34 additions & 21 deletions src/XrdCl/XrdClXRootDTransport.cc
Expand Up @@ -1209,40 +1209,53 @@ namespace XrdCl
}

//------------------------------------------------------------------------
// We have either succeeded or failed, in either case we need to clean up
// We have succeeded
//------------------------------------------------------------------------
else
else if( rsp->hdr.status == kXR_ok )
{
info->authProtocolName = info->authProtocol->Entity.prot;
CleanUpAuthentication( info );

//----------------------------------------------------------------------
// Success
//----------------------------------------------------------------------
if( rsp->hdr.status == kXR_ok )
log->Debug( XRootDTransportMsg,
"[%s] Authenticated with %s.", hsData->streamName.c_str(),
protocolName.c_str() );
return Status();
}
//------------------------------------------------------------------------
// Failure
//------------------------------------------------------------------------
else if( rsp->hdr.status == kXR_error )
{
log->Error( XRootDTransportMsg,
"[%s] Authentication with %s failed: %s",
hsData->streamName.c_str(), protocolName.c_str(),
rsp->body.error.errmsg );

if( info->authProtocol )
{
log->Debug( XRootDTransportMsg,
"[%s] Authenticated with %s.", hsData->streamName.c_str(),
protocolName.c_str() );
return Status();
info->authProtocol->Delete();
info->authProtocol = 0;
}

//----------------------------------------------------------------------
// Failure
// Find another protocol that gives us valid credentials
//----------------------------------------------------------------------
else if( rsp->hdr.status == kXR_error )
Status st = GetCredentials( credentials, hsData, info );
if( !st.IsOK() )
{
log->Error( XRootDTransportMsg,
"[%s] Authentication with %s failed: %s",
hsData->streamName.c_str(), protocolName.c_str(),
rsp->body.error.errmsg );

return Status( stFatal, errAuthFailed );
CleanUpAuthentication( info );
return st;
}
protocolName = info->authProtocol->Entity.prot;
}
//------------------------------------------------------------------------
// God knows what
//------------------------------------------------------------------------
else
{
info->authProtocolName = info->authProtocol->Entity.prot;
CleanUpAuthentication( info );

//----------------------------------------------------------------------
// God knows what
//----------------------------------------------------------------------
log->Error( XRootDTransportMsg,
"[%s] Authentication with %s failed: unexpected answer",
hsData->streamName.c_str(), protocolName.c_str() );
Expand Down

0 comments on commit 78df604

Please sign in to comment.