summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/Broker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/broker/Broker.cpp')
-rw-r--r--cpp/src/qpid/broker/Broker.cpp33
1 files changed, 7 insertions, 26 deletions
diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp
index 910c774958..6a308ab64d 100644
--- a/cpp/src/qpid/broker/Broker.cpp
+++ b/cpp/src/qpid/broker/Broker.cpp
@@ -19,7 +19,6 @@
*
*/
-#include "config.h"
#include "Broker.h"
#include "DirectExchange.h"
#include "FanOutExchange.h"
@@ -27,6 +26,7 @@
#include "MessageStoreModule.h"
#include "NullMessageStore.h"
#include "RecoveryManagerImpl.h"
+#include "SaslAuthenticator.h"
#include "TopicExchange.h"
#include "Link.h"
@@ -56,13 +56,6 @@
#include <memory>
#include <stdlib.h>
-#if HAVE_SASL
-#include <sasl/sasl.h>
-static const bool AUTH_DEFAULT=true;
-#else
-static const bool AUTH_DEFAULT=false;
-#endif
-
using qpid::sys::ProtocolFactory;
using qpid::sys::Poller;
using qpid::sys::Dispatcher;
@@ -89,7 +82,7 @@ Broker::Options::Options(const std::string& name) :
enableMgmt(1),
mgmtPubInterval(10),
queueCleanInterval(60*10),//10 minutes
- auth(AUTH_DEFAULT),
+ auth(SaslAuthenticator::available()),
realm("QPID"),
replayFlushLimit(0),
replayHardLimit(0),
@@ -101,10 +94,10 @@ Broker::Options::Options(const std::string& name) :
char *home = ::getenv("HOME");
if (home == 0)
- dataDir += "/tmp";
+ dataDir += DEFAULT_DATA_DIR_LOCATION;
else
dataDir += home;
- dataDir += "/.qpidd";
+ dataDir += DEFAULT_DATA_DIR_NAME;
addOptions()
("data-dir", optValue(dataDir,"DIR"), "Directory to contain persistent data generated by the broker")
@@ -234,17 +227,8 @@ Broker::Broker(const Broker::Options& conf) :
* SASL setup, can fail and terminate startup
*/
if (conf.auth) {
-#if HAVE_SASL
- int code = sasl_server_init(NULL, BROKER_SASL_NAME);
- if (code != SASL_OK) {
- // TODO: Figure out who owns the char* returned by
- // sasl_errstring, though it probably does not matter much
- throw Exception(sasl_errstring(code, NULL, NULL));
- }
+ SaslAuthenticator::init(qpid::saslName);
QPID_LOG(info, "SASL enabled");
-#else
- throw Exception("Requested authentication but SASL unavailable");
-#endif
}
// Initialize plugins
@@ -318,11 +302,8 @@ Broker::~Broker() {
shutdown();
finalize(); // Finalize any plugins.
delete store;
- if (config.auth) {
-#if HAVE_SASL
- sasl_done();
-#endif
- }
+ if (config.auth)
+ SaslAuthenticator::fini();
QPID_LOG(notice, "Shut down");
}