Chromium Code Reviews| Index: chrome/browser/policy/device_policy_cache.cc |
| diff --git a/chrome/browser/policy/device_policy_cache.cc b/chrome/browser/policy/device_policy_cache.cc |
| index 931178e7d763b9784a32465d9d48be16b91ccf8b..6f41d2a67e3194e6cc48d9497519bda8f261c99b 100644 |
| --- a/chrome/browser/policy/device_policy_cache.cc |
| +++ b/chrome/browser/policy/device_policy_cache.cc |
| @@ -14,6 +14,7 @@ |
| #include "base/compiler_specific.h" |
| #include "base/logging.h" |
| #include "base/metrics/histogram.h" |
| +#include "base/string_util.h" |
|
Mattias Nissler (ping if slow)
2012/06/18 16:45:17
needed?
pastarmovj
2012/06/18 17:12:58
Nope a leftover.
|
| #include "base/values.h" |
| #include "chrome/browser/chromeos/cros_settings.h" |
| #include "chrome/browser/chromeos/login/authenticator.h" |
| @@ -167,8 +168,8 @@ bool DevicePolicyCache::SetPolicy(const em::PolicyFetchResponse& policy) { |
| DCHECK(IsReady()); |
| // Make sure we have an enterprise device. |
| - std::string registration_user(install_attributes_->GetRegistrationUser()); |
| - if (registration_user.empty()) { |
| + std::string registration_domain(install_attributes_->GetDomain()); |
| + if (registration_domain.empty()) { |
| LOG(WARNING) << "Refusing to accept policy on non-enterprise device."; |
| UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, |
| kMetricPolicyFetchNonEnterpriseDevice, |
| @@ -190,11 +191,11 @@ bool DevicePolicyCache::SetPolicy(const em::PolicyFetchResponse& policy) { |
| } |
| // Existing installations may not have a canonicalized version of the |
| - // registration user name in install attributes, so re-canonicalize here. |
| - if (chromeos::Authenticator::Canonicalize(registration_user) != |
| - chromeos::Authenticator::Canonicalize(policy_data.username())) { |
| + // registration domain in install attributes, so lower-case the data here. |
| + if (registration_domain != |
| + chromeos::Authenticator::ExtractDomainName(policy_data.username())) { |
| LOG(WARNING) << "Refusing policy blob for " << policy_data.username() |
| - << " which doesn't match " << registration_user; |
| + << " which doesn't match domain " << registration_domain; |
| UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, kMetricPolicyFetchUserMismatch, |
| kMetricPolicySize); |
| InformNotifier(CloudPolicySubsystem::LOCAL_ERROR, |