summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2014-07-08 10:40:14 +0000
committerGordon Sim <gsim@apache.org>2014-07-08 10:40:14 +0000
commitaae5c8ef6db4da0be4913db479e2b9290cc286f8 (patch)
tree3b535fb3c309a91db1a21bb2a124cf4f2ecb8840 /qpid/cpp
parent8f8bb3e30a43611c15614e8a9a12fbfe99d0261e (diff)
downloadqpid-python-aae5c8ef6db4da0be4913db479e2b9290cc286f8.tar.gz
QPID-5883: improve error message a little for 'no-mech' sasl error
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1608711 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/SaslFactory.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/qpid/cpp/src/qpid/SaslFactory.cpp b/qpid/cpp/src/qpid/SaslFactory.cpp
index f5b2b0108f..7dbe90c314 100644
--- a/qpid/cpp/src/qpid/SaslFactory.cpp
+++ b/qpid/cpp/src/qpid/SaslFactory.cpp
@@ -279,11 +279,11 @@ bool CyrusSasl::start(const std::string& mechanisms, std::string& response, cons
secprops.maxbufsize = 65535;
QPID_LOG(debug, "min_ssf: " << secprops.min_ssf << ", max_ssf: " << secprops.max_ssf);
-
+
secprops.property_names = 0;
secprops.property_values = 0;
secprops.security_flags = 0;//TODO: provide means for application to configure these
-
+
result = sasl_setprop(conn, SASL_SEC_PROPS, &secprops);
if (result != SASL_OK) {
throw framing::InternalErrorException(QPID_MSG("SASL error: " << sasl_errdetail(conn)));
@@ -307,7 +307,13 @@ bool CyrusSasl::start(const std::string& mechanisms, std::string& response, cons
}
} while (result == SASL_INTERACT);
- if (result != SASL_CONTINUE && result != SASL_OK) {
+ if (result == SASL_NOMECH) {
+ if (mechanisms.size()) {
+ throw qpid::Exception(std::string("Can't authenticate using ") + mechanisms);
+ } else {
+ throw qpid::Exception("No mutually acceptable authentication mechanism");
+ }
+ } else if (result != SASL_CONTINUE && result != SASL_OK) {
throw InternalErrorException(QPID_MSG("Sasl error: " << sasl_errdetail(conn)));
}