Author: gsim
Date: Tue Jul  8 10:40:14 2014
New Revision: 1608711

URL: http://svn.apache.org/r1608711
Log:
QPID-5883: improve error message a little for 'no-mech' sasl error

Modified:
    qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp?rev=1608711&r1=1608710&r2=1608711&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/SaslFactory.cpp Tue Jul  8 10:40:14 2014
@@ -279,11 +279,11 @@ bool CyrusSasl::start(const std::string&
     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&
         }        
     } 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)));
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to