Skip to content

Commit

Permalink
Add preliminary support for CloudPolicyOverridesPlatformPolicy.
Browse files Browse the repository at this point in the history
If "CloudPolicyOverridesPlatformPolicy" DWORD is set to 1 under SOFTWARE\Policies\Google\Update, then GoogleUpdate will try to use Cloud Policy first, even if Group Policy exists. Otherwise, it will try to use Group Policy first.
  • Loading branch information
sorinj committed Jan 22, 2020
1 parent e599983 commit e720e3e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
13 changes: 11 additions & 2 deletions omaha/common/config_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,17 @@ ConfigManager::ConfigManager() : dm_policy_manager_(new DMPolicyManager) {
true) == 0) :
false;

policies_.emplace_back(new GroupPolicyManager);
policies_.push_back(dm_policy_manager_);
DWORD cloud_policy_preferred(0);
if (SUCCEEDED(RegKey::GetValue(kRegKeyGoopdateGroupPolicy,
kRegValueCloudPolicyOverridesPlatformPolicy,
&cloud_policy_preferred)) &&
cloud_policy_preferred) {
policies_.push_back(dm_policy_manager_);
policies_.emplace_back(new GroupPolicyManager);
} else {
policies_.emplace_back(new GroupPolicyManager);
policies_.push_back(dm_policy_manager_);
}
}

CString ConfigManager::GetUserDownloadStorageDir() const {
Expand Down
2 changes: 2 additions & 0 deletions omaha/common/const_group_policy.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const TCHAR* const kRegValueUpdatesSuppressedStartMin =
_T("UpdatesSuppressedStartMin");
const TCHAR* const kRegValueUpdatesSuppressedDurationMin =
_T("UpdatesSuppressedDurationMin");
const TCHAR* const kRegValueCloudPolicyOverridesPlatformPolicy =
_T("CloudPolicyOverridesPlatformPolicy");

// This policy specifies what kind of download URLs could be returned to the
// client in the update response and in which order of priority. The client
Expand Down
15 changes: 13 additions & 2 deletions omaha/net/network_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,19 @@ HRESULT NetworkConfig::Initialize() {
}

Add(new UpdateDevProxyDetector);
Add(new GroupPolicyProxyDetector);
Add(new DMProxyDetector);

DWORD cloud_policy_preferred(0);
if (SUCCEEDED(RegKey::GetValue(kRegKeyGoopdateGroupPolicy,
kRegValueCloudPolicyOverridesPlatformPolicy,
&cloud_policy_preferred)) &&
cloud_policy_preferred) {
Add(new DMProxyDetector);
Add(new GroupPolicyProxyDetector);
} else {
Add(new GroupPolicyProxyDetector);
Add(new DMProxyDetector);
}

Add(new IEWPADProxyDetector);
Add(new IEPACProxyDetector);
Add(new IENamedProxyDetector);
Expand Down

0 comments on commit e720e3e

Please sign in to comment.