diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 05:49:31 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 05:49:31 +0000 |
commit | 6c8beb5f61062a2926301d53f721dd81aa6dfda7 (patch) | |
tree | 046a10a30db42cf75605bfd0bf9834fd1b1c5694 /chrome | |
parent | e648166a931897dc068fb7b84725200e70911731 (diff) | |
download | chromium_src-6c8beb5f61062a2926301d53f721dd81aa6dfda7.zip chromium_src-6c8beb5f61062a2926301d53f721dd81aa6dfda7.tar.gz chromium_src-6c8beb5f61062a2926301d53f721dd81aa6dfda7.tar.bz2 |
Recombined buzz::PreXmppAuth and buzz::SaslHandler to be compatible
with upstream libjingle again.
Changed GaiaOnlySaslHandler to GaiaTokenPreXmppAuth to match
libjingle changes.
BUG=none
TEST=made sure sync worked with an @google.com account.
Review URL: http://codereview.chromium.org/2221004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48364 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
3 files changed, 39 insertions, 10 deletions
diff --git a/chrome/browser/sync/tools/sync_listen_notifications.cc b/chrome/browser/sync/tools/sync_listen_notifications.cc index 91610f2..d57f466 100644 --- a/chrome/browser/sync/tools/sync_listen_notifications.cc +++ b/chrome/browser/sync/tools/sync_listen_notifications.cc @@ -92,7 +92,7 @@ class XmppNotificationClient : public sigslot::has_slots<> { // Transfers ownership of xmpp_socket_adapter. buzz::XmppReturnStatus connect_status = xmpp_client_->Connect(xmpp_client_settings_, "", - xmpp_socket_adapter, NULL, NULL); + xmpp_socket_adapter, NULL); CHECK_EQ(connect_status, buzz::XMPP_RETURN_OK); xmpp_client_->Start(); talk_base::Thread* current_thread = diff --git a/chrome/common/net/notifier/communicator/single_login_attempt.cc b/chrome/common/net/notifier/communicator/single_login_attempt.cc index 217e13f..965a024 100644 --- a/chrome/common/net/notifier/communicator/single_login_attempt.cc +++ b/chrome/common/net/notifier/communicator/single_login_attempt.cc @@ -23,8 +23,8 @@ #include "talk/base/taskrunner.h" #include "talk/base/winsock_initializer.h" #include "talk/xmllite/xmlelement.h" +#include "talk/xmpp/prexmppauth.h" #include "talk/xmpp/saslcookiemechanism.h" -#include "talk/xmpp/saslhandler.h" #include "talk/xmpp/xmppclient.h" #include "talk/xmpp/xmppclientsettings.h" #include "talk/xmpp/xmppconstants.h" @@ -58,9 +58,9 @@ const char kGaiaAuthMechanism[] = "X-GOOGLE-TOKEN"; // This class looks for the X-GOOGLE-TOKEN auth mechanism and uses // that instead of the default auth mechanism (PLAIN). -class GaiaOnlySaslHandler : public buzz::SaslHandler { +class GaiaTokenPreXmppAuth : public buzz::PreXmppAuth { public: - GaiaOnlySaslHandler( + GaiaTokenPreXmppAuth( const std::string& username, const std::string& token, const std::string& token_service) @@ -68,6 +68,36 @@ class GaiaOnlySaslHandler : public buzz::SaslHandler { token_(token), token_service_(token_service) {} + virtual ~GaiaTokenPreXmppAuth() {} + + // buzz::PreXmppAuth (-buzz::SaslHandler) implementation. We stub + // all the methods out as we don't actually do any authentication at + // this point. + + virtual void StartPreXmppAuth( + const buzz::Jid& jid, + const talk_base::SocketAddress& server, + const talk_base::CryptString& pass, + const std::string& auth_cookie) { + SignalAuthDone(); + } + + virtual bool IsAuthDone() { return true; } + + virtual bool IsAuthorized() { return true; } + + virtual bool HadError() { return false; } + + virtual int GetError() { return 0; } + + virtual buzz::CaptchaChallenge GetCaptchaChallenge() { + return buzz::CaptchaChallenge(); + } + + virtual std::string GetAuthCookie() { return std::string(); } + + // buzz::SaslHandler implementation. + virtual std::string ChooseBestSaslMechanism( const std::vector<std::string> & mechanisms, bool encrypted) { return (std::find(mechanisms.begin(), @@ -249,8 +279,7 @@ void SingleLoginAttempt::DoLogin( // Start connecting. client_->Connect(client_settings, login_settings_->lang(), CreateSocket(client_settings), - NULL, - CreateSaslHandler(client_settings)); + CreatePreXmppAuth(client_settings)); client_->Start(); } @@ -279,10 +308,10 @@ buzz::AsyncSocket* SingleLoginAttempt::CreateSocket( return adapter; } -buzz::SaslHandler* SingleLoginAttempt::CreateSaslHandler( +buzz::PreXmppAuth* SingleLoginAttempt::CreatePreXmppAuth( const buzz::XmppClientSettings& xcs) { buzz::Jid jid(xcs.user(), xcs.host(), buzz::STR_EMPTY); - return new GaiaOnlySaslHandler( + return new GaiaTokenPreXmppAuth( jid.Str(), xcs.auth_cookie(), xcs.token_service()); } diff --git a/chrome/common/net/notifier/communicator/single_login_attempt.h b/chrome/common/net/notifier/communicator/single_login_attempt.h index 0f4ac91..4d63cf0 100644 --- a/chrome/common/net/notifier/communicator/single_login_attempt.h +++ b/chrome/common/net/notifier/communicator/single_login_attempt.h @@ -15,7 +15,7 @@ namespace buzz { class AsyncSocket; -class SaslHandler; +class PreXmppAuth; class XmppClient; class XmppClientSettings; class XmppClientSettings; @@ -94,7 +94,7 @@ class SingleLoginAttempt : public talk_base::Task, public sigslot::has_slots<> { private: void DoLogin(const ConnectionSettings& connection_settings); buzz::AsyncSocket* CreateSocket(const buzz::XmppClientSettings& xcs); - static buzz::SaslHandler* CreateSaslHandler( + static buzz::PreXmppAuth* CreatePreXmppAuth( const buzz::XmppClientSettings& xcs); // Cleans up any xmpp client state to get ready for a new one. |