summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Client/ClientSession.cpp')
-rw-r--r--Swiften/Client/ClientSession.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp
index 4c2be95..7170a20 100644
--- a/Swiften/Client/ClientSession.cpp
+++ b/Swiften/Client/ClientSession.cpp
@@ -11,6 +11,7 @@
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/uuid_generators.hpp>
+#include "Swiften/TLS/SecurityError.h"
#include "Swiften/Elements/ProtocolHeader.h"
#include "Swiften/Elements/StreamFeatures.h"
#include "Swiften/Elements/StartTLSRequest.h"
@@ -322,8 +323,26 @@ void ClientSession::sendCredentials(const String& password) {
stream->writeElement(boost::shared_ptr<AuthRequest>(new AuthRequest(authenticator->getName(), authenticator->getResponse())));
}
+void ClientSession::continueAfterSecurityError() {
+ checkState(WaitingForContinueAfterSecurityError);
+ continueAfterTLSEncrypted();
+}
+
void ClientSession::handleTLSEncrypted() {
checkState(Encrypting);
+
+ Certificate::ref certificate = stream->getPeerCertificate();
+ boost::optional<CertificateVerificationError> verificationError = stream->getPeerCertificateVerificationError();
+ if (verificationError) {
+ state = WaitingForContinueAfterSecurityError;
+ onSecurityError(SecurityError(*verificationError));
+ }
+ else {
+ continueAfterTLSEncrypted();
+ }
+}
+
+void ClientSession::continueAfterTLSEncrypted() {
state = WaitingForStreamStart;
stream->resetXMPPParser();
sendStreamHeader();