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..de49638cd535079460a6d3c1ff02638229d6101b 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" |
| #include "base/values.h" |
| #include "chrome/browser/chromeos/cros_settings.h" |
| #include "chrome/browser/chromeos/login/authenticator.h" |
| @@ -167,8 +168,9 @@ 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( |
| + StringToLowerASCII(install_attributes_->GetDomain())); |
|
Mattias Nissler (ping if slow)
2012/06/08 13:13:44
It would be nice if we could call the canonicaliza
pastarmovj
2012/06/08 15:07:12
Done.
|
| + if (registration_domain.empty()) { |
| LOG(WARNING) << "Refusing to accept policy on non-enterprise device."; |
| UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, |
| kMetricPolicyFetchNonEnterpriseDevice, |
| @@ -190,11 +192,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, |