Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: remoting/host/remoting_me2me_host.cc

Issue 86523005: Replace all usage of LOG(INFO) in Chromoting host with HOST_LOG to bypass the presubmit check. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/plugin/host_script_object.cc ('k') | remoting/host/signaling_connector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/debug/alias.h" 13 #include "base/debug/alias.h"
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/logging.h"
17 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
18 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
19 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
20 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_util.h" 20 #include "base/strings/string_util.h"
22 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
23 #include "base/synchronization/waitable_event.h" 22 #include "base/synchronization/waitable_event.h"
24 #include "base/threading/thread.h" 23 #include "base/threading/thread.h"
25 #include "build/build_config.h" 24 #include "build/build_config.h"
26 #include "crypto/nss_util.h" 25 #include "crypto/nss_util.h"
27 #include "ipc/ipc_channel.h" 26 #include "ipc/ipc_channel.h"
28 #include "ipc/ipc_channel_proxy.h" 27 #include "ipc/ipc_channel_proxy.h"
29 #include "ipc/ipc_listener.h" 28 #include "ipc/ipc_listener.h"
30 #include "media/base/media.h" 29 #include "media/base/media.h"
31 #include "net/base/network_change_notifier.h" 30 #include "net/base/network_change_notifier.h"
32 #include "net/socket/client_socket_factory.h" 31 #include "net/socket/client_socket_factory.h"
33 #include "net/socket/ssl_server_socket.h" 32 #include "net/socket/ssl_server_socket.h"
34 #include "net/url_request/url_fetcher.h" 33 #include "net/url_request/url_fetcher.h"
35 #include "remoting/base/auto_thread_task_runner.h" 34 #include "remoting/base/auto_thread_task_runner.h"
36 #include "remoting/base/breakpad.h" 35 #include "remoting/base/breakpad.h"
37 #include "remoting/base/constants.h" 36 #include "remoting/base/constants.h"
37 #include "remoting/base/logging.h"
38 #include "remoting/base/rsa_key_pair.h" 38 #include "remoting/base/rsa_key_pair.h"
39 #include "remoting/base/util.h" 39 #include "remoting/base/util.h"
40 #include "remoting/host/branding.h" 40 #include "remoting/host/branding.h"
41 #include "remoting/host/chromoting_host.h" 41 #include "remoting/host/chromoting_host.h"
42 #include "remoting/host/chromoting_host_context.h" 42 #include "remoting/host/chromoting_host_context.h"
43 #include "remoting/host/chromoting_messages.h" 43 #include "remoting/host/chromoting_messages.h"
44 #include "remoting/host/config_file_watcher.h" 44 #include "remoting/host/config_file_watcher.h"
45 #include "remoting/host/desktop_environment.h" 45 #include "remoting/host/desktop_environment.h"
46 #include "remoting/host/desktop_session_connector.h" 46 #include "remoting/host/desktop_session_connector.h"
47 #include "remoting/host/dns_blackhole_checker.h" 47 #include "remoting/host/dns_blackhole_checker.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 if (!context_->network_task_runner()->BelongsToCurrentThread()) { 416 if (!context_->network_task_runner()->BelongsToCurrentThread()) {
417 context_->network_task_runner()->PostTask(FROM_HERE, 417 context_->network_task_runner()->PostTask(FROM_HERE,
418 base::Bind(&HostProcess::OnConfigUpdated, this, serialized_config)); 418 base::Bind(&HostProcess::OnConfigUpdated, this, serialized_config));
419 return; 419 return;
420 } 420 }
421 421
422 // Filter out duplicates. 422 // Filter out duplicates.
423 if (serialized_config_ == serialized_config) 423 if (serialized_config_ == serialized_config)
424 return; 424 return;
425 425
426 LOG(INFO) << "Processing new host configuration."; 426 HOST_LOG << "Processing new host configuration.";
427 427
428 serialized_config_ = serialized_config; 428 serialized_config_ = serialized_config;
429 scoped_ptr<JsonHostConfig> config(new JsonHostConfig(base::FilePath())); 429 scoped_ptr<JsonHostConfig> config(new JsonHostConfig(base::FilePath()));
430 if (!config->SetSerializedData(serialized_config)) { 430 if (!config->SetSerializedData(serialized_config)) {
431 LOG(ERROR) << "Invalid configuration."; 431 LOG(ERROR) << "Invalid configuration.";
432 ShutdownHost(kInvalidHostConfigurationExitCode); 432 ShutdownHost(kInvalidHostConfigurationExitCode);
433 return; 433 return;
434 } 434 }
435 435
436 if (!ApplyConfig(config.Pass())) { 436 if (!ApplyConfig(config.Pass())) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 remoting::RegisterSignalHandler( 481 remoting::RegisterSignalHandler(
482 SIGTERM, 482 SIGTERM,
483 base::Bind(&HostProcess::SigTermHandler, base::Unretained(this))); 483 base::Bind(&HostProcess::SigTermHandler, base::Unretained(this)));
484 #endif // defined(OS_POSIX) 484 #endif // defined(OS_POSIX)
485 } 485 }
486 486
487 #if defined(OS_POSIX) 487 #if defined(OS_POSIX)
488 void HostProcess::SigTermHandler(int signal_number) { 488 void HostProcess::SigTermHandler(int signal_number) {
489 DCHECK(signal_number == SIGTERM); 489 DCHECK(signal_number == SIGTERM);
490 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 490 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
491 LOG(INFO) << "Caught SIGTERM: Shutting down..."; 491 HOST_LOG << "Caught SIGTERM: Shutting down...";
492 ShutdownHost(kSuccessExitCode); 492 ShutdownHost(kSuccessExitCode);
493 } 493 }
494 #endif // OS_POSIX 494 #endif // OS_POSIX
495 495
496 void HostProcess::CreateAuthenticatorFactory() { 496 void HostProcess::CreateAuthenticatorFactory() {
497 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 497 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
498 498
499 if (state_ != HOST_STARTED) 499 if (state_ != HOST_STARTED)
500 return; 500 return;
501 501
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 #endif 652 #endif
653 } 653 }
654 654
655 // Overridden from HeartbeatSender::Listener 655 // Overridden from HeartbeatSender::Listener
656 void HostProcess::OnUnknownHostIdError() { 656 void HostProcess::OnUnknownHostIdError() {
657 LOG(ERROR) << "Host ID not found."; 657 LOG(ERROR) << "Host ID not found.";
658 ShutdownHost(kInvalidHostIdExitCode); 658 ShutdownHost(kInvalidHostIdExitCode);
659 } 659 }
660 660
661 void HostProcess::OnHeartbeatSuccessful() { 661 void HostProcess::OnHeartbeatSuccessful() {
662 LOG(INFO) << "Host ready to receive connections."; 662 HOST_LOG << "Host ready to receive connections.";
663 #if defined(OS_POSIX) 663 #if defined(OS_POSIX)
664 if (signal_parent_) { 664 if (signal_parent_) {
665 kill(getppid(), SIGUSR1); 665 kill(getppid(), SIGUSR1);
666 signal_parent_ = false; 666 signal_parent_ = false;
667 } 667 }
668 #endif 668 #endif
669 } 669 }
670 670
671 void HostProcess::OnHostDeleted() { 671 void HostProcess::OnHostDeleted() {
672 LOG(ERROR) << "Host was deleted from the directory."; 672 LOG(ERROR) << "Host was deleted from the directory.";
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 StartHost(); 797 StartHost();
798 } else if (state_ == HOST_STARTED && restart_required) { 798 } else if (state_ == HOST_STARTED && restart_required) {
799 RestartHost(); 799 RestartHost();
800 } 800 }
801 } 801 }
802 802
803 bool HostProcess::OnHostDomainPolicyUpdate(const std::string& host_domain) { 803 bool HostProcess::OnHostDomainPolicyUpdate(const std::string& host_domain) {
804 // Returns true if the host has to be restarted after this policy update. 804 // Returns true if the host has to be restarted after this policy update.
805 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 805 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
806 806
807 LOG(INFO) << "Policy sets host domain: " << host_domain; 807 HOST_LOG << "Policy sets host domain: " << host_domain;
808 808
809 if (!host_domain.empty() && 809 if (!host_domain.empty() &&
810 !EndsWith(host_owner_, std::string("@") + host_domain, false)) { 810 !EndsWith(host_owner_, std::string("@") + host_domain, false)) {
811 ShutdownHost(kInvalidHostDomainExitCode); 811 ShutdownHost(kInvalidHostDomainExitCode);
812 } 812 }
813 return false; 813 return false;
814 } 814 }
815 815
816 bool HostProcess::OnUsernamePolicyUpdate(bool curtain_required, 816 bool HostProcess::OnUsernamePolicyUpdate(bool curtain_required,
817 bool host_username_match_required) { 817 bool host_username_match_required) {
818 // Returns false: never restart the host after this policy update. 818 // Returns false: never restart the host after this policy update.
819 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 819 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
820 820
821 if (host_username_match_required) { 821 if (host_username_match_required) {
822 LOG(INFO) << "Policy requires host username match."; 822 HOST_LOG << "Policy requires host username match.";
823 std::string username = GetUsername(); 823 std::string username = GetUsername();
824 bool shutdown = username.empty() || 824 bool shutdown = username.empty() ||
825 !StartsWithASCII(host_owner_, username + std::string("@"), 825 !StartsWithASCII(host_owner_, username + std::string("@"),
826 false); 826 false);
827 827
828 #if defined(OS_MACOSX) 828 #if defined(OS_MACOSX)
829 // On Mac, we run as root at the login screen, so the username won't match. 829 // On Mac, we run as root at the login screen, so the username won't match.
830 // However, there's no need to enforce the policy at the login screen, as 830 // However, there's no need to enforce the policy at the login screen, as
831 // the client will have to reconnect if a login occurs. 831 // the client will have to reconnect if a login occurs.
832 if (shutdown && getuid() == 0) { 832 if (shutdown && getuid() == 0) {
833 shutdown = false; 833 shutdown = false;
834 } 834 }
835 #endif 835 #endif
836 836
837 // Curtain-mode on Windows presents the standard OS login prompt to the user 837 // Curtain-mode on Windows presents the standard OS login prompt to the user
838 // for each connection, removing the need for an explicit user-name matching 838 // for each connection, removing the need for an explicit user-name matching
839 // check. 839 // check.
840 #if defined(OS_WIN) && defined(REMOTING_RDP_SESSION) 840 #if defined(OS_WIN) && defined(REMOTING_RDP_SESSION)
841 if (curtain_required) 841 if (curtain_required)
842 return false; 842 return false;
843 #endif // defined(OS_WIN) && defined(REMOTING_RDP_SESSION) 843 #endif // defined(OS_WIN) && defined(REMOTING_RDP_SESSION)
844 844
845 // Shutdown the host if the username does not match. 845 // Shutdown the host if the username does not match.
846 if (shutdown) { 846 if (shutdown) {
847 LOG(ERROR) << "The host username does not match."; 847 LOG(ERROR) << "The host username does not match.";
848 ShutdownHost(kUsernameMismatchExitCode); 848 ShutdownHost(kUsernameMismatchExitCode);
849 } 849 }
850 } else { 850 } else {
851 LOG(INFO) << "Policy does not require host username match."; 851 HOST_LOG << "Policy does not require host username match.";
852 } 852 }
853 853
854 return false; 854 return false;
855 } 855 }
856 856
857 bool HostProcess::OnNatPolicyUpdate(bool nat_traversal_enabled) { 857 bool HostProcess::OnNatPolicyUpdate(bool nat_traversal_enabled) {
858 // Returns true if the host has to be restarted after this policy update. 858 // Returns true if the host has to be restarted after this policy update.
859 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 859 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
860 860
861 if (allow_nat_traversal_ != nat_traversal_enabled) { 861 if (allow_nat_traversal_ != nat_traversal_enabled) {
862 if (nat_traversal_enabled) 862 if (nat_traversal_enabled)
863 LOG(INFO) << "Policy enables NAT traversal."; 863 HOST_LOG << "Policy enables NAT traversal.";
864 else 864 else
865 LOG(INFO) << "Policy disables NAT traversal."; 865 HOST_LOG << "Policy disables NAT traversal.";
866 allow_nat_traversal_ = nat_traversal_enabled; 866 allow_nat_traversal_ = nat_traversal_enabled;
867 return true; 867 return true;
868 } 868 }
869 return false; 869 return false;
870 } 870 }
871 871
872 void HostProcess::OnCurtainPolicyUpdate(bool curtain_required) { 872 void HostProcess::OnCurtainPolicyUpdate(bool curtain_required) {
873 // Returns true if the host has to be restarted after this policy update. 873 // Returns true if the host has to be restarted after this policy update.
874 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 874 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
875 875
(...skipping 12 matching lines...) Expand all
888 LOG(ERROR) << "Running the host in the console login session is yet not " 888 LOG(ERROR) << "Running the host in the console login session is yet not "
889 "supported."; 889 "supported.";
890 ShutdownHost(kLoginScreenNotSupportedExitCode); 890 ShutdownHost(kLoginScreenNotSupportedExitCode);
891 return; 891 return;
892 } 892 }
893 } 893 }
894 #endif 894 #endif
895 895
896 if (curtain_required_ != curtain_required) { 896 if (curtain_required_ != curtain_required) {
897 if (curtain_required) 897 if (curtain_required)
898 LOG(INFO) << "Policy requires curtain-mode."; 898 HOST_LOG << "Policy requires curtain-mode.";
899 else 899 else
900 LOG(INFO) << "Policy does not require curtain-mode."; 900 HOST_LOG << "Policy does not require curtain-mode.";
901 curtain_required_ = curtain_required; 901 curtain_required_ = curtain_required;
902 if (host_) 902 if (host_)
903 host_->SetEnableCurtaining(curtain_required_); 903 host_->SetEnableCurtaining(curtain_required_);
904 } 904 }
905 } 905 }
906 906
907 bool HostProcess::OnHostTalkGadgetPrefixPolicyUpdate( 907 bool HostProcess::OnHostTalkGadgetPrefixPolicyUpdate(
908 const std::string& talkgadget_prefix) { 908 const std::string& talkgadget_prefix) {
909 // Returns true if the host has to be restarted after this policy update. 909 // Returns true if the host has to be restarted after this policy update.
910 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 910 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
911 911
912 if (talkgadget_prefix != talkgadget_prefix_) { 912 if (talkgadget_prefix != talkgadget_prefix_) {
913 LOG(INFO) << "Policy sets talkgadget prefix: " << talkgadget_prefix; 913 HOST_LOG << "Policy sets talkgadget prefix: " << talkgadget_prefix;
914 talkgadget_prefix_ = talkgadget_prefix; 914 talkgadget_prefix_ = talkgadget_prefix;
915 return true; 915 return true;
916 } 916 }
917 return false; 917 return false;
918 } 918 }
919 919
920 bool HostProcess::OnHostTokenUrlPolicyUpdate( 920 bool HostProcess::OnHostTokenUrlPolicyUpdate(
921 const GURL& token_url, 921 const GURL& token_url,
922 const GURL& token_validation_url) { 922 const GURL& token_validation_url) {
923 // Returns true if the host has to be restarted after this policy update. 923 // Returns true if the host has to be restarted after this policy update.
924 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 924 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
925 925
926 if (token_url_ != token_url || 926 if (token_url_ != token_url ||
927 token_validation_url_ != token_validation_url) { 927 token_validation_url_ != token_validation_url) {
928 LOG(INFO) << "Policy sets third-party token URLs: " 928 HOST_LOG << "Policy sets third-party token URLs: "
929 << "TokenUrl: " << token_url << ", " 929 << "TokenUrl: " << token_url << ", "
930 << "TokenValidationUrl: " << token_validation_url; 930 << "TokenValidationUrl: " << token_validation_url;
931 931
932 token_url_ = token_url; 932 token_url_ = token_url;
933 token_validation_url_ = token_validation_url; 933 token_validation_url_ = token_validation_url;
934 return true; 934 return true;
935 } 935 }
936 936
937 return false; 937 return false;
938 } 938 }
939 939
940 bool HostProcess::OnPairingPolicyUpdate(bool allow_pairing) { 940 bool HostProcess::OnPairingPolicyUpdate(bool allow_pairing) {
941 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 941 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
942 942
943 if (allow_pairing_ == allow_pairing) 943 if (allow_pairing_ == allow_pairing)
944 return false; 944 return false;
945 945
946 if (allow_pairing) 946 if (allow_pairing)
947 LOG(INFO) << "Policy enables client pairing."; 947 HOST_LOG << "Policy enables client pairing.";
948 else 948 else
949 LOG(INFO) << "Policy disables client pairing."; 949 HOST_LOG << "Policy disables client pairing.";
950 allow_pairing_ = allow_pairing; 950 allow_pairing_ = allow_pairing;
951 return true; 951 return true;
952 } 952 }
953 953
954 void HostProcess::StartHost() { 954 void HostProcess::StartHost() {
955 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 955 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
956 DCHECK(!host_); 956 DCHECK(!host_);
957 DCHECK(!signal_strategy_.get()); 957 DCHECK(!signal_strategy_.get());
958 DCHECK(state_ == HOST_INITIALIZING || state_ == HOST_STOPPING_TO_RESTART || 958 DCHECK(state_ == HOST_INITIALIZING || state_ == HOST_STOPPING_TO_RESTART ||
959 state_ == HOST_STOPPED) << state_; 959 state_ == HOST_STOPPED) << state_;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 return exit_code; 1175 return exit_code;
1176 } 1176 }
1177 1177
1178 } // namespace remoting 1178 } // namespace remoting
1179 1179
1180 #if !defined(OS_WIN) 1180 #if !defined(OS_WIN)
1181 int main(int argc, char** argv) { 1181 int main(int argc, char** argv) {
1182 return remoting::HostMain(argc, argv); 1182 return remoting::HostMain(argc, argv);
1183 } 1183 }
1184 #endif // !defined(OS_WIN) 1184 #endif // !defined(OS_WIN)
OLDNEW
« no previous file with comments | « remoting/host/plugin/host_script_object.cc ('k') | remoting/host/signaling_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698