diff options
author | rmsousa <rmsousa@chromium.org> | 2014-11-20 21:24:03 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-21 05:24:17 +0000 |
commit | c32420e15c691f49908603cf5a51257e396082fe (patch) | |
tree | 93b55d2973a81d366c9d2d3390f6a44fdf3b30d3 | |
parent | 69ac8f09df487a1cab533e888632c2d8adc16cbb (diff) | |
download | chromium_src-c32420e15c691f49908603cf5a51257e396082fe.zip chromium_src-c32420e15c691f49908603cf5a51257e396082fe.tar.gz chromium_src-c32420e15c691f49908603cf5a51257e396082fe.tar.bz2 |
Fix non-gmail host service account logic.
1. Fix host registration for accounts with robot account disabled.
2. Fix host domain/username policy logic for non-gmail accounts to only bail when it's actually enabled.
BUG=434979
Review URL: https://codereview.chromium.org/747823002
Cr-Commit-Position: refs/heads/master@{#305175}
-rw-r--r-- | remoting/host/remoting_me2me_host.cc | 42 | ||||
-rw-r--r-- | remoting/webapp/crd/js/host_controller.js | 3 |
2 files changed, 24 insertions, 21 deletions
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index a01122a..6ea5ce2 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -936,20 +936,21 @@ void HostProcess::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) { void HostProcess::ApplyHostDomainPolicy() { HOST_LOG << "Policy sets host domain: " << host_domain_; - // If the user does not have a Google email, their client JID will not be - // based on their email. In that case, the username/host domain policies would - // be meaningless, since there is no way to check that the JID attempting to - // connect actually corresponds to the owner email in question. - if (host_owner_ != host_owner_email_) { - LOG(ERROR) << "The username and host domain policies cannot be enabled for " - << "accounts with a non-Google email."; - ShutdownHost(kInvalidHostDomainExitCode); - } + if (!host_domain_.empty()) { + // If the user does not have a Google email, their client JID will not be + // based on their email. In that case, the username/host domain policies + // would be meaningless, since there is no way to check that the JID + // trying to connect actually corresponds to the owner email in question. + if (host_owner_ != host_owner_email_) { + LOG(ERROR) << "The username and host domain policies cannot be enabled " + << "for accounts with a non-Google email."; + ShutdownHost(kInvalidHostDomainExitCode); + } - if (!host_domain_.empty() && - !EndsWith(host_owner_, std::string("@") + host_domain_, false)) { - LOG(ERROR) << "The host domain does not match the policy."; - ShutdownHost(kInvalidHostDomainExitCode); + if (!EndsWith(host_owner_, std::string("@") + host_domain_, false)) { + LOG(ERROR) << "The host domain does not match the policy."; + ShutdownHost(kInvalidHostDomainExitCode); + } } } @@ -967,15 +968,16 @@ bool HostProcess::OnHostDomainPolicyUpdate(base::DictionaryValue* policies) { } void HostProcess::ApplyUsernamePolicy() { - // See comment in ApplyHostDomainPolicy. - if (host_owner_ != host_owner_email_) { - LOG(ERROR) << "The username and host domain policies cannot be enabled for " - << "accounts with a non-Google email."; - ShutdownHost(kUsernameMismatchExitCode); - } - if (host_username_match_required_) { HOST_LOG << "Policy requires host username match."; + + // See comment in ApplyHostDomainPolicy. + if (host_owner_ != host_owner_email_) { + LOG(ERROR) << "The username and host domain policies cannot be enabled " + << "for accounts with a non-Google email."; + ShutdownHost(kUsernameMismatchExitCode); + } + std::string username = GetUsername(); bool shutdown = username.empty() || !StartsWithASCII(host_owner_, username + std::string("@"), diff --git a/remoting/webapp/crd/js/host_controller.js b/remoting/webapp/crd/js/host_controller.js index 7473c8c..45ef366 100644 --- a/remoting/webapp/crd/js/host_controller.js +++ b/remoting/webapp/crd/js/host_controller.js @@ -253,7 +253,8 @@ remoting.HostController.prototype.start = function(hostPin, consent, onDone, newHostId, hostPin, startHostWithHash.bind( null, hostName, publicKey, privateKey, remoting.identity.getCachedEmail(), - remoting.oauth2.getRefreshToken()), + remoting.oauth2.getRefreshToken(), + remoting.identity.getCachedEmail()), onError); } } else { |