diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-15 03:27:19 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-15 03:27:19 +0000 |
commit | 23ca8ddccca74556f3e56404c2bd7c53b9df16dd (patch) | |
tree | 1c63dbc7e08c96342500f9a5603ab7ca51ddbe63 /jingle | |
parent | f698a7f22b36d056bbbfa74aaf910d8ac3b97c23 (diff) | |
download | chromium_src-23ca8ddccca74556f3e56404c2bd7c53b9df16dd.zip chromium_src-23ca8ddccca74556f3e56404c2bd7c53b9df16dd.tar.gz chromium_src-23ca8ddccca74556f3e56404c2bd7c53b9df16dd.tar.bz2 |
[Sync] Added some switches for testing/debugging.
Added back in --sync-invalidate-xmpp-login (now, not only in debug mode!).
Added --sync-allow-insecure-xmpp-connection, which enables sync to
connect to insecure XMPP servers (e.g., a local one).
Removed obsolete --use-ssl-tcp switch.
BUG=None
TEST=Manual
Review URL: http://codereview.chromium.org/3766004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62699 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r-- | jingle/notifier/base/notifier_options.h | 18 | ||||
-rw-r--r-- | jingle/notifier/communicator/connection_settings.cc | 16 | ||||
-rw-r--r-- | jingle/notifier/communicator/connection_settings.h | 4 | ||||
-rw-r--r-- | jingle/notifier/communicator/login.cc | 6 | ||||
-rw-r--r-- | jingle/notifier/communicator/login.h | 3 | ||||
-rw-r--r-- | jingle/notifier/communicator/login_settings.cc | 6 | ||||
-rw-r--r-- | jingle/notifier/communicator/login_settings.h | 9 | ||||
-rw-r--r-- | jingle/notifier/communicator/single_login_attempt.cc | 1 | ||||
-rw-r--r-- | jingle/notifier/communicator/xmpp_connection_generator.cc | 5 | ||||
-rw-r--r-- | jingle/notifier/communicator/xmpp_connection_generator.h | 3 | ||||
-rw-r--r-- | jingle/notifier/listener/mediator_thread_impl.cc | 3 | ||||
-rw-r--r-- | jingle/notifier/listener/talk_mediator_impl.cc | 10 | ||||
-rw-r--r-- | jingle/notifier/listener/talk_mediator_impl.h | 4 | ||||
-rw-r--r-- | jingle/notifier/listener/talk_mediator_unittest.cc | 4 |
14 files changed, 35 insertions, 57 deletions
diff --git a/jingle/notifier/base/notifier_options.h b/jingle/notifier/base/notifier_options.h index 289b7d8..a7a8d25 100644 --- a/jingle/notifier/base/notifier_options.h +++ b/jingle/notifier/base/notifier_options.h @@ -12,19 +12,17 @@ namespace notifier { struct NotifierOptions { NotifierOptions() - : try_ssltcp_first(false), + : allow_insecure_connection(false), + invalidate_xmpp_login(false), notification_method(kDefaultNotificationMethod) {} - NotifierOptions(const bool try_ssltcp_first, - const net::HostPortPair& xmpp_host_port, - NotificationMethod notification_method) - : try_ssltcp_first(try_ssltcp_first), - xmpp_host_port(xmpp_host_port), - notification_method(notification_method) {} + // Indicates that insecure connections (e.g., plain authentication, + // no TLS) are allowed. Only used for testing. + bool allow_insecure_connection; - // Indicates that the SSLTCP port (443) is to be tried before the the XMPP - // port (5222) during login. - bool try_ssltcp_first; + // Indicates that the login info passed to XMPP is invalidated so + // that login fails. + bool invalidate_xmpp_login; // Contains a custom URL and port for the notification server, if one is to // be used. Empty otherwise. diff --git a/jingle/notifier/communicator/connection_settings.cc b/jingle/notifier/communicator/connection_settings.cc index 1648c4e..788a106 100644 --- a/jingle/notifier/communicator/connection_settings.cc +++ b/jingle/notifier/communicator/connection_settings.cc @@ -41,8 +41,7 @@ ConnectionSettingsList::~ConnectionSettingsList() {} void ConnectionSettingsList::AddPermutations(const std::string& hostname, const std::vector<uint32>& iplist, int16 port, - bool special_port_magic, - bool try_ssltcp_first) { + bool special_port_magic) { // randomize the list. This ensures the iplist isn't always // evaluated in the order returned by DNS std::vector<uint32> iplist_random = iplist; @@ -60,8 +59,7 @@ void ConnectionSettingsList::AddPermutations(const std::string& hostname, if (iplist_random.empty()) { // We couldn't pre-resolve the hostname, so let's hope it will resolve // further down the pipeline (by a proxy, for example). - PermuteForAddress(server, special_port_magic, try_ssltcp_first, - &list_temp); + PermuteForAddress(server, special_port_magic, &list_temp); } else { // Generate a set of possibilities for each server address. // Don't do permute duplicates. @@ -72,8 +70,7 @@ void ConnectionSettingsList::AddPermutations(const std::string& hostname, } iplist_seen_.push_back(iplist_random[index]); server.SetResolvedIP(iplist_random[index]); - PermuteForAddress(server, special_port_magic, try_ssltcp_first, - &list_temp); + PermuteForAddress(server, special_port_magic, &list_temp); } } @@ -88,7 +85,6 @@ void ConnectionSettingsList::AddPermutations(const std::string& hostname, void ConnectionSettingsList::PermuteForAddress( const talk_base::SocketAddress& server, bool special_port_magic, - bool try_ssltcp_first, std::deque<ConnectionSettings>* list_temp) { DCHECK(list_temp); *(template_.mutable_server()) = server; @@ -101,11 +97,7 @@ void ConnectionSettingsList::PermuteForAddress( ConnectionSettings settings(template_); settings.set_protocol(cricket::PROTO_SSLTCP); settings.mutable_server()->SetPort(443); - if (try_ssltcp_first) { - list_temp->push_front(settings); - } else { - list_temp->push_back(settings); - } + list_temp->push_back(settings); } } } // namespace notifier diff --git a/jingle/notifier/communicator/connection_settings.h b/jingle/notifier/communicator/connection_settings.h index b26f559..b5a1ee9 100644 --- a/jingle/notifier/communicator/connection_settings.h +++ b/jingle/notifier/communicator/connection_settings.h @@ -48,12 +48,10 @@ class ConnectionSettingsList { void AddPermutations(const std::string& hostname, const std::vector<uint32>& iplist, int16 port, - bool special_port_magic, - bool try_ssltcp_first); + bool special_port_magic); private: void PermuteForAddress(const talk_base::SocketAddress& server, bool special_port_magic, - bool try_ssltcp_first, std::deque<ConnectionSettings>* list_temp); ConnectionSettings template_; diff --git a/jingle/notifier/communicator/login.cc b/jingle/notifier/communicator/login.cc index 251a813..1d94bfd 100644 --- a/jingle/notifier/communicator/login.cc +++ b/jingle/notifier/communicator/login.cc @@ -34,14 +34,12 @@ Login::Login(const buzz::XmppClientSettings& user_settings, const ConnectionOptions& options, net::HostResolver* host_resolver, ServerInformation* server_list, - int server_count, - bool try_ssltcp_first) + int server_count) : login_settings_(new LoginSettings(user_settings, options, host_resolver, server_list, - server_count, - try_ssltcp_first)), + server_count)), redirect_port_(0) { net::NetworkChangeNotifier::AddObserver(this); ResetReconnectState(); diff --git a/jingle/notifier/communicator/login.h b/jingle/notifier/communicator/login.h index b66ee7b..3ae3164a 100644 --- a/jingle/notifier/communicator/login.h +++ b/jingle/notifier/communicator/login.h @@ -49,8 +49,7 @@ class Login : public net::NetworkChangeNotifier::Observer, const ConnectionOptions& options, net::HostResolver* host_resolver, ServerInformation* server_list, - int server_count, - bool try_ssltcp_first); + int server_count); virtual ~Login(); void StartConnection(); diff --git a/jingle/notifier/communicator/login_settings.cc b/jingle/notifier/communicator/login_settings.cc index 01b47f6..01a67fa 100644 --- a/jingle/notifier/communicator/login_settings.cc +++ b/jingle/notifier/communicator/login_settings.cc @@ -19,10 +19,8 @@ LoginSettings::LoginSettings(const buzz::XmppClientSettings& user_settings, const ConnectionOptions& options, net::HostResolver* host_resolver, ServerInformation* server_list, - int server_count, - bool try_ssltcp_first) - : try_ssltcp_first_(try_ssltcp_first), - host_resolver_(host_resolver), + int server_count) + : host_resolver_(host_resolver), server_list_(new ServerInformation[server_count]), server_count_(server_count), user_settings_(new buzz::XmppClientSettings(user_settings)), diff --git a/jingle/notifier/communicator/login_settings.h b/jingle/notifier/communicator/login_settings.h index d97e987..5d1f654 100644 --- a/jingle/notifier/communicator/login_settings.h +++ b/jingle/notifier/communicator/login_settings.h @@ -32,15 +32,10 @@ class LoginSettings { const ConnectionOptions& options, net::HostResolver* host_resolver, ServerInformation* server_list, - int server_count, - bool try_ssltcp_first); + int server_count); ~LoginSettings(); - bool try_ssltcp_first() const { - return try_ssltcp_first_; - } - net::HostResolver* host_resolver() { return host_resolver_; } @@ -69,8 +64,6 @@ class LoginSettings { void clear_server_override(); private: - bool try_ssltcp_first_; - net::HostResolver* host_resolver_; talk_base::scoped_array<ServerInformation> server_list_; int server_count_; diff --git a/jingle/notifier/communicator/single_login_attempt.cc b/jingle/notifier/communicator/single_login_attempt.cc index 83fd21f..487b4e4 100644 --- a/jingle/notifier/communicator/single_login_attempt.cc +++ b/jingle/notifier/communicator/single_login_attempt.cc @@ -32,7 +32,6 @@ SingleLoginAttempt::SingleLoginAttempt(LoginSettings* login_settings) connection_generator_( login_settings_->host_resolver(), &login_settings_->connection_options(), - login_settings_->try_ssltcp_first(), login_settings_->server_list(), login_settings_->server_count()) { connection_generator_.SignalExhaustedSettings.connect( diff --git a/jingle/notifier/communicator/xmpp_connection_generator.cc b/jingle/notifier/communicator/xmpp_connection_generator.cc index 469f3d4..88af171 100644 --- a/jingle/notifier/communicator/xmpp_connection_generator.cc +++ b/jingle/notifier/communicator/xmpp_connection_generator.cc @@ -39,7 +39,6 @@ namespace notifier { XmppConnectionGenerator::XmppConnectionGenerator( net::HostResolver* host_resolver, const ConnectionOptions* options, - bool try_ssltcp_first, const ServerInformation* server_list, int server_count) : host_resolver_(host_resolver), @@ -52,7 +51,6 @@ XmppConnectionGenerator::XmppConnectionGenerator( server_list_(new ServerInformation[server_count]), server_count_(server_count), server_index_(-1), - try_ssltcp_first_(try_ssltcp_first), successfully_resolved_dns_(false), first_dns_error_(0), options_(options) { @@ -162,8 +160,7 @@ void XmppConnectionGenerator::HandleServerDNSResolved(int status) { server_list_[server_index_].server.host(), ip_list, server_list_[server_index_].server.port(), - server_list_[server_index_].special_port_magic, - try_ssltcp_first_); + server_list_[server_index_].special_port_magic); } static const char* const PROTO_NAMES[cricket::PROTO_LAST + 1] = { diff --git a/jingle/notifier/communicator/xmpp_connection_generator.h b/jingle/notifier/communicator/xmpp_connection_generator.h index 0cb969c..7461c4b 100644 --- a/jingle/notifier/communicator/xmpp_connection_generator.h +++ b/jingle/notifier/communicator/xmpp_connection_generator.h @@ -36,13 +36,11 @@ struct ServerInformation { // combinations. class XmppConnectionGenerator : public sigslot::has_slots<> { public: - // try_ssltcp_first indicates that SSLTCP is tried before XMPP. Used by tests. // server_list is the list of connections to attempt in priority order. // server_count is the number of items in the server list. XmppConnectionGenerator( net::HostResolver* host_resolver, const ConnectionOptions* options, - bool try_ssltcp_first, const ServerInformation* server_list, int server_count); ~XmppConnectionGenerator(); @@ -74,7 +72,6 @@ class XmppConnectionGenerator : public sigslot::has_slots<> { talk_base::scoped_array<ServerInformation> server_list_; int server_count_; int server_index_; // The server that is current being used. - bool try_ssltcp_first_; // Used when sync tests are run on chromium builders. bool successfully_resolved_dns_; int first_dns_error_; const ConnectionOptions* options_; diff --git a/jingle/notifier/listener/mediator_thread_impl.cc b/jingle/notifier/listener/mediator_thread_impl.cc index a9f411f..362da19 100644 --- a/jingle/notifier/listener/mediator_thread_impl.cc +++ b/jingle/notifier/listener/mediator_thread_impl.cc @@ -157,8 +157,7 @@ void MediatorThreadImpl::DoLogin( options, host_resolver_.get(), server_list, - server_list_count, - notifier_options_.try_ssltcp_first)); + server_list_count)); login_->SignalConnect.connect( this, &MediatorThreadImpl::OnConnect); diff --git a/jingle/notifier/listener/talk_mediator_impl.cc b/jingle/notifier/listener/talk_mediator_impl.cc index 3f855a0..a1fec8a 100644 --- a/jingle/notifier/listener/talk_mediator_impl.cc +++ b/jingle/notifier/listener/talk_mediator_impl.cc @@ -13,10 +13,12 @@ namespace notifier { TalkMediatorImpl::TalkMediatorImpl( - MediatorThread* mediator_thread, bool invalidate_xmpp_auth_token) + MediatorThread* mediator_thread, bool invalidate_xmpp_auth_token, + bool allow_insecure_connection) : delegate_(NULL), mediator_thread_(mediator_thread), - invalidate_xmpp_auth_token_(invalidate_xmpp_auth_token) { + invalidate_xmpp_auth_token_(invalidate_xmpp_auth_token), + allow_insecure_connection_(allow_insecure_connection) { DCHECK(non_thread_safe_.CalledOnValidThread()); mediator_thread_->Start(); state_.started = 1; @@ -90,6 +92,10 @@ bool TalkMediatorImpl::SetAuthToken(const std::string& email, xmpp_settings_.set_auth_cookie(invalidate_xmpp_auth_token_ ? token + "bogus" : token); xmpp_settings_.set_token_service(token_service); + if (allow_insecure_connection_) { + xmpp_settings_.set_allow_plain(true); + xmpp_settings_.set_use_tls(false); + } state_.initialized = 1; return true; diff --git a/jingle/notifier/listener/talk_mediator_impl.h b/jingle/notifier/listener/talk_mediator_impl.h index c439686..1da4d25 100644 --- a/jingle/notifier/listener/talk_mediator_impl.h +++ b/jingle/notifier/listener/talk_mediator_impl.h @@ -27,7 +27,8 @@ class TalkMediatorImpl public: // Takes ownership of |mediator_thread|. TalkMediatorImpl( - MediatorThread* mediator_thread, bool invalidate_xmpp_auth_token); + MediatorThread* mediator_thread, bool invalidate_xmpp_auth_token, + bool allow_insecure_connection); virtual ~TalkMediatorImpl(); // TalkMediator implementation. @@ -85,6 +86,7 @@ class TalkMediatorImpl scoped_ptr<MediatorThread> mediator_thread_; const bool invalidate_xmpp_auth_token_; + const bool allow_insecure_connection_; std::vector<std::string> subscribed_services_list_; diff --git a/jingle/notifier/listener/talk_mediator_unittest.cc b/jingle/notifier/listener/talk_mediator_unittest.cc index e00539d..0d0f9e3 100644 --- a/jingle/notifier/listener/talk_mediator_unittest.cc +++ b/jingle/notifier/listener/talk_mediator_unittest.cc @@ -41,8 +41,10 @@ class TalkMediatorImplTest : public testing::Test { TalkMediatorImpl* NewMockedTalkMediator( MockMediatorThread* mock_mediator_thread) { const bool kInvalidateXmppAuthToken = false; + const bool kAllowInsecureConnection = false; return new TalkMediatorImpl(mock_mediator_thread, - kInvalidateXmppAuthToken); + kInvalidateXmppAuthToken, + kAllowInsecureConnection); } int last_message_; |