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 <lm.h> // For limits. | 8 #include <lm.h> // For limits. |
9 #include <ntdsapi.h> // For Ds[Un]Bind | 9 #include <ntdsapi.h> // For Ds[Un]Bind |
10 #include <rpc.h> // For struct GUID | 10 #include <rpc.h> // For struct GUID |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // the FILE thread on which this code runs in steady state. Given that | 455 // the FILE thread on which this code runs in steady state. Given that |
456 // there have never been any reports of issues due to partially-applied / | 456 // there have never been any reports of issues due to partially-applied / |
457 // corrupt group policy, this code intentionally omits the | 457 // corrupt group policy, this code intentionally omits the |
458 // EnterCriticalPolicySection() call. | 458 // EnterCriticalPolicySection() call. |
459 // | 459 // |
460 // If there's ever reason to revisit this decision, one option could be to | 460 // If there's ever reason to revisit this decision, one option could be to |
461 // make the EnterCriticalPolicySection() call on a dedicated thread and | 461 // make the EnterCriticalPolicySection() call on a dedicated thread and |
462 // timeout on it more aggressively. For now, there's no justification for | 462 // timeout on it more aggressively. For now, there's no justification for |
463 // the additional effort this would introduce. | 463 // the additional effort this would introduce. |
464 | 464 |
465 if (is_enterprise || !ReadPolicyFromGPO(scope, &gpo_dict, &status)) { | 465 bool is_registry_forced = is_enterprise || gpo_provider_ == nullptr; |
466 VLOG_IF(1, !is_enterprise) << "Failed to read GPO files for " << scope | 466 if (is_registry_forced || !ReadPolicyFromGPO(scope, &gpo_dict, &status)) { |
467 << " falling back to registry."; | 467 VLOG_IF(1, !is_registry_forced) << "Failed to read GPO files for " |
| 468 << scope << " falling back to registry."; |
468 gpo_dict.ReadRegistry(kScopes[i].hive, chrome_policy_key_); | 469 gpo_dict.ReadRegistry(kScopes[i].hive, chrome_policy_key_); |
469 } | 470 } |
470 | 471 |
471 // Remove special-cased entries from the GPO dictionary. | 472 // Remove special-cased entries from the GPO dictionary. |
472 scoped_ptr<RegistryDict> recommended_dict( | 473 scoped_ptr<RegistryDict> recommended_dict( |
473 gpo_dict.RemoveKey(kKeyRecommended)); | 474 gpo_dict.RemoveKey(kKeyRecommended)); |
474 scoped_ptr<RegistryDict> third_party_dict( | 475 scoped_ptr<RegistryDict> third_party_dict( |
475 gpo_dict.RemoveKey(kKeyThirdParty)); | 476 gpo_dict.RemoveKey(kKeyThirdParty)); |
476 | 477 |
477 // Load Chrome policy. | 478 // Load Chrome policy. |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 "418183 PolicyLoaderWin::OnObjectSignaled")); | 689 "418183 PolicyLoaderWin::OnObjectSignaled")); |
689 | 690 |
690 DCHECK(object == user_policy_changed_event_.handle() || | 691 DCHECK(object == user_policy_changed_event_.handle() || |
691 object == machine_policy_changed_event_.handle()) | 692 object == machine_policy_changed_event_.handle()) |
692 << "unexpected object signaled policy reload, obj = " | 693 << "unexpected object signaled policy reload, obj = " |
693 << std::showbase << std::hex << object; | 694 << std::showbase << std::hex << object; |
694 Reload(false); | 695 Reload(false); |
695 } | 696 } |
696 | 697 |
697 } // namespace policy | 698 } // namespace policy |
OLD | NEW |