summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2011-08-04 13:35:56 +0000
committerGordon Sim <gsim@apache.org>2011-08-04 13:35:56 +0000
commita67a55ffb1b4b0d03336ab5aab82b9c99d19b881 (patch)
tree4cee4e7b0d909b128bc0f3785edaa8297f99d476 /cpp/src
parent4cff8f270d62c56a115ecba3caece9b4abbb122e (diff)
downloadqpid-python-a67a55ffb1b4b0d03336ab5aab82b9c99d19b881.tar.gz
QPID-3393: Fix CRAM-MD5, need to distinguish between null string and empty string on sasl_server_start().
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1153883 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/SaslAuthenticator.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/cpp/src/qpid/broker/SaslAuthenticator.cpp b/cpp/src/qpid/broker/SaslAuthenticator.cpp
index acdb4934d4..07d5045852 100644
--- a/cpp/src/qpid/broker/SaslAuthenticator.cpp
+++ b/cpp/src/qpid/broker/SaslAuthenticator.cpp
@@ -384,7 +384,7 @@ void CyrusAuthenticator::start(const string& mechanism, const string& response)
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::processAuthenticationStep(int code, const char *challen
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