summaryrefslogtreecommitdiff
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
commit430c03e2384b9d1e9e6915fcb179a8c503dba24d (patch)
tree1f1aaa2a26014d069ccdaed325e2b5a8953ebe91
parent415632254fd1716f501d5b55b825f1eb1040eaf2 (diff)
downloadqpid-python-430c03e2384b9d1e9e6915fcb179a8c503dba24d.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@1153883 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp b/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp
index acdb4934d4..07d5045852 100644
--- a/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp
+++ b/qpid/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