Commit 15bf3b20 authored by Mattias Nissler's avatar Mattias Nissler Committed by Chromium LUCI CQ

Don't attempt to store owner settings when IsOwner() == false

The existing code had a user_id_ check, but that is not sufficient for
owner settings writes to go through, the private key must be present
as well. Replace the check with a proper IsOwner() check. This
misbehavior is only observed in DeviceSettingsServiceTest.Observer,
getting exposed by a DCHECK added in [1]. It's hopefully not hit in
production (otherwise tentative owner settings might get lost), but
better to fix the root cause than avoiding the offending edge case in
the test.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/2287290/11/chrome/browser/chromeos/ownership/owner_settings_service_chromeos.cc#800

BUG=chromium:1073940
TEST=unit tests pass

Change-Id: I6d5a5f17e8aeaa28600d57c7f0fcfad661434e33
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611720Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Mattias Nissler <mnissler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840801}
parent cb739616
...@@ -739,7 +739,7 @@ void OwnerSettingsServiceChromeOS::ReloadKeypairImpl( ...@@ -739,7 +739,7 @@ void OwnerSettingsServiceChromeOS::ReloadKeypairImpl(
void OwnerSettingsServiceChromeOS::StorePendingChanges() { void OwnerSettingsServiceChromeOS::StorePendingChanges() {
if (!HasPendingChanges() || store_settings_factory_.HasWeakPtrs() || if (!HasPendingChanges() || store_settings_factory_.HasWeakPtrs() ||
!device_settings_service_ || user_id_.empty()) { !device_settings_service_ || user_id_.empty() || !IsOwner()) {
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment