diff options
author | Gordon Sim <gsim@apache.org> | 2015-05-06 21:11:45 +0000 |
---|---|---|
committer | Gordon Sim <gsim@apache.org> | 2015-05-06 21:11:45 +0000 |
commit | 4726f5f14b732ed2b920e0c642cf74e08816f0cc (patch) | |
tree | c429876dd7103513d6c8b717ccfb3ed17a37124b /qpid/cpp/src/qpid/SaslFactory.cpp | |
parent | 81085b0aeae2c0a99142020b0000ed7ebc1d94a2 (diff) | |
download | qpid-python-4726f5f14b732ed2b920e0c642cf74e08816f0cc.tar.gz |
QPID-6532: make sasl service name configurable
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1678094 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/qpid/SaslFactory.cpp')
-rw-r--r-- | qpid/cpp/src/qpid/SaslFactory.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/qpid/cpp/src/qpid/SaslFactory.cpp b/qpid/cpp/src/qpid/SaslFactory.cpp index 7dbe90c314..f38c592ad5 100644 --- a/qpid/cpp/src/qpid/SaslFactory.cpp +++ b/qpid/cpp/src/qpid/SaslFactory.cpp @@ -53,7 +53,7 @@ std::auto_ptr<Sasl> SaslFactory::create( const std::string &, const std::string return client; } -std::auto_ptr<SaslServer> SaslFactory::createServer(const std::string& realm, bool /*encryptionRequired*/, const qpid::sys::SecuritySettings&) +std::auto_ptr<SaslServer> SaslFactory::createServer(const std::string& realm, const std::string& /*service*/, bool /*encryptionRequired*/, const qpid::sys::SecuritySettings&) { std::auto_ptr<SaslServer> server(new NullSaslServer(realm)); return server; @@ -152,7 +152,7 @@ std::auto_ptr<SaslFactory> SaslFactory::instance; class CyrusSaslServer : public SaslServer { public: - CyrusSaslServer(const std::string& realm, bool encryptionRequired, const qpid::sys::SecuritySettings& external); + CyrusSaslServer(const std::string& realm, const std::string& service, bool encryptionRequired, const qpid::sys::SecuritySettings& external); ~CyrusSaslServer(); Status start(const std::string& mechanism, const std::string* response, std::string& challenge); Status step(const std::string* response, std::string& challenge); @@ -161,6 +161,7 @@ class CyrusSaslServer : public SaslServer std::auto_ptr<qpid::sys::SecurityLayer> getSecurityLayer(size_t); private: std::string realm; + std::string service; std::string userid; sasl_conn_t *sasl_conn; }; @@ -194,9 +195,9 @@ std::auto_ptr<Sasl> SaslFactory::create(const std::string & username, const std: return sasl; } -std::auto_ptr<SaslServer> SaslFactory::createServer(const std::string& realm, bool encryptionRequired, const qpid::sys::SecuritySettings& external) +std::auto_ptr<SaslServer> SaslFactory::createServer(const std::string& realm, const std::string& service, bool encryptionRequired, const qpid::sys::SecuritySettings& external) { - std::auto_ptr<SaslServer> server(new CyrusSaslServer(realm, encryptionRequired, external)); + std::auto_ptr<SaslServer> server(new CyrusSaslServer(realm, service, encryptionRequired, external)); return server; } @@ -419,9 +420,9 @@ std::auto_ptr<SecurityLayer> CyrusSasl::getSecurityLayer(uint16_t maxFrameSize) return securityLayer; } -CyrusSaslServer::CyrusSaslServer(const std::string& r, bool encryptionRequired, const qpid::sys::SecuritySettings& external) : realm(r), sasl_conn(0) +CyrusSaslServer::CyrusSaslServer(const std::string& r, const std::string& s, bool encryptionRequired, const qpid::sys::SecuritySettings& external) : realm(r), service(s), sasl_conn(0) { - int code = sasl_server_new(BROKER_SASL_NAME, /* Service name */ + int code = sasl_server_new(service.c_str(), /* Service name */ NULL, /* Server FQDN, gethostname() */ realm.c_str(), /* Authentication realm */ NULL, /* Local IP, needed for some mechanism */ |