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 /third_party/libjingle | |
| 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 'third_party/libjingle')
5 files changed, 21 insertions, 40 deletions
diff --git a/third_party/libjingle/files/talk/xmpp/plainsaslhandler.h b/third_party/libjingle/files/talk/xmpp/plainsaslhandler.h index 39e4fb0..8cf1ed8 100644 --- a/third_party/libjingle/files/talk/xmpp/plainsaslhandler.h +++ b/third_party/libjingle/files/talk/xmpp/plainsaslhandler.h @@ -68,12 +68,6 @@ public: } return NULL; } - - virtual bool GetTlsServerInfo(const talk_base::SocketAddress& server, - std::string* tls_server_hostname, - std::string* tls_server_domain) { - return false; - } private: Jid jid_; diff --git a/third_party/libjingle/files/talk/xmpp/prexmppauth.h b/third_party/libjingle/files/talk/xmpp/prexmppauth.h index d8fdbc6..f94bd3d 100644 --- a/third_party/libjingle/files/talk/xmpp/prexmppauth.h +++ b/third_party/libjingle/files/talk/xmpp/prexmppauth.h @@ -30,6 +30,7 @@ #include "talk/base/cryptstring.h" #include "talk/base/sigslot.h" +#include "talk/xmpp/saslhandler.h" namespace talk_base { class SocketAddress; @@ -60,7 +61,7 @@ class CaptchaChallenge { std::string captcha_image_url_; }; -class PreXmppAuth { +class PreXmppAuth : public SaslHandler { public: virtual ~PreXmppAuth() {} diff --git a/third_party/libjingle/files/talk/xmpp/saslhandler.h b/third_party/libjingle/files/talk/xmpp/saslhandler.h index 739f6cc..acccd76 100644 --- a/third_party/libjingle/files/talk/xmpp/saslhandler.h +++ b/third_party/libjingle/files/talk/xmpp/saslhandler.h @@ -31,11 +31,8 @@ #include <string> #include <vector> -#include "talk/base/socketaddress.h" - namespace buzz { -class XmlElement; class SaslMechanism; // Creates mechanisms to deal with a given mechanism @@ -54,13 +51,6 @@ public: // once you get it). // If not handled, return NULL. virtual SaslMechanism * CreateSaslMechanism(const std::string & mechanism) = 0; - - // Fills in the tls server hostname/domain to use for the given - // server (and returns true). Return false if you want the defaults - // to be used. - virtual bool GetTlsServerInfo(const talk_base::SocketAddress& server, - std::string* tls_server_hostname, - std::string* tls_server_domain) = 0; }; } diff --git a/third_party/libjingle/files/talk/xmpp/xmppclient.cc b/third_party/libjingle/files/talk/xmpp/xmppclient.cc index 985f51e..5f63b67 100644 --- a/third_party/libjingle/files/talk/xmpp/xmppclient.cc +++ b/third_party/libjingle/files/talk/xmpp/xmppclient.cc @@ -30,7 +30,6 @@ #include "talk/xmpp/xmppconstants.h" #include "talk/base/sigslot.h" #include "talk/xmpp/saslplainmechanism.h" -#include "talk/xmpp/saslhandler.h" #include "talk/xmpp/prexmppauth.h" #include "talk/base/scoped_ptr.h" #include "talk/xmpp/plainsaslhandler.h" @@ -67,7 +66,6 @@ public: scoped_ptr<AsyncSocket> socket_; scoped_ptr<XmppEngine> engine_; scoped_ptr<PreXmppAuth> pre_auth_; - scoped_ptr<SaslHandler> sasl_handler_; talk_base::CryptString pass_; std::string auth_cookie_; talk_base::SocketAddress server_; @@ -95,8 +93,7 @@ XmppReturnStatus XmppClient::Connect(const XmppClientSettings & settings, const std::string & lang, AsyncSocket * socket, - PreXmppAuth * pre_auth, - SaslHandler * sasl_handler) { + PreXmppAuth * pre_auth) { if (socket == NULL) return XMPP_RETURN_BADARGUMENT; if (d_->socket_.get() != NULL) @@ -116,13 +113,19 @@ XmppClient::Connect(const XmppClientSettings & settings, } d_->engine_->SetUseTls(settings.use_tls()); - if (sasl_handler) { - std::string tls_server_hostname, tls_server_domain; - if (sasl_handler->GetTlsServerInfo(settings.server(), - &tls_server_hostname, - &tls_server_domain)) { - d_->engine_->SetTlsServer(tls_server_hostname, tls_server_domain); - } + // + // The talk.google.com server expects you to use "gmail.com" in the + // stream, and expects the domain certificate to be "gmail.com" as well. + // For all other servers, we leave the strings empty, which causes + // the jid's domain to be used. "foo@example.com" -> stream to="example.com" + // tls certificate for "example.com" + // + // This is only true when using Gaia auth, so let's say if there's + // no sasl_handler, we should use the actual server name + if ((settings.server().IPAsString() == buzz::STR_TALK_GOOGLE_COM || + settings.server().IPAsString() == buzz::STR_TALKX_L_GOOGLE_COM) && + pre_auth != NULL) { + d_->engine_->SetTlsServer(buzz::STR_GMAIL_COM, buzz::STR_GMAIL_COM); } // Set language @@ -137,7 +140,6 @@ XmppClient::Connect(const XmppClientSettings & settings, d_->proxy_port_ = settings.proxy_port(); d_->allow_plain_ = settings.allow_plain(); d_->pre_auth_.reset(pre_auth); - d_->sasl_handler_.reset(sasl_handler); return XMPP_RETURN_OK; } @@ -199,14 +201,6 @@ ForgetPassword(std::string & to_erase) { int XmppClient::ProcessStart() { - if (d_->sasl_handler_.get()) { - d_->engine_->SetSaslHandler(d_->sasl_handler_.release()); - } - else { - d_->engine_->SetSaslHandler(new PlainSaslHandler( - d_->engine_->GetUser(), d_->pass_, d_->allow_plain_)); - } - if (d_->pre_auth_.get()) { d_->pre_auth_->SignalAuthDone.connect(this, &XmppClient::OnAuthDone); d_->pre_auth_->StartPreXmppAuth( @@ -215,6 +209,8 @@ XmppClient::ProcessStart() { return STATE_PRE_XMPP_LOGIN; } else { + d_->engine_->SetSaslHandler(new PlainSaslHandler( + d_->engine_->GetUser(), d_->pass_, d_->allow_plain_)); d_->pass_.Clear(); // done with this; return STATE_START_XMPP_LOGIN; } @@ -257,6 +253,8 @@ XmppClient::ProcessCookieLogin() { // Save auth cookie as a result d_->auth_cookie_ = d_->pre_auth_->GetAuthCookie(); + // transfer ownership of pre_auth_ to engine + d_->engine_->SetSaslHandler(d_->pre_auth_.release()); return STATE_START_XMPP_LOGIN; } diff --git a/third_party/libjingle/files/talk/xmpp/xmppclient.h b/third_party/libjingle/files/talk/xmpp/xmppclient.h index 013d468c..1ca6fec 100644 --- a/third_party/libjingle/files/talk/xmpp/xmppclient.h +++ b/third_party/libjingle/files/talk/xmpp/xmppclient.h @@ -40,7 +40,6 @@ namespace buzz { class XmppTask; class PreXmppAuth; -class SaslHandler; class CaptchaChallenge; // Just some non-colliding number. Could have picked "1". @@ -78,8 +77,7 @@ public: XmppReturnStatus Connect(const XmppClientSettings & settings, const std::string & lang, AsyncSocket * socket, - PreXmppAuth * preauth, - SaslHandler * sasl_handler); + PreXmppAuth * preauth); virtual talk_base::Task* GetParent(int code); virtual int ProcessStart(); |
