diff options
21 files changed, 67 insertions, 83 deletions
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc index 67bccec..0c8b706 100644 --- a/chrome/browser/sync/engine/syncapi.cc +++ b/chrome/browser/sync/engine/syncapi.cc @@ -1497,11 +1497,16 @@ void SyncManager::SyncInternal::InitializeTalkMediator() { new sync_notifier::ServerNotifierThread( notifier_options_, state, this); talk_mediator_.reset( - new TalkMediatorImpl(server_notifier_thread, false)); + new TalkMediatorImpl(server_notifier_thread, + notifier_options_.invalidate_xmpp_login, + notifier_options_.allow_insecure_connection)); } else { notifier::MediatorThread* mediator_thread = new notifier::MediatorThreadImpl(notifier_options_); - talk_mediator_.reset(new TalkMediatorImpl(mediator_thread, false)); + talk_mediator_.reset( + new TalkMediatorImpl(mediator_thread, + notifier_options_.invalidate_xmpp_login, + notifier_options_.allow_insecure_connection)); if (notifier_options_.notification_method != notifier::NOTIFICATION_LEGACY) { if (notifier_options_.notification_method == diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index ddaff62..768f950 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -274,14 +274,19 @@ void ProfileSyncService::InitSettings() { notifier_options_.xmpp_host_port.set_host(value); notifier_options_.xmpp_host_port.set_port(notifier::kDefaultXmppPort); } - LOG(INFO) << "Using " << notifier_options_.xmpp_host_port.ToString() + VLOG(1) << "Using " << notifier_options_.xmpp_host_port.ToString() << " for test sync notification server."; } - notifier_options_.try_ssltcp_first = - command_line.HasSwitch(switches::kSyncUseSslTcp); - if (notifier_options_.try_ssltcp_first) { - LOG(INFO) << "Trying SSL/TCP port before XMPP port for notifications."; + notifier_options_.invalidate_xmpp_login = + command_line.HasSwitch(switches::kSyncInvalidateXmppLogin); + if (notifier_options_.invalidate_xmpp_login) { + VLOG(1) << "Invalidating sync XMPP login."; + } + notifier_options_.allow_insecure_connection = + command_line.HasSwitch(switches::kSyncAllowInsecureXmppConnection); + if (notifier_options_.allow_insecure_connection) { + VLOG(1) << "Allowing insecure XMPP connections."; } if (command_line.HasSwitch(switches::kSyncNotificationMethod)) { @@ -388,7 +393,7 @@ void ProfileSyncService::CreateBackend() { void ProfileSyncService::StartUp() { // Don't start up multiple times. if (backend_.get()) { - LOG(INFO) << "Skipping bringing up backend host."; + VLOG(1) << "Skipping bringing up backend host."; return; } diff --git a/chrome/browser/sync/tools/sync_listen_notifications.cc b/chrome/browser/sync/tools/sync_listen_notifications.cc index c619e14..8fc498b 100644 --- a/chrome/browser/sync/tools/sync_listen_notifications.cc +++ b/chrome/browser/sync/tools/sync_listen_notifications.cc @@ -240,9 +240,9 @@ int main(int argc, char* argv[]) { } bool allow_plain = command_line.HasSwitch(switches::kSyncAllowPlain); bool disable_tls = command_line.HasSwitch(switches::kSyncDisableTls); - bool use_ssl_tcp = command_line.HasSwitch(switches::kSyncUseSslTcp); + bool use_ssl_tcp = command_line.HasSwitch("use-ssl-tcp"); if (use_ssl_tcp && (port != 443)) { - LOG(WARNING) << switches::kSyncUseSslTcp << " is set but port is " << port + LOG(WARNING) << "--use-ssl-tcp is set but port is " << port << " instead of 443"; } std::string cache_invalidation_state; diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index eabe4e8..65e7d9a 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -1005,6 +1005,10 @@ const char kSingleProcess[] = "single-process"; // Start the browser maximized, regardless of any previous settings. const char kStartMaximized[] = "start-maximized"; +// Allow insecure XMPP connections for sync (for testing). +const char kSyncAllowInsecureXmppConnection[] = + "sync-allow-insecure-xmpp-connection"; + // Control Sync XMPP client settings. const char kSyncAllowPlain[] = "allow-plain"; @@ -1014,6 +1018,9 @@ const char kSyncDisableTls[] = "disable-tls"; // Email used for sync. const char kSyncEmail[] = "email"; +// Invalidate any login info passed into sync's XMPP connection. +const char kSyncInvalidateXmppLogin[] = "sync-invalidate-xmpp-login"; + // Use the SyncerThread implementation that matches up with the old pthread // impl semantics, but using Chrome synchronization primitives. The only // difference between this and the default is that we now have no timeout on @@ -1039,9 +1046,6 @@ const char kSyncServer[] = "server"; const char kSyncServiceURL[] = "sync-url"; // Control Sync XMPP client settings. -const char kSyncUseSslTcp[] = "use-ssl-tcp"; - -// Control Sync XMPP client settings. const char kSyncUseCacheInvalidation[] = "use-cache-invalidation"; // Pass the name of the current running automated test to Chrome. diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 1f55280..9654e79 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -281,9 +281,11 @@ extern const char kSilentDumpOnDCHECK[]; extern const char kSimpleDataSource[]; extern const char kSingleProcess[]; extern const char kStartMaximized[]; +extern const char kSyncAllowInsecureXmppConnection[]; extern const char kSyncAllowPlain[]; extern const char kSyncDisableTls[]; extern const char kSyncEmail[]; +extern const char kSyncInvalidateXmppLogin[]; extern const char kSyncerThreadTimedStop[]; extern const char kSyncNotificationMethod[]; extern const char kSyncNotificationHost[]; @@ -291,7 +293,6 @@ extern const char kSyncPassword[]; extern const char kSyncPort[]; extern const char kSyncServer[]; extern const char kSyncServiceURL[]; -extern const char kSyncUseSslTcp[]; extern const char kSyncUseCacheInvalidation[]; extern const char kTestNaClSandbox[]; extern const char kTestName[]; diff --git a/chrome/service/cloud_print/cloud_print_proxy_backend.cc b/chrome/service/cloud_print/cloud_print_proxy_backend.cc index 2d0a46f..33c1a55 100644 --- a/chrome/service/cloud_print/cloud_print_proxy_backend.cc +++ b/chrome/service/cloud_print/cloud_print_proxy_backend.cc @@ -321,10 +321,12 @@ void CloudPrintProxyBackend::Core::DoInitializeWithToken( const notifier::NotifierOptions kNotifierOptions; const bool kInvalidateXmppAuthToken = false; + const bool kAllowInsecureXmppConnection = false; talk_mediator_.reset(new notifier::TalkMediatorImpl( new notifier::PushNotificationsThread(kNotifierOptions, kCloudPrintPushNotificationsSource), - kInvalidateXmppAuthToken)); + kInvalidateXmppAuthToken, + kAllowInsecureXmppConnection)); push_notifications_channel_ = kCloudPrintPushNotificationsSource; push_notifications_channel_.append("/proxy/"); push_notifications_channel_.append(proxy_id); diff --git a/chrome/test/live_sync/live_sync_test.cc b/chrome/test/live_sync/live_sync_test.cc index 6fd16cb..44b0d7b 100644 --- a/chrome/test/live_sync/live_sync_test.cc +++ b/chrome/test/live_sync/live_sync_test.cc @@ -107,17 +107,6 @@ void LiveSyncTest::SetUp() { if (!cl->HasSwitch(switches::kSyncNotificationMethod)) cl->AppendSwitchASCII(switches::kSyncNotificationMethod, "transitional"); - // TODO(akalin): Delete this block of code once a local python notification - // server is implemented. - // The chrome sync builders are behind a firewall that blocks port 5222, the - // default port for XMPP notifications. This causes the tests to spend up to a - // minute waiting for a connection on port 5222 before they fail over to port - // 443, the default SSL/TCP port. This switch causes the tests to use port 443 - // by default, without having to try port 5222. - if (!cl->HasSwitch(switches::kSyncUseSslTcp)) { - cl->AppendSwitch(switches::kSyncUseSslTcp); - } - // TODO(sync): Remove this once passwords sync is enabled by default. if (!cl->HasSwitch(switches::kEnableSyncPasswords)) { cl->AppendSwitch(switches::kEnableSyncPasswords); 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_; |