OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "sandbox/win/src/broker_services.h" | 5 #include "sandbox/win/src/broker_services.h" |
6 | 6 |
7 #include <AclAPI.h> | 7 #include <AclAPI.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 NOTREACHED(); | 81 NOTREACHED(); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 // Utility function to determine whether a token for the specified policy can | 85 // Utility function to determine whether a token for the specified policy can |
86 // be cached. | 86 // be cached. |
87 bool IsTokenCacheable(const sandbox::PolicyBase* policy) { | 87 bool IsTokenCacheable(const sandbox::PolicyBase* policy) { |
88 const sandbox::AppContainerAttributes* app_container = | 88 const sandbox::AppContainerAttributes* app_container = |
89 policy->GetAppContainer(); | 89 policy->GetAppContainer(); |
90 | 90 |
91 // We cannot cache tokens with an app container. | 91 // We cannot cache tokens with an app container or lowbox. |
92 if (app_container) | 92 if (app_container || policy->GetLowBoxSid()) |
93 return false; | 93 return false; |
94 | 94 |
95 return true; | 95 return true; |
96 } | 96 } |
97 | 97 |
98 // Utility function to pack token values into a key for the cache map. | 98 // Utility function to pack token values into a key for the cache map. |
99 uint32_t GenerateTokenCacheKey(const sandbox::PolicyBase* policy) { | 99 uint32_t GenerateTokenCacheKey(const sandbox::PolicyBase* policy) { |
100 const size_t kTokenShift = 3; | 100 const size_t kTokenShift = 3; |
101 uint32_t key; | 101 uint32_t key; |
102 | 102 |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 return SBOX_ERROR_UNSUPPORTED; | 590 return SBOX_ERROR_UNSUPPORTED; |
591 | 591 |
592 base::string16 name = LookupAppContainer(sid); | 592 base::string16 name = LookupAppContainer(sid); |
593 if (name.empty()) | 593 if (name.empty()) |
594 return SBOX_ERROR_INVALID_APP_CONTAINER; | 594 return SBOX_ERROR_INVALID_APP_CONTAINER; |
595 | 595 |
596 return DeleteAppContainer(sid); | 596 return DeleteAppContainer(sid); |
597 } | 597 } |
598 | 598 |
599 } // namespace sandbox | 599 } // namespace sandbox |
OLD | NEW |