From b0ed6faecb9d7dbbe91ac39af6bbdc2ad412253c Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 27 May 2010 20:02:30 +0000 Subject: Fix problems with cluster_authentication_soak test in VPATH build. - Fix SASL version testing logic in cluster_authentication_soak and SaslAuthenticator - Generate all SASL config in the build directory in sasl_test_setup.sh - Compile cluster_authentication_soak only if SASL is available. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@948968 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/broker/SaslAuthenticator.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'cpp/src/qpid') diff --git a/cpp/src/qpid/broker/SaslAuthenticator.cpp b/cpp/src/qpid/broker/SaslAuthenticator.cpp index 1683432329..6e78446334 100644 --- a/cpp/src/qpid/broker/SaslAuthenticator.cpp +++ b/cpp/src/qpid/broker/SaslAuthenticator.cpp @@ -95,21 +95,19 @@ bool SaslAuthenticator::available(void) { // Initialize the SASL mechanism; throw if it fails. void SaslAuthenticator::init(const std::string& saslName, std::string const & saslConfigPath ) { - int code; - // If we are not given a specific sasl path, do - // nothing and allow the default to be used. - // If we have a version of SASL in which SASL_PATH_TYPE_CONFIG does not yet exist, do nothing. - #if (SASL_VERSION_MAJOR >= 2) && (SASL_VERSION_MINOR >= 1) && (SASL_VERSION_STEP >= 22) + // Check if we have a version of SASL that supports sasl_set_path() +#if (SASL_VERSION_FULL >= ((2<<16)|(1<<8)|22)) + // If we are not given a sasl path, do nothing and allow the default to be used. if ( ! saslConfigPath.empty() ) { - if(SASL_OK != (code=sasl_set_path(SASL_PATH_TYPE_CONFIG, const_cast(saslConfigPath.c_str())))) { - QPID_LOG(error, "SASL: sasl_set_path: [" << code << "] " ); - return; - } + int code = sasl_set_path(SASL_PATH_TYPE_CONFIG, + const_cast(saslConfigPath.c_str())); + if(SASL_OK != code) + throw Exception(QPID_MSG("SASL: sasl_set_path failed [" << code << "] " )); QPID_LOG(info, "SASL: config path set to " << saslConfigPath ); } - #endif +#endif - code = sasl_server_init(NULL, saslName.c_str()); + int code = sasl_server_init(NULL, saslName.c_str()); if (code != SASL_OK) { // TODO: Figure out who owns the char* returned by // sasl_errstring, though it probably does not matter much -- cgit v1.2.1