diff options
-rw-r--r-- | remoting/host/remoting_me2me_host.cc | 4 | ||||
-rw-r--r-- | remoting/host/service_urls.cc | 12 | ||||
-rw-r--r-- | remoting/host/service_urls.h | 4 | ||||
-rw-r--r-- | remoting/host/setup/start_host.cc | 5 |
4 files changed, 24 insertions, 1 deletions
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index d676b8f..4f358ec 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -33,6 +33,7 @@ #include "ipc/ipc_listener.h" #include "net/base/network_change_notifier.h" #include "net/socket/ssl_server_socket.h" +#include "net/url_request/url_fetcher.h" #include "remoting/base/auto_thread_task_runner.h" #include "remoting/base/breakpad.h" #include "remoting/base/constants.h" @@ -418,6 +419,9 @@ bool HostProcess::InitWithCommandLine(const CommandLine* cmd_line) { #endif // !defined(REMOTING_MULTI_PROCESS) ServiceUrls* service_urls = ServiceUrls::GetInstance(); + if (service_urls->ignore_urlfetcher_cert_requests()) { + net::URLFetcher::SetIgnoreCertificateRequests(true); + } bool xmpp_server_valid = net::ParseHostAndPort( service_urls->xmpp_server_address(), &xmpp_server_config_.host, &xmpp_server_config_.port); diff --git a/remoting/host/service_urls.cc b/remoting/host/service_urls.cc index ea1d448..6a525e2 100644 --- a/remoting/host/service_urls.cc +++ b/remoting/host/service_urls.cc @@ -20,6 +20,8 @@ const char kDirectoryBaseUrlSwitch[] = "directory-base-url"; const char kXmppServerAddressSwitch[] = "xmpp-server-address"; const char kXmppServerDisableTlsSwitch[] = "disable-xmpp-server-tls"; const char kDirectoryBotJidSwitch[] = "directory-bot-jid"; +const char kIgnoreUrlFetcherCertRequestsSwitch[] = + "ignore-urlfetcher-cert-requests"; // Non-configurable service paths. const char kDirectoryHostsSuffix[] = "/@me/hosts/"; @@ -32,7 +34,8 @@ ServiceUrls::ServiceUrls() : directory_base_url_(kDirectoryBaseUrl), xmpp_server_address_(kXmppServerAddress), xmpp_server_use_tls_(kXmppServerUseTls), - directory_bot_jid_(kDirectoryBotJid) { + directory_bot_jid_(kDirectoryBotJid), + ignore_urlfetcher_cert_requests_(false) { #if !defined(NDEBUG) // Allow debug builds to override urls via command line. CommandLine* command_line = CommandLine::ForCurrentProcess(); @@ -49,6 +52,9 @@ ServiceUrls::ServiceUrls() if (command_line->HasSwitch(kXmppServerDisableTlsSwitch)) { xmpp_server_use_tls_ = false; } + if (command_line->HasSwitch(kIgnoreUrlFetcherCertRequestsSwitch)) { + ignore_urlfetcher_cert_requests_ = true; + } if (command_line->HasSwitch(kDirectoryBotJidSwitch)) { directory_bot_jid_ = command_line->GetSwitchValueASCII( kDirectoryBotJidSwitch); @@ -83,4 +89,8 @@ const std::string& ServiceUrls::directory_bot_jid() const { return directory_bot_jid_; } +bool ServiceUrls::ignore_urlfetcher_cert_requests() const { + return ignore_urlfetcher_cert_requests_; +} + } // namespace remoting diff --git a/remoting/host/service_urls.h b/remoting/host/service_urls.h index ed377a5..b2d8846 100644 --- a/remoting/host/service_urls.h +++ b/remoting/host/service_urls.h @@ -31,6 +31,9 @@ class ServiceUrls { // Remoting directory bot JID (for registering hosts, logging, heartbeats). const std::string& directory_bot_jid() const; + // Use a NULL certificate for URLFetcher SSL client certificate requests. + bool ignore_urlfetcher_cert_requests() const; + private: friend struct DefaultSingletonTraits<ServiceUrls>; @@ -42,6 +45,7 @@ class ServiceUrls { std::string xmpp_server_address_; bool xmpp_server_use_tls_; std::string directory_bot_jid_; + bool ignore_urlfetcher_cert_requests_; DISALLOW_COPY_AND_ASSIGN(ServiceUrls); }; diff --git a/remoting/host/setup/start_host.cc b/remoting/host/setup/start_host.cc index 5257517..4d8ba75 100644 --- a/remoting/host/setup/start_host.cc +++ b/remoting/host/setup/start_host.cc @@ -11,6 +11,7 @@ #include "base/stringprintf.h" #include "base/threading/thread.h" #include "google_apis/gaia/gaia_urls.h" +#include "net/url_request/url_fetcher.h" #include "net/url_request/url_request_context_getter.h" #include "remoting/host/service_urls.h" #include "remoting/host/setup/host_starter.h" @@ -153,6 +154,10 @@ int main(int argc, char** argv) { g_message_loop->message_loop_proxy(), io_thread.message_loop_proxy())); + if (remoting::ServiceUrls::GetInstance()->ignore_urlfetcher_cert_requests()) { + net::URLFetcher::SetIgnoreCertificateRequests(true); + } + // Start the host. scoped_ptr<HostStarter> host_starter( HostStarter::Create( |