summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-11-03 18:52:03 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-11-03 20:54:36 (GMT)
commit7a26e76bd05283fcc329469d25a2640107966603 (patch)
tree6aaab1a11cc344d5dd59302450ba70c350963847 /Swiften/Client
parent7b0795215f601a9561dbedbed3af32dbe9aba032 (diff)
downloadswift-contrib-7a26e76bd05283fcc329469d25a2640107966603.zip
swift-contrib-7a26e76bd05283fcc329469d25a2640107966603.tar.bz2
Quick brush up after previous patch.
Includes: Initial cleanup of SChannel code; compiling on non-Windows Be willing to compile Swift with SChannel Undo some (presumably accidental) OpenSSL changes Where TLS doesn't support finish messages (SChannel), don't try -PLUS
Diffstat (limited to 'Swiften/Client')
-rw-r--r--Swiften/Client/ClientSession.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp
index fd001a1..55e0bc2 100644
--- a/Swiften/Client/ClientSession.cpp
+++ b/Swiften/Client/ClientSession.cpp
@@ -201,10 +201,16 @@ void ClientSession::handleElement(boost::shared_ptr<Element> element) {
}
else if (streamFeatures->hasAuthenticationMechanism("SCRAM-SHA-1") || streamFeatures->hasAuthenticationMechanism("SCRAM-SHA-1-PLUS")) {
std::ostringstream s;
+ ByteArray finishMessage;
+ bool plus = stream->isTLSEncrypted() && streamFeatures->hasAuthenticationMechanism("SCRAM-SHA-1-PLUS");
+ if (plus) {
+ finishMessage = stream->getTLSFinishMessage();
+ plus &= !finishMessage.empty();
+ }
s << boost::uuids::random_generator()();
- SCRAMSHA1ClientAuthenticator* scramAuthenticator = new SCRAMSHA1ClientAuthenticator(s.str(), streamFeatures->hasAuthenticationMechanism("SCRAM-SHA-1-PLUS"));
- if (stream->isTLSEncrypted()) {
- scramAuthenticator->setTLSChannelBindingData(stream->getTLSFinishMessage());
+ SCRAMSHA1ClientAuthenticator* scramAuthenticator = new SCRAMSHA1ClientAuthenticator(s.str(), plus);
+ if (plus) {
+ scramAuthenticator->setTLSChannelBindingData(finishMessage);
}
authenticator = scramAuthenticator;
state = WaitingForCredentials;