diff options
author | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 14:01:47 +0000 |
---|---|---|
committer | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-15 14:01:47 +0000 |
commit | 4b522bdf185cec1e4cea6a657de2c8142df779a8 (patch) | |
tree | 1ff0697907251f3be1ce488a18fdccb23a32dfb1 /chrome/browser | |
parent | e434c89824290cdd49c606ce5c3cd2d488373554 (diff) | |
download | chromium_src-4b522bdf185cec1e4cea6a657de2c8142df779a8.zip chromium_src-4b522bdf185cec1e4cea6a657de2c8142df779a8.tar.gz chromium_src-4b522bdf185cec1e4cea6a657de2c8142df779a8.tar.bz2 |
Tolerate absence of suitable libcros upon policy load/store.
BUG=chromium-os:17339
TEST=Chrome doesn't crash upon startup when libcros is missing or has the wrong version.
Review URL: http://codereview.chromium.org/7355028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92688 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/chromeos/login/signed_settings.cc | 11 | ||||
-rw-r--r-- | chrome/browser/policy/browser_policy_connector.cc | 6 | ||||
-rw-r--r-- | chrome/browser/policy/enterprise_install_attributes.cc | 2 |
3 files changed, 13 insertions, 6 deletions
diff --git a/chrome/browser/chromeos/login/signed_settings.cc b/chrome/browser/chromeos/login/signed_settings.cc index 470573a..f210201 100644 --- a/chrome/browser/chromeos/login/signed_settings.cc +++ b/chrome/browser/chromeos/login/signed_settings.cc @@ -839,7 +839,8 @@ void StorePolicyOp::OnKeyOpComplete(const OwnerManager::KeyOpCode return_code, void StorePolicyOp::RequestStorePolicy() { std::string serialized; - if (policy_->SerializeToString(&serialized)) { + if (policy_->SerializeToString(&serialized) && + CrosLibrary::Get()->EnsureLoaded()) { CrosLibrary::Get()->GetLoginLibrary()->RequestStorePolicy( serialized, &StorePolicyOp::OnBoolComplete, @@ -862,8 +863,12 @@ RetrievePolicyOp::RetrievePolicyOp( RetrievePolicyOp::~RetrievePolicyOp() {} void RetrievePolicyOp::Execute() { - CrosLibrary::Get()->GetLoginLibrary()->RequestRetrievePolicy( - &RetrievePolicyOp::OnStringComplete, this); + if (CrosLibrary::Get()->EnsureLoaded()) { + CrosLibrary::Get()->GetLoginLibrary()->RequestRetrievePolicy( + &RetrievePolicyOp::OnStringComplete, this); + } else { + Fail(OPERATION_FAILED); + } } void RetrievePolicyOp::Fail(SignedSettings::ReturnCode code) { diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc index 6449376..51bfa71 100644 --- a/chrome/browser/policy/browser_policy_connector.cc +++ b/chrome/browser/policy/browser_policy_connector.cc @@ -305,8 +305,10 @@ void BrowserPolicyConnector::InitializeDevicePolicy() { CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kEnableDevicePolicy)) { device_data_store_.reset(CloudPolicyDataStore::CreateForDevicePolicies()); - install_attributes_.reset(new EnterpriseInstallAttributes( - chromeos::CrosLibrary::Get()->GetCryptohomeLibrary())); + chromeos::CryptohomeLibrary* cryptohome = NULL; + if (chromeos::CrosLibrary::Get()->EnsureLoaded()) + cryptohome = chromeos::CrosLibrary::Get()->GetCryptohomeLibrary(); + install_attributes_.reset(new EnterpriseInstallAttributes(cryptohome)); DevicePolicyCache* device_policy_cache = new DevicePolicyCache(device_data_store_.get(), install_attributes_.get()); diff --git a/chrome/browser/policy/enterprise_install_attributes.cc b/chrome/browser/policy/enterprise_install_attributes.cc index 0fec96f..03ebc96 100644 --- a/chrome/browser/policy/enterprise_install_attributes.cc +++ b/chrome/browser/policy/enterprise_install_attributes.cc @@ -25,7 +25,7 @@ EnterpriseInstallAttributes::LockResult EnterpriseInstallAttributes::LockDevice( LOCK_SUCCESS : LOCK_WRONG_USER; } - if (!cryptohome_->InstallAttributesIsReady()) + if (!cryptohome_ || !cryptohome_->InstallAttributesIsReady()) return LOCK_NOT_READY; // Clearing the TPM password seems to be always a good deal. |