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

Unified Diff: chrome/browser/policy/device_policy_cache.cc

Issue 10443125: Allow re-enrollment to the same domain in case of policy data loss. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unit tests. Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
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 3c4bb24c158da271f038f88754fab69a12631fc3..418fd4047396879c5af5c54a78ca705f2b28bd20 100644
--- a/chrome/browser/policy/device_policy_cache.cc
+++ b/chrome/browser/policy/device_policy_cache.cc
@@ -150,8 +150,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,
@@ -174,10 +174,10 @@ 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())) {
Mattias Nissler (ping if slow) 2012/06/04 10:17:52 Remove the authenticator header as well. Also, don
pastarmovj 2012/06/08 09:54:32 Done.
+ if (registration_domain !=
+ install_attributes_->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,

Powered by Google App Engine
This is Rietveld 408576698