Author: gsim Date: Thu Aug 4 13:35:56 2011 New Revision: 1153883 URL: http://svn.apache.org/viewvc?rev=1153883&view=rev Log: QPID-3393: Fix CRAM-MD5, need to distinguish between null string and empty string on sasl_server_start().
Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp?rev=1153883&r1=1153882&r2=1153883&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp Thu Aug 4 13:35:56 2011 @@ -384,7 +384,7 @@ void CyrusAuthenticator::start(const str QPID_LOG(debug, "SASL: Starting authentication with mechanism: " << mechanism); int code = sasl_server_start(sasl_conn, mechanism.c_str(), - response.c_str(), response.length(), + response.size() ? response.c_str() : 0, response.length(), &challenge, &challenge_len); processAuthenticationStep(code, challenge, challenge_len); @@ -424,10 +424,12 @@ void CyrusAuthenticator::processAuthenti client.secure(challenge_str); } else { std::string uid; + //save error detail before trying to retrieve username as error in doing so will overwrite it + std::string errordetail = sasl_errdetail(sasl_conn); if (!getUsername(uid)) { - QPID_LOG(info, "SASL: Authentication failed (no username available):" << sasl_errdetail(sasl_conn)); + QPID_LOG(info, "SASL: Authentication failed (no username available yet):" << errordetail); } else { - QPID_LOG(info, "SASL: Authentication failed for " << uid << ":" << sasl_errdetail(sasl_conn)); + QPID_LOG(info, "SASL: Authentication failed for " << uid << ":" << errordetail); } // TODO: Change to more specific exceptions, when they are --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org