Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 #include "remoting/host/network_settings.h" | 60 #include "remoting/host/network_settings.h" |
| 61 #include "remoting/host/policy_hack/policy_watcher.h" | 61 #include "remoting/host/policy_hack/policy_watcher.h" |
| 62 #include "remoting/host/service_urls.h" | 62 #include "remoting/host/service_urls.h" |
| 63 #include "remoting/host/session_manager_factory.h" | 63 #include "remoting/host/session_manager_factory.h" |
| 64 #include "remoting/host/signaling_connector.h" | 64 #include "remoting/host/signaling_connector.h" |
| 65 #include "remoting/host/token_validator_factory_impl.h" | 65 #include "remoting/host/token_validator_factory_impl.h" |
| 66 #include "remoting/host/ui_strings.h" | 66 #include "remoting/host/ui_strings.h" |
| 67 #include "remoting/host/usage_stats_consent.h" | 67 #include "remoting/host/usage_stats_consent.h" |
| 68 #include "remoting/jingle_glue/xmpp_signal_strategy.h" | 68 #include "remoting/jingle_glue/xmpp_signal_strategy.h" |
| 69 #include "remoting/protocol/me2me_host_authenticator_factory.h" | 69 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
| 70 #include "remoting/protocol/pairing_registry.h" | |
| 70 | 71 |
| 71 #if defined(OS_POSIX) | 72 #if defined(OS_POSIX) |
| 72 #include <signal.h> | 73 #include <signal.h> |
| 73 #include "base/file_descriptor_posix.h" | 74 #include "base/file_descriptor_posix.h" |
| 74 #include "remoting/host/pam_authorization_factory_posix.h" | 75 #include "remoting/host/pam_authorization_factory_posix.h" |
| 75 #include "remoting/host/posix/signal_handler.h" | 76 #include "remoting/host/posix/signal_handler.h" |
| 76 #endif // defined(OS_POSIX) | 77 #endif // defined(OS_POSIX) |
| 77 | 78 |
| 78 #if defined(OS_MACOSX) | 79 #if defined(OS_MACOSX) |
| 79 #include "base/mac/scoped_cftyperef.h" | 80 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 | 460 |
| 460 std::string local_certificate = key_pair_->GenerateCertificate(); | 461 std::string local_certificate = key_pair_->GenerateCertificate(); |
| 461 if (local_certificate.empty()) { | 462 if (local_certificate.empty()) { |
| 462 LOG(ERROR) << "Failed to generate host certificate."; | 463 LOG(ERROR) << "Failed to generate host certificate."; |
| 463 ShutdownHost(kInitializationFailed); | 464 ShutdownHost(kInitializationFailed); |
| 464 return; | 465 return; |
| 465 } | 466 } |
| 466 scoped_ptr<protocol::AuthenticatorFactory> factory; | 467 scoped_ptr<protocol::AuthenticatorFactory> factory; |
| 467 | 468 |
| 468 if (token_url_.is_empty() && token_validation_url_.is_empty()) { | 469 if (token_url_.is_empty() && token_validation_url_.is_empty()) { |
| 470 // TODO(jamiewalch): Add a proper pairing registry here once all the code | |
| 471 // is committed. | |
| 472 scoped_refptr<remoting::protocol::PairingRegistry> pairing_registry; | |
| 469 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithSharedSecret( | 473 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithSharedSecret( |
| 470 local_certificate, key_pair_, host_secret_hash_); | 474 local_certificate, key_pair_, host_secret_hash_, pairing_registry); |
| 475 | |
|
Sergey Ulanov
2013/05/17 01:57:17
nit: remove this line.
| |
| 471 } else if (token_url_.is_valid() && token_validation_url_.is_valid()) { | 476 } else if (token_url_.is_valid() && token_validation_url_.is_valid()) { |
| 472 scoped_ptr<protocol::ThirdPartyHostAuthenticator::TokenValidatorFactory> | 477 scoped_ptr<protocol::ThirdPartyHostAuthenticator::TokenValidatorFactory> |
| 473 token_validator_factory(new TokenValidatorFactoryImpl( | 478 token_validator_factory(new TokenValidatorFactoryImpl( |
| 474 token_url_, token_validation_url_, key_pair_, | 479 token_url_, token_validation_url_, key_pair_, |
| 475 context_->url_request_context_getter())); | 480 context_->url_request_context_getter())); |
| 476 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithThirdPartyAuth( | 481 factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithThirdPartyAuth( |
| 477 local_certificate, key_pair_, token_validator_factory.Pass()); | 482 local_certificate, key_pair_, token_validator_factory.Pass()); |
| 483 | |
|
Sergey Ulanov
2013/05/17 01:57:17
nit: remove this line.
Jamie
2013/05/21 01:24:33
I think it's more readable with these branches sep
| |
| 478 } else { | 484 } else { |
| 479 // TODO(rmsousa): If the policy is bad the host should not go online. It | 485 // TODO(rmsousa): If the policy is bad the host should not go online. It |
| 480 // should keep running, but not connected, until the policies are fixed. | 486 // should keep running, but not connected, until the policies are fixed. |
| 481 // Having it show up as online and then reject all clients is misleading. | 487 // Having it show up as online and then reject all clients is misleading. |
| 482 LOG(ERROR) << "One of the third-party token URLs is empty or invalid. " | 488 LOG(ERROR) << "One of the third-party token URLs is empty or invalid. " |
| 483 << "Host will reject all clients until policies are corrected. " | 489 << "Host will reject all clients until policies are corrected. " |
| 484 << "TokenUrl: " << token_url_ << ", " | 490 << "TokenUrl: " << token_url_ << ", " |
| 485 << "TokenValidationUrl: " << token_validation_url_; | 491 << "TokenValidationUrl: " << token_validation_url_; |
| 486 factory = protocol::Me2MeHostAuthenticatorFactory::CreateRejecting(); | 492 factory = protocol::Me2MeHostAuthenticatorFactory::CreateRejecting(); |
| 487 } | 493 } |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1081 return exit_code; | 1087 return exit_code; |
| 1082 } | 1088 } |
| 1083 | 1089 |
| 1084 } // namespace remoting | 1090 } // namespace remoting |
| 1085 | 1091 |
| 1086 #if !defined(OS_WIN) | 1092 #if !defined(OS_WIN) |
| 1087 int main(int argc, char** argv) { | 1093 int main(int argc, char** argv) { |
| 1088 return remoting::HostMain(argc, argv); | 1094 return remoting::HostMain(argc, argv); |
| 1089 } | 1095 } |
| 1090 #endif // !defined(OS_WIN) | 1096 #endif // !defined(OS_WIN) |
| OLD | NEW |