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

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

Issue 14234012: Enable RDP integration by default when the curtain mode is enabled by the policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing a typo Created 7 years, 8 months 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 | « no previous file | remoting/remoting.gyp » ('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"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 void SendSasToConsole(); 195 void SendSasToConsole();
196 196
197 // Tear down resources that run on the UI thread. 197 // Tear down resources that run on the UI thread.
198 void ShutdownOnUiThread(); 198 void ShutdownOnUiThread();
199 199
200 // Applies the host config, returning true if successful. 200 // Applies the host config, returning true if successful.
201 bool ApplyConfig(scoped_ptr<JsonHostConfig> config); 201 bool ApplyConfig(scoped_ptr<JsonHostConfig> config);
202 202
203 void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies); 203 void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies);
204 bool OnHostDomainPolicyUpdate(const std::string& host_domain); 204 bool OnHostDomainPolicyUpdate(const std::string& host_domain);
205 bool OnUsernamePolicyUpdate(bool username_match_required); 205 bool OnUsernamePolicyUpdate(bool curtain_required,
206 bool username_match_required);
206 bool OnNatPolicyUpdate(bool nat_traversal_enabled); 207 bool OnNatPolicyUpdate(bool nat_traversal_enabled);
207 bool OnCurtainPolicyUpdate(bool curtain_required); 208 bool OnCurtainPolicyUpdate(bool curtain_required);
208 bool OnHostTalkGadgetPrefixPolicyUpdate(const std::string& talkgadget_prefix); 209 bool OnHostTalkGadgetPrefixPolicyUpdate(const std::string& talkgadget_prefix);
209 bool OnHostTokenUrlPolicyUpdate(const GURL& token_url, 210 bool OnHostTokenUrlPolicyUpdate(const GURL& token_url,
210 const GURL& token_validation_url); 211 const GURL& token_validation_url);
211 212
212 void StartHost(); 213 void StartHost();
213 214
214 void OnAuthFailed(); 215 void OnAuthFailed();
215 216
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 return; 718 return;
718 } 719 }
719 720
720 bool restart_required = false; 721 bool restart_required = false;
721 bool bool_value; 722 bool bool_value;
722 std::string string_value; 723 std::string string_value;
723 if (policies->GetString(policy_hack::PolicyWatcher::kHostDomainPolicyName, 724 if (policies->GetString(policy_hack::PolicyWatcher::kHostDomainPolicyName,
724 &string_value)) { 725 &string_value)) {
725 restart_required |= OnHostDomainPolicyUpdate(string_value); 726 restart_required |= OnHostDomainPolicyUpdate(string_value);
726 } 727 }
728 bool curtain_required = false;
729 if (policies->GetBoolean(
730 policy_hack::PolicyWatcher::kHostRequireCurtainPolicyName,
731 &curtain_required)) {
732 restart_required |= OnCurtainPolicyUpdate(curtain_required);
733 }
727 if (policies->GetBoolean( 734 if (policies->GetBoolean(
728 policy_hack::PolicyWatcher::kHostMatchUsernamePolicyName, 735 policy_hack::PolicyWatcher::kHostMatchUsernamePolicyName,
729 &bool_value)) { 736 &bool_value)) {
730 restart_required |= OnUsernamePolicyUpdate(bool_value); 737 restart_required |= OnUsernamePolicyUpdate(curtain_required, bool_value);
731 } 738 }
732 if (policies->GetBoolean(policy_hack::PolicyWatcher::kNatPolicyName, 739 if (policies->GetBoolean(policy_hack::PolicyWatcher::kNatPolicyName,
733 &bool_value)) { 740 &bool_value)) {
734 restart_required |= OnNatPolicyUpdate(bool_value); 741 restart_required |= OnNatPolicyUpdate(bool_value);
735 } 742 }
736 if (policies->GetString( 743 if (policies->GetString(
737 policy_hack::PolicyWatcher::kHostTalkGadgetPrefixPolicyName, 744 policy_hack::PolicyWatcher::kHostTalkGadgetPrefixPolicyName,
738 &string_value)) { 745 &string_value)) {
739 restart_required |= OnHostTalkGadgetPrefixPolicyUpdate(string_value); 746 restart_required |= OnHostTalkGadgetPrefixPolicyUpdate(string_value);
740 } 747 }
741 if (policies->GetBoolean(
742 policy_hack::PolicyWatcher::kHostRequireCurtainPolicyName,
743 &bool_value)) {
744 restart_required |= OnCurtainPolicyUpdate(bool_value);
745 }
746 std::string token_url_string, token_validation_url_string; 748 std::string token_url_string, token_validation_url_string;
747 if (policies->GetString( 749 if (policies->GetString(
748 policy_hack::PolicyWatcher::kHostTokenUrlPolicyName, 750 policy_hack::PolicyWatcher::kHostTokenUrlPolicyName,
749 &token_url_string) && 751 &token_url_string) &&
750 policies->GetString( 752 policies->GetString(
751 policy_hack::PolicyWatcher::kHostTokenValidationUrlPolicyName, 753 policy_hack::PolicyWatcher::kHostTokenValidationUrlPolicyName,
752 &token_validation_url_string)) { 754 &token_validation_url_string)) {
753 restart_required |= OnHostTokenUrlPolicyUpdate( 755 restart_required |= OnHostTokenUrlPolicyUpdate(
754 GURL(token_url_string), GURL(token_validation_url_string)); 756 GURL(token_url_string), GURL(token_validation_url_string));
755 } 757 }
(...skipping 11 matching lines...) Expand all
767 769
768 LOG(INFO) << "Policy sets host domain: " << host_domain; 770 LOG(INFO) << "Policy sets host domain: " << host_domain;
769 771
770 if (!host_domain.empty() && 772 if (!host_domain.empty() &&
771 !EndsWith(xmpp_login_, std::string("@") + host_domain, false)) { 773 !EndsWith(xmpp_login_, std::string("@") + host_domain, false)) {
772 ShutdownHost(kInvalidHostDomainExitCode); 774 ShutdownHost(kInvalidHostDomainExitCode);
773 } 775 }
774 return false; 776 return false;
775 } 777 }
776 778
777 bool HostProcess::OnUsernamePolicyUpdate(bool host_username_match_required) { 779 bool HostProcess::OnUsernamePolicyUpdate(bool curtain_required,
780 bool host_username_match_required) {
778 // Returns false: never restart the host after this policy update. 781 // Returns false: never restart the host after this policy update.
779 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 782 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
780 783
781 if (host_username_match_required) { 784 if (host_username_match_required) {
782 LOG(INFO) << "Policy requires host username match."; 785 LOG(INFO) << "Policy requires host username match.";
783 std::string username = GetUsername(); 786 std::string username = GetUsername();
784 bool shutdown = username.empty() || 787 bool shutdown = username.empty() ||
785 !StartsWithASCII(xmpp_login_, username + std::string("@"), 788 !StartsWithASCII(xmpp_login_, username + std::string("@"),
786 false); 789 false);
787 790
788 #if defined(OS_MACOSX) 791 #if defined(OS_MACOSX)
789 // On Mac, we run as root at the login screen, so the username won't match. 792 // On Mac, we run as root at the login screen, so the username won't match.
790 // However, there's no need to enforce the policy at the login screen, as 793 // However, there's no need to enforce the policy at the login screen, as
791 // the client will have to reconnect if a login occurs. 794 // the client will have to reconnect if a login occurs.
792 if (shutdown && getuid() == 0) { 795 if (shutdown && getuid() == 0) {
793 shutdown = false; 796 shutdown = false;
794 } 797 }
795 #endif 798 #endif
796 799
800 // Curtain-mode on Windows presents the standard OS login prompt to the user
801 // for each connection, removing the need for an explicit user-name matching
802 // check.
803 #if defined(OS_WIN) && defined(REMOTING_RDP_SESSION)
804 if (curtain_required)
805 return false;
806 #endif // defined(OS_WIN) && defined(REMOTING_RDP_SESSION)
807
808 // Shutdown the host if the username does not match.
797 if (shutdown) { 809 if (shutdown) {
798 LOG(ERROR) << "The host username does not match."; 810 LOG(ERROR) << "The host username does not match.";
799 ShutdownHost(kUsernameMismatchExitCode); 811 ShutdownHost(kUsernameMismatchExitCode);
800 } 812 }
801 } else { 813 } else {
802 LOG(INFO) << "Policy does not require host username match."; 814 LOG(INFO) << "Policy does not require host username match.";
803 } 815 }
804 816
805 return false; 817 return false;
806 } 818 }
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 return exit_code; 1155 return exit_code;
1144 } 1156 }
1145 1157
1146 } // namespace remoting 1158 } // namespace remoting
1147 1159
1148 #if !defined(OS_WIN) 1160 #if !defined(OS_WIN)
1149 int main(int argc, char** argv) { 1161 int main(int argc, char** argv) {
1150 return remoting::HostMain(argc, argv); 1162 return remoting::HostMain(argc, argv);
1151 } 1163 }
1152 #endif // !defined(OS_WIN) 1164 #endif // !defined(OS_WIN)
OLDNEW
« no previous file with comments | « no previous file | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698