| 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/sandbox_policy_base.h" | 5 #include "sandbox/win/src/sandbox_policy_base.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 ResultCode PolicyBase::SetTokenLevel(TokenLevel initial, TokenLevel lockdown) { | 155 ResultCode PolicyBase::SetTokenLevel(TokenLevel initial, TokenLevel lockdown) { |
| 156 if (initial < lockdown) { | 156 if (initial < lockdown) { |
| 157 return SBOX_ERROR_BAD_PARAMS; | 157 return SBOX_ERROR_BAD_PARAMS; |
| 158 } | 158 } |
| 159 initial_level_ = initial; | 159 initial_level_ = initial; |
| 160 lockdown_level_ = lockdown; | 160 lockdown_level_ = lockdown; |
| 161 return SBOX_ALL_OK; | 161 return SBOX_ALL_OK; |
| 162 } | 162 } |
| 163 | 163 |
| 164 TokenLevel PolicyBase::GetInitialTokenLevel() { |
| 165 return initial_level_; |
| 166 } |
| 167 |
| 168 TokenLevel PolicyBase::GetLockdownTokenLevel() { |
| 169 return lockdown_level_; |
| 170 } |
| 171 |
| 164 ResultCode PolicyBase::SetJobLevel(JobLevel job_level, uint32 ui_exceptions) { | 172 ResultCode PolicyBase::SetJobLevel(JobLevel job_level, uint32 ui_exceptions) { |
| 165 job_level_ = job_level; | 173 job_level_ = job_level; |
| 166 ui_exceptions_ = ui_exceptions; | 174 ui_exceptions_ = ui_exceptions; |
| 167 return SBOX_ALL_OK; | 175 return SBOX_ALL_OK; |
| 168 } | 176 } |
| 169 | 177 |
| 170 ResultCode PolicyBase::SetAlternateDesktop(bool alternate_winstation) { | 178 ResultCode PolicyBase::SetAlternateDesktop(bool alternate_winstation) { |
| 171 use_alternate_desktop_ = true; | 179 use_alternate_desktop_ = true; |
| 172 use_alternate_winstation_ = alternate_winstation; | 180 use_alternate_winstation_ = alternate_winstation; |
| 173 return CreateAlternateDesktop(alternate_winstation); | 181 return CreateAlternateDesktop(alternate_winstation); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 ::CloseWindowStation(alternate_winstation_handle_); | 266 ::CloseWindowStation(alternate_winstation_handle_); |
| 259 alternate_winstation_handle_ = NULL; | 267 alternate_winstation_handle_ = NULL; |
| 260 } | 268 } |
| 261 } | 269 } |
| 262 | 270 |
| 263 ResultCode PolicyBase::SetIntegrityLevel(IntegrityLevel integrity_level) { | 271 ResultCode PolicyBase::SetIntegrityLevel(IntegrityLevel integrity_level) { |
| 264 integrity_level_ = integrity_level; | 272 integrity_level_ = integrity_level; |
| 265 return SBOX_ALL_OK; | 273 return SBOX_ALL_OK; |
| 266 } | 274 } |
| 267 | 275 |
| 276 IntegrityLevel PolicyBase::GetIntegrityLevel() { |
| 277 return integrity_level_; |
| 278 } |
| 279 |
| 268 ResultCode PolicyBase::SetDelayedIntegrityLevel( | 280 ResultCode PolicyBase::SetDelayedIntegrityLevel( |
| 269 IntegrityLevel integrity_level) { | 281 IntegrityLevel integrity_level) { |
| 270 delayed_integrity_level_ = integrity_level; | 282 delayed_integrity_level_ = integrity_level; |
| 271 return SBOX_ALL_OK; | 283 return SBOX_ALL_OK; |
| 272 } | 284 } |
| 273 | 285 |
| 274 ResultCode PolicyBase::SetAppContainer(const wchar_t* sid) { | 286 ResultCode PolicyBase::SetAppContainer(const wchar_t* sid) { |
| 275 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) | 287 if (base::win::OSInfo::GetInstance()->version() < base::win::VERSION_WIN8) |
| 276 return SBOX_ALL_OK; | 288 return SBOX_ALL_OK; |
| 277 | 289 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 | 678 |
| 667 // Finally, setup imports on the target so the interceptions can work. | 679 // Finally, setup imports on the target so the interceptions can work. |
| 668 return SetupNtdllImports(target); | 680 return SetupNtdllImports(target); |
| 669 } | 681 } |
| 670 | 682 |
| 671 bool PolicyBase::SetupHandleCloser(TargetProcess* target) { | 683 bool PolicyBase::SetupHandleCloser(TargetProcess* target) { |
| 672 return handle_closer_.InitializeTargetHandles(target); | 684 return handle_closer_.InitializeTargetHandles(target); |
| 673 } | 685 } |
| 674 | 686 |
| 675 } // namespace sandbox | 687 } // namespace sandbox |
| OLD | NEW |