OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "sandbox/win/src/filesystem_policy.h" | 7 #include "sandbox/win/src/filesystem_policy.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/win/scoped_handle.h" | 10 #include "base/win/scoped_handle.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 if (!sandbox::SameObject(local_handle, obj_attributes->ObjectName->Buffer)) { | 43 if (!sandbox::SameObject(local_handle, obj_attributes->ObjectName->Buffer)) { |
44 // The handle points somewhere else. Fail the operation. | 44 // The handle points somewhere else. Fail the operation. |
45 ::CloseHandle(local_handle); | 45 ::CloseHandle(local_handle); |
46 return STATUS_ACCESS_DENIED; | 46 return STATUS_ACCESS_DENIED; |
47 } | 47 } |
48 | 48 |
49 if (!::DuplicateHandle(::GetCurrentProcess(), local_handle, | 49 if (!::DuplicateHandle(::GetCurrentProcess(), local_handle, |
50 target_process, target_file_handle, 0, FALSE, | 50 target_process, target_file_handle, 0, FALSE, |
51 DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { | 51 DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS)) { |
52 ::CloseHandle(local_handle); | |
53 return STATUS_ACCESS_DENIED; | 52 return STATUS_ACCESS_DENIED; |
54 } | 53 } |
55 return STATUS_SUCCESS; | 54 return STATUS_SUCCESS; |
56 } | 55 } |
57 | 56 |
58 } // namespace. | 57 } // namespace. |
59 | 58 |
60 namespace sandbox { | 59 namespace sandbox { |
61 | 60 |
62 bool FileSystemPolicy::GenerateRules(const wchar_t* name, | 61 bool FileSystemPolicy::GenerateRules(const wchar_t* name, |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 377 |
379 bool reparsed = false; | 378 bool reparsed = false; |
380 if (ERROR_SUCCESS != IsReparsePoint(*new_path, &reparsed)) | 379 if (ERROR_SUCCESS != IsReparsePoint(*new_path, &reparsed)) |
381 return false; | 380 return false; |
382 | 381 |
383 // We can't process reparsed file. | 382 // We can't process reparsed file. |
384 return !reparsed; | 383 return !reparsed; |
385 } | 384 } |
386 | 385 |
387 } // namespace sandbox | 386 } // namespace sandbox |
OLD | NEW |