diff options
author | Jonathan Robie <jonathan@apache.org> | 2011-02-02 16:00:51 +0000 |
---|---|---|
committer | Jonathan Robie <jonathan@apache.org> | 2011-02-02 16:00:51 +0000 |
commit | 5a8c4d1855fdcf7fe2588502d80b767edabae96e (patch) | |
tree | 281f03af5c9685ede59e59c241c2e01976a05ca5 /cpp/src/qpid/client | |
parent | 8cc4082337bd6ea1be0c9f96d3383314f7fc228b (diff) | |
download | qpid-python-5a8c4d1855fdcf7fe2588502d80b767edabae96e.tar.gz |
Resolves QPID-3031. Allows client connection options to specify an SSL cert-name.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1066508 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client')
-rw-r--r-- | cpp/src/qpid/client/ConnectionSettings.cpp | 9 | ||||
-rw-r--r-- | cpp/src/qpid/client/SslConnector.cpp | 23 | ||||
-rw-r--r-- | cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp | 14 | ||||
-rw-r--r-- | cpp/src/qpid/client/amqp0_10/ConnectionImpl.h | 4 |
4 files changed, 28 insertions, 22 deletions
diff --git a/cpp/src/qpid/client/ConnectionSettings.cpp b/cpp/src/qpid/client/ConnectionSettings.cpp index 60b2eac2e8..822e4af269 100644 --- a/cpp/src/qpid/client/ConnectionSettings.cpp +++ b/cpp/src/qpid/client/ConnectionSettings.cpp @@ -7,9 +7,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -30,7 +30,7 @@ namespace client { ConnectionSettings::ConnectionSettings() : protocol("tcp"), - host("localhost"), + host("localhost"), port(5672), locale("en_US"), heartbeat(0), @@ -40,7 +40,8 @@ ConnectionSettings::ConnectionSettings() : tcpNoDelay(false), service(qpid::saslName), minSsf(0), - maxSsf(256) + maxSsf(256), + sslCertName("") {} ConnectionSettings::~ConnectionSettings() {} diff --git a/cpp/src/qpid/client/SslConnector.cpp b/cpp/src/qpid/client/SslConnector.cpp index e82fc2f8da..35c7e6bdf6 100644 --- a/cpp/src/qpid/client/SslConnector.cpp +++ b/cpp/src/qpid/client/SslConnector.cpp @@ -7,9 +7,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -130,7 +130,7 @@ class SslConnector : public Connector public: SslConnector(Poller::shared_ptr p, framing::ProtocolVersion pVersion, - const ConnectionSettings&, + const ConnectionSettings&, ConnectionImpl*); }; @@ -170,7 +170,7 @@ SslConnector::SslConnector(Poller::shared_ptr p, const ConnectionSettings& settings, ConnectionImpl* cimpl) : maxFrameSize(settings.maxFrameSize), - version(ver), + version(ver), initiated(false), closed(true), shutdownHandler(0), @@ -179,8 +179,11 @@ SslConnector::SslConnector(Poller::shared_ptr p, poller(p) { QPID_LOG(debug, "SslConnector created for " << version.toString()); - //TODO: how do we want to handle socket configuration with ssl? - //settings.configureSocket(socket); + + if (settings.sslCertName != "") { + QPID_LOG(debug, "ssl-cert-name = " << settings.sslCertName); + socket.setCertName(settings.sslCertName); + } } SslConnector::~SslConnector() { @@ -244,14 +247,14 @@ void SslConnector::setShutdownHandler(ShutdownHandler* handler){ } OutputHandler* SslConnector::getOutputHandler() { - return this; + return this; } sys::ShutdownHandler* SslConnector::getShutdownHandler() const { return shutdownHandler; } -const std::string& SslConnector::getIdentifier() const { +const std::string& SslConnector::getIdentifier() const { return identifier; } @@ -271,7 +274,7 @@ void SslConnector::Writer::init(std::string id, sys::ssl::SslIO* a) { aio = a; newBuffer(); } -void SslConnector::Writer::handle(framing::AMQFrame& frame) { +void SslConnector::Writer::handle(framing::AMQFrame& frame) { Mutex::ScopedLock l(lock); frames.push_back(frame); if (frame.getEof() || (bounds && bounds->getCurrentSize() >= maxFrameSize)) { @@ -372,7 +375,7 @@ const SecuritySettings* SslConnector::getSecuritySettings() { securitySettings.ssf = socket.getKeyLen(); securitySettings.authid = "dummy";//set to non-empty string to enable external authentication - return &securitySettings; + return &securitySettings; } }} // namespace qpid::client diff --git a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp index a60177a5d8..5a545c1f6a 100644 --- a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp +++ b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.cpp @@ -7,9 +7,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -42,7 +42,7 @@ using qpid::framing::Uuid; void convert(const Variant::List& from, std::vector<std::string>& to) { for (Variant::List::const_iterator i = from.begin(); i != from.end(); ++i) { - to.push_back(i->asString()); + to.push_back(i->asString()); } } @@ -108,9 +108,11 @@ void convert(const Variant::Map& from, ConnectionSettings& to) setIfFound(from, "bounds", to.bounds); setIfFound(from, "transport", to.protocol); + + setIfFound(from, "ssl-cert-name", to.sslCertName); } -ConnectionImpl::ConnectionImpl(const std::string& url, const Variant::Map& options) : +ConnectionImpl::ConnectionImpl(const std::string& url, const Variant::Map& options) : reconnect(false), timeout(-1), limit(-1), minReconnectInterval(3), maxReconnectInterval(60), retries(0), reconnectOnLimitExceeded(true) @@ -135,7 +137,7 @@ void ConnectionImpl::setOptions(const Variant::Map& options) setIfFound(options, "reconnect-interval-max", maxReconnectInterval); } setIfFound(options, "reconnect-urls", urls); - setIfFound(options, "x-reconnect-on-limit-exceeded", reconnectOnLimitExceeded); + setIfFound(options, "x-reconnect-on-limit-exceeded", reconnectOnLimitExceeded); } void ConnectionImpl::setOption(const std::string& name, const Variant& value) @@ -216,7 +218,7 @@ qpid::messaging::Session ConnectionImpl::newSession(bool transactional, const st } catch (const qpid::SessionException& e) { throw qpid::messaging::SessionError(e.what()); } catch (const std::exception& e) { - throw qpid::messaging::MessagingException(e.what()); + throw qpid::messaging::MessagingException(e.what()); } } return impl; diff --git a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h index 8562add6b1..09f2038312 100644 --- a/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h +++ b/cpp/src/qpid/client/amqp0_10/ConnectionImpl.h @@ -10,9 +10,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |