diff options
| author | Gordon Sim <gsim@apache.org> | 2009-11-09 15:30:18 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2009-11-09 15:30:18 +0000 |
| commit | 58efa10f3ed794dac024a1995e871a1368faeddc (patch) | |
| tree | 7a96ce8642acfdc19546512fadfc8783fbc252d3 /cpp/src/qpid/client/SaslFactory.cpp | |
| parent | bb32d235be89547bb7e8621ce56c66e4dabdd43a (diff) | |
| download | qpid-python-58efa10f3ed794dac024a1995e871a1368faeddc.tar.gz | |
QPID-1899: Applied patch from Ken Giusti to tie in SASL enctryption to the handling of the --require-encrypted option
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@834108 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/client/SaslFactory.cpp')
| -rw-r--r-- | cpp/src/qpid/client/SaslFactory.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/cpp/src/qpid/client/SaslFactory.cpp b/cpp/src/qpid/client/SaslFactory.cpp index b699160066..5012b75c94 100644 --- a/cpp/src/qpid/client/SaslFactory.cpp +++ b/cpp/src/qpid/client/SaslFactory.cpp @@ -80,7 +80,7 @@ class CyrusSasl : public Sasl public: CyrusSasl(const ConnectionSettings&); ~CyrusSasl(); - std::string start(const std::string& mechanisms); + std::string start(const std::string& mechanisms, unsigned int ssf); std::string step(const std::string& challenge); std::string getMechanism(); std::string getUserId(); @@ -176,7 +176,7 @@ namespace { const std::string SSL("ssl"); } -std::string CyrusSasl::start(const std::string& mechanisms) +std::string CyrusSasl::start(const std::string& mechanisms, unsigned int ssf) { QPID_LOG(debug, "CyrusSasl::start(" << mechanisms << ")"); int result = sasl_client_new(settings.service.c_str(), @@ -189,7 +189,18 @@ std::string CyrusSasl::start(const std::string& mechanisms) if (result != SASL_OK) throw InternalErrorException(QPID_MSG("Sasl error: " << sasl_errdetail(conn))); sasl_security_properties_t secprops; - + + if (ssf) { + sasl_ssf_t external_ssf = (sasl_ssf_t) ssf; + if (external_ssf) { + int result = sasl_setprop(conn, SASL_SSF_EXTERNAL, &external_ssf); + if (result != SASL_OK) { + throw framing::InternalErrorException(QPID_MSG("SASL error: unable to set external SSF: " << result)); + } + QPID_LOG(debug, "external SSF detected and set to " << ssf); + } + } + secprops.min_ssf = settings.minSsf; secprops.max_ssf = settings.maxSsf; secprops.maxbufsize = 65535; |
