From aae5c8ef6db4da0be4913db479e2b9290cc286f8 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Tue, 8 Jul 2014 10:40:14 +0000 Subject: 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 --- qpid/cpp/src/qpid/SaslFactory.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'qpid/cpp/src') 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))); } -- cgit v1.2.1