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 <sddl.h> | 7 #include <sddl.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 return SBOX_ALL_OK; | 366 return SBOX_ALL_OK; |
367 } | 367 } |
368 | 368 |
369 ResultCode PolicyBase::SetStderrHandle(HANDLE handle) { | 369 ResultCode PolicyBase::SetStderrHandle(HANDLE handle) { |
370 if (!IsInheritableHandle(handle)) | 370 if (!IsInheritableHandle(handle)) |
371 return SBOX_ERROR_BAD_PARAMS; | 371 return SBOX_ERROR_BAD_PARAMS; |
372 stderr_handle_ = handle; | 372 stderr_handle_ = handle; |
373 return SBOX_ALL_OK; | 373 return SBOX_ALL_OK; |
374 } | 374 } |
375 | 375 |
376 ResultCode PolicyBase::AddRule(SubSystem subsystem, Semantics semantics, | 376 ResultCode PolicyBase::AddRule(SubSystem subsystem, |
| 377 Semantics semantics, |
377 const wchar_t* pattern) { | 378 const wchar_t* pattern) { |
| 379 ResultCode result = AddRuleInternal(subsystem, semantics, pattern); |
| 380 LOG_IF(ERROR, result != SBOX_ALL_OK) << "Failed to add sandbox rule." |
| 381 << " error = " << result |
| 382 << ", subsystem = " << subsystem |
| 383 << ", semantics = " << semantics |
| 384 << ", pattern = '" << pattern << "'"; |
| 385 return result; |
| 386 } |
| 387 |
| 388 ResultCode PolicyBase::AddRuleInternal(SubSystem subsystem, |
| 389 Semantics semantics, |
| 390 const wchar_t* pattern) { |
378 if (NULL == policy_) { | 391 if (NULL == policy_) { |
379 policy_ = MakeBrokerPolicyMemory(); | 392 policy_ = MakeBrokerPolicyMemory(); |
380 DCHECK(policy_); | 393 DCHECK(policy_); |
381 policy_maker_ = new LowLevelPolicy(policy_); | 394 policy_maker_ = new LowLevelPolicy(policy_); |
382 DCHECK(policy_maker_); | 395 DCHECK(policy_maker_); |
383 } | 396 } |
384 | 397 |
385 switch (subsystem) { | 398 switch (subsystem) { |
386 case SUBSYS_FILES: { | 399 case SUBSYS_FILES: { |
387 if (!file_system_init_) { | 400 if (!file_system_init_) { |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 | 742 |
730 // Finally, setup imports on the target so the interceptions can work. | 743 // Finally, setup imports on the target so the interceptions can work. |
731 return SetupNtdllImports(target); | 744 return SetupNtdllImports(target); |
732 } | 745 } |
733 | 746 |
734 bool PolicyBase::SetupHandleCloser(TargetProcess* target) { | 747 bool PolicyBase::SetupHandleCloser(TargetProcess* target) { |
735 return handle_closer_.InitializeTargetHandles(target); | 748 return handle_closer_.InitializeTargetHandles(target); |
736 } | 749 } |
737 | 750 |
738 } // namespace sandbox | 751 } // namespace sandbox |
OLD | NEW |