diff options
Diffstat (limited to 'Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp')
| -rw-r--r-- | Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp b/Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp index aae437f..10e8c89 100644 --- a/Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp +++ b/Swiften/SASL/WindowsGSSAPIClientAuthenticator.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2015-2016 Isode Limited. | 2 | * Copyright (c) 2015-2019 Isode Limited. |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * See the COPYING file for more information. | 4 | * See the COPYING file for more information. |
| 5 | */ | 5 | */ |
| @@ -44,7 +44,7 @@ WindowsGSSAPIClientAuthenticator::~WindowsGSSAPIClientAuthenticator() { | |||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | boost::optional<SafeByteArray> WindowsGSSAPIClientAuthenticator::getResponse() const { | 46 | boost::optional<SafeByteArray> WindowsGSSAPIClientAuthenticator::getResponse() const { |
| 47 | SWIFT_LOG(debug) << "response_.size(): " << response_.size() << std::endl; | 47 | SWIFT_LOG(debug) << "response_.size(): " << response_.size(); |
| 48 | return response_; | 48 | return response_; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| @@ -56,7 +56,7 @@ bool WindowsGSSAPIClientAuthenticator::setChallenge(const boost::optional<ByteAr | |||
| 56 | } | 56 | } |
| 57 | else if (step_ == SecurityLayerNegotiation) { | 57 | else if (step_ == SecurityLayerNegotiation) { |
| 58 | if (!challengeData) { | 58 | if (!challengeData) { |
| 59 | SWIFT_LOG(debug) << "Empty message received from the server" << std::endl; | 59 | SWIFT_LOG(debug) << "Empty message received from the server"; |
| 60 | error_ = true; | 60 | error_ = true; |
| 61 | return false; | 61 | return false; |
| 62 | } | 62 | } |
| @@ -68,7 +68,7 @@ bool WindowsGSSAPIClientAuthenticator::setChallenge(const boost::optional<ByteAr | |||
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | if (challenge.size() != 4) { | 70 | if (challenge.size() != 4) { |
| 71 | SWIFT_LOG(debug) << "Token received from the server of incorrect length: " << challenge.size() << std::endl; | 71 | SWIFT_LOG(debug) << "Token received from the server of incorrect length: " << challenge.size(); |
| 72 | error_ = true; | 72 | error_ = true; |
| 73 | return false; | 73 | return false; |
| 74 | } | 74 | } |
| @@ -77,14 +77,14 @@ bool WindowsGSSAPIClientAuthenticator::setChallenge(const boost::optional<ByteAr | |||
| 77 | 77 | ||
| 78 | unsigned char serverSecurityLayer = challengePointer[0]; | 78 | unsigned char serverSecurityLayer = challengePointer[0]; |
| 79 | if (serverSecurityLayer == 0) { | 79 | if (serverSecurityLayer == 0) { |
| 80 | SWIFT_LOG(debug) << "Server supports unknown security layer, assuming no security layer" << std::endl; | 80 | SWIFT_LOG(debug) << "Server supports unknown security layer, assuming no security layer"; |
| 81 | serverSecurityLayer = SECURITY_LAYER_NONE; | 81 | serverSecurityLayer = SECURITY_LAYER_NONE; |
| 82 | } | 82 | } |
| 83 | else if (serverSecurityLayer == SECURITY_LAYER_NONE) { | 83 | else if (serverSecurityLayer == SECURITY_LAYER_NONE) { |
| 84 | SWIFT_LOG(debug) << "Server supports no security layer" << std::endl; | 84 | SWIFT_LOG(debug) << "Server supports no security layer"; |
| 85 | } | 85 | } |
| 86 | else { | 86 | else { |
| 87 | SWIFT_LOG(debug) << "Server supports security layer" << std::endl; | 87 | SWIFT_LOG(debug) << "Server supports security layer"; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | unsigned int serverMaximumBuffer = (challengePointer[1] << 16) | | 90 | unsigned int serverMaximumBuffer = (challengePointer[1] << 16) | |
| @@ -92,7 +92,7 @@ bool WindowsGSSAPIClientAuthenticator::setChallenge(const boost::optional<ByteAr | |||
| 92 | (challengePointer[3] << 0); | 92 | (challengePointer[3] << 0); |
| 93 | 93 | ||
| 94 | if ((serverSecurityLayer == SECURITY_LAYER_NONE) && (serverMaximumBuffer != 0)) { | 94 | if ((serverSecurityLayer == SECURITY_LAYER_NONE) && (serverMaximumBuffer != 0)) { |
| 95 | SWIFT_LOG(debug) << "Server supports no security layer but has maximum buffer size" << serverMaximumBuffer << std::endl; | 95 | SWIFT_LOG(debug) << "Server supports no security layer but has maximum buffer size" << serverMaximumBuffer; |
| 96 | error_ = true; | 96 | error_ = true; |
| 97 | return false; | 97 | return false; |
| 98 | } | 98 | } |
| @@ -158,7 +158,7 @@ void WindowsGSSAPIClientAuthenticator::buildSecurityContext(const boost::optiona | |||
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | if (contextSupported & ISC_REQ_MUTUAL_AUTH == 0) { | 160 | if (contextSupported & ISC_REQ_MUTUAL_AUTH == 0) { |
| 161 | SWIFT_LOG(debug) << "Mutual authentication not supported" << std::endl; | 161 | SWIFT_LOG(debug) << "Mutual authentication not supported"; |
| 162 | error_ = true; | 162 | error_ = true; |
| 163 | return; | 163 | return; |
| 164 | } | 164 | } |
| @@ -181,14 +181,14 @@ void WindowsGSSAPIClientAuthenticator::buildSecurityContext(const boost::optiona | |||
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | userName_ = names.sUserName; | 183 | userName_ = names.sUserName; |
| 184 | SWIFT_LOG(debug) << "User name: " << userName_ << std::endl; | 184 | SWIFT_LOG(debug) << "User name: " << userName_; |
| 185 | 185 | ||
| 186 | std::size_t position = userName_.find("\\"); | 186 | std::size_t position = userName_.find("\\"); |
| 187 | clientName_ = userName_.substr(position + 1); | 187 | clientName_ = userName_.substr(position + 1); |
| 188 | SWIFT_LOG(debug) << "Client name: " << clientName_ << std::endl; | 188 | SWIFT_LOG(debug) << "Client name: " << clientName_; |
| 189 | 189 | ||
| 190 | serverName_ = userName_.substr(0, position); | 190 | serverName_ = userName_.substr(0, position); |
| 191 | SWIFT_LOG(debug) << "Server name: " << serverName_ << std::endl; | 191 | SWIFT_LOG(debug) << "Server name: " << serverName_; |
| 192 | 192 | ||
| 193 | freeContextBuffer(names.sUserName); | 193 | freeContextBuffer(names.sUserName); |
| 194 | step_ = SecurityLayerNegotiation; | 194 | step_ = SecurityLayerNegotiation; |
Swift