| Index: chrome/browser/policy/enterprise_install_attributes.cc
|
| diff --git a/chrome/browser/policy/enterprise_install_attributes.cc b/chrome/browser/policy/enterprise_install_attributes.cc
|
| index bb6f9f2ba3fed2fb186b9ae08f70c00476d920d6..203864ba479749231faec6252027be8e0c605875 100644
|
| --- a/chrome/browser/policy/enterprise_install_attributes.cc
|
| +++ b/chrome/browser/policy/enterprise_install_attributes.cc
|
| @@ -23,16 +23,6 @@ const char kAttrEnterpriseMode[] = "enterprise.mode";
|
| const char kAttrEnterpriseOwned[] = "enterprise.owned";
|
| const char kAttrEnterpriseUser[] = "enterprise.user";
|
|
|
| -// Extract the domain from a given email.
|
| -std::string ExtractDomainName(const std::string& email) {
|
| - size_t separator_pos = email.find('@');
|
| - if (separator_pos != email.npos && separator_pos < email.length() - 1)
|
| - return email.substr(separator_pos + 1);
|
| - else
|
| - NOTREACHED() << "Not a proper email address: " << email;
|
| - return std::string();
|
| -}
|
| -
|
| // Translates DeviceMode constants to strings used in the lockbox.
|
| std::string GetDeviceModeString(DeviceMode mode) {
|
| switch (mode) {
|
| @@ -78,9 +68,11 @@ EnterpriseInstallAttributes::LockResult EnterpriseInstallAttributes::LockDevice(
|
| CHECK_NE(device_mode, DEVICE_MODE_PENDING);
|
| CHECK_NE(device_mode, DEVICE_MODE_NOT_SET);
|
|
|
| + std::string domain = ExtractDomainName(user);
|
| +
|
| // Check for existing lock first.
|
| if (device_locked_) {
|
| - return !registration_user_.empty() && user == registration_user_ ?
|
| + return !registration_domain_.empty() && domain == registration_domain_ ?
|
| LOCK_SUCCESS : LOCK_WRONG_USER;
|
| }
|
|
|
| @@ -103,7 +95,6 @@ EnterpriseInstallAttributes::LockResult EnterpriseInstallAttributes::LockDevice(
|
| if (!cryptohome_->InstallAttributesIsFirstInstall())
|
| return LOCK_WRONG_USER;
|
|
|
| - std::string domain = ExtractDomainName(user);
|
| std::string mode = GetDeviceModeString(device_mode);
|
|
|
| // Set values in the InstallAttrs and lock it.
|
| @@ -159,6 +150,17 @@ DeviceMode EnterpriseInstallAttributes::GetMode() {
|
| return registration_mode_;
|
| }
|
|
|
| +// static
|
| +std::string EnterpriseInstallAttributes::ExtractDomainName(
|
| + const std::string& email) {
|
| + size_t separator_pos = email.find('@');
|
| + if (separator_pos != email.npos && separator_pos < email.length() - 1)
|
| + return email.substr(separator_pos + 1);
|
| + else
|
| + NOTREACHED() << "Not a proper email address: " << email;
|
| + return std::string();
|
| +}
|
| +
|
| void EnterpriseInstallAttributes::ReadImmutableAttributes() {
|
| if (device_locked_)
|
| return;
|
|
|