diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-11-22 16:46:37 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-11-22 16:54:51 (GMT) |
commit | 497dd9b099e5810057ebcd8a3f6755819cfecdef (patch) | |
tree | a65ecc29c3f86d2ed6b6050d4650708abceafa3d /Swiften/Client | |
parent | d9ca66fa828e99ec5b4067d954c97d882b9ab8fe (diff) | |
download | swift-497dd9b099e5810057ebcd8a3f6755819cfecdef.zip swift-497dd9b099e5810057ebcd8a3f6755819cfecdef.tar.bz2 |
Added auth success value support.
Diffstat (limited to 'Swiften/Client')
-rw-r--r-- | Swiften/Client/Client.cpp | 3 | ||||
-rw-r--r-- | Swiften/Client/ClientError.h | 1 | ||||
-rw-r--r-- | Swiften/Client/ClientSession.cpp | 18 | ||||
-rw-r--r-- | Swiften/Client/ClientSession.h | 1 |
4 files changed, 16 insertions, 7 deletions
diff --git a/Swiften/Client/Client.cpp b/Swiften/Client/Client.cpp index 2bd039a..874e23b 100644 --- a/Swiften/Client/Client.cpp +++ b/Swiften/Client/Client.cpp @@ -141,6 +141,9 @@ void Client::handleSessionFinished(boost::shared_ptr<Error> error) { case ClientSession::Error::AuthenticationFailedError: clientError = ClientError(ClientError::AuthenticationFailedError); break; + case ClientSession::Error::ServerVerificationFailedError: + clientError = ClientError(ClientError::ServerVerificationFailedError); + break; case ClientSession::Error::NoSupportedAuthMechanismsError: clientError = ClientError(ClientError::NoSupportedAuthMechanismsError); break; diff --git a/Swiften/Client/ClientError.h b/Swiften/Client/ClientError.h index d4f280c..55c57fc 100644 --- a/Swiften/Client/ClientError.h +++ b/Swiften/Client/ClientError.h @@ -11,6 +11,7 @@ namespace Swift { ConnectionWriteError, XMLError, AuthenticationFailedError, + ServerVerificationFailedError, NoSupportedAuthMechanismsError, UnexpectedElementError, ResourceBindError, diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp index fb80754..960af70 100644 --- a/Swiften/Client/ClientSession.cpp +++ b/Swiften/Client/ClientSession.cpp @@ -130,14 +130,18 @@ void ClientSession::handleElement(boost::shared_ptr<Element> element) { finishSession(Error::AuthenticationFailedError); } } - else if (dynamic_cast<AuthSuccess*>(element.get())) { - // TODO: Check success data with authenticator + else if (AuthSuccess* authSuccess = dynamic_cast<AuthSuccess*>(element.get())) { checkState(Authenticating); - state = WaitingForStreamStart; - delete authenticator; - authenticator = NULL; - stream->resetXMPPParser(); - sendStreamHeader(); + if (!authenticator->setChallenge(authSuccess->getValue())) { + finishSession(Error::ServerVerificationFailedError); + } + else { + state = WaitingForStreamStart; + delete authenticator; + authenticator = NULL; + stream->resetXMPPParser(); + sendStreamHeader(); + } } else if (dynamic_cast<AuthFailure*>(element.get())) { delete authenticator; diff --git a/Swiften/Client/ClientSession.h b/Swiften/Client/ClientSession.h index f3bc119..5e5acbc 100644 --- a/Swiften/Client/ClientSession.h +++ b/Swiften/Client/ClientSession.h @@ -34,6 +34,7 @@ namespace Swift { struct Error : public Swift::Error { enum Type { AuthenticationFailedError, + ServerVerificationFailedError, NoSupportedAuthMechanismsError, UnexpectedElementError, ResourceBindError, |