| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/policy/core/common/policy_loader_win.h" | 5 #include "components/policy/core/common/policy_loader_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <ntdsapi.h> // For Ds[Un]Bind | 8 #include <ntdsapi.h> // For Ds[Un]Bind |
| 9 #include <rpc.h> // For struct GUID | 9 #include <rpc.h> // For struct GUID |
| 10 #include <shlwapi.h> // For PathIsUNC() | 10 #include <shlwapi.h> // For PathIsUNC() |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 | 472 |
| 473 base::FilePath preg_file_path( | 473 base::FilePath preg_file_path( |
| 474 base::FilePath(policy_object->lpFileSysPath).Append(kPRegFileName)); | 474 base::FilePath(policy_object->lpFileSysPath).Append(kPRegFileName)); |
| 475 if (policy_object->dwOptions & GPO_FLAG_FORCE) { | 475 if (policy_object->dwOptions & GPO_FLAG_FORCE) { |
| 476 RegistryDict new_forced_policy; | 476 RegistryDict new_forced_policy; |
| 477 if (!ReadPRegFile(preg_file_path, &new_forced_policy, status)) | 477 if (!ReadPRegFile(preg_file_path, &new_forced_policy, status)) |
| 478 return false; | 478 return false; |
| 479 | 479 |
| 480 // Merge with existing forced policy, giving precedence to the existing | 480 // Merge with existing forced policy, giving precedence to the existing |
| 481 // forced policy. | 481 // forced policy. |
| 482 // TODO(ljusten): Same problem as below. |
| 482 new_forced_policy.Merge(forced_policy); | 483 new_forced_policy.Merge(forced_policy); |
| 483 forced_policy.Swap(&new_forced_policy); | 484 forced_policy.Swap(&new_forced_policy); |
| 484 } else { | 485 } else { |
| 485 if (!ReadPRegFile(preg_file_path, &parsed_policy, status)) | 486 if (!ReadPRegFile(preg_file_path, &parsed_policy, status)) |
| 486 return false; | 487 return false; |
| 487 } | 488 } |
| 488 } | 489 } |
| 489 | 490 |
| 490 // Merge, give precedence to forced policy. | 491 // Merge, give precedence to forced policy. |
| 492 // TODO(ljusten): This doesn't work properly if policies are explicitly |
| 493 // disabled or string list policies have less entries in the forced_policy. |
| 494 // The merged dictionary still has excessive policies and strings. To fix |
| 495 // this, use only one dict and call ReadPRegFile in the proper order (forced |
| 496 // last). See crbug.com/659979. |
| 491 parsed_policy.Merge(forced_policy); | 497 parsed_policy.Merge(forced_policy); |
| 492 policy->Swap(&parsed_policy); | 498 policy->Swap(&parsed_policy); |
| 493 | 499 |
| 494 return true; | 500 return true; |
| 495 } | 501 } |
| 496 | 502 |
| 497 bool PolicyLoaderWin::ReadPolicyFromGPO(PolicyScope scope, | 503 bool PolicyLoaderWin::ReadPolicyFromGPO(PolicyScope scope, |
| 498 RegistryDict* policy, | 504 RegistryDict* policy, |
| 499 PolicyLoadStatusSample* status) { | 505 PolicyLoadStatusSample* status) { |
| 500 PGROUP_POLICY_OBJECT policy_object_list = NULL; | 506 PGROUP_POLICY_OBJECT policy_object_list = NULL; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 | 612 |
| 607 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { | 613 void PolicyLoaderWin::OnObjectSignaled(HANDLE object) { |
| 608 DCHECK(object == user_policy_changed_event_.handle() || | 614 DCHECK(object == user_policy_changed_event_.handle() || |
| 609 object == machine_policy_changed_event_.handle()) | 615 object == machine_policy_changed_event_.handle()) |
| 610 << "unexpected object signaled policy reload, obj = " | 616 << "unexpected object signaled policy reload, obj = " |
| 611 << std::showbase << std::hex << object; | 617 << std::showbase << std::hex << object; |
| 612 Reload(false); | 618 Reload(false); |
| 613 } | 619 } |
| 614 | 620 |
| 615 } // namespace policy | 621 } // namespace policy |
| OLD | NEW |