OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef SANDBOX_SRC_FILESYSTEM_POLICY_H__ | 5 #ifndef SANDBOX_SRC_FILESYSTEM_POLICY_H__ |
6 #define SANDBOX_SRC_FILESYSTEM_POLICY_H__ | 6 #define SANDBOX_SRC_FILESYSTEM_POLICY_H__ |
7 | 7 |
8 #include <stdint.h> | |
9 | |
10 #include <string> | 8 #include <string> |
11 | 9 |
| 10 #include "base/basictypes.h" |
12 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
13 #include "sandbox/win/src/crosscall_server.h" | 12 #include "sandbox/win/src/crosscall_server.h" |
14 #include "sandbox/win/src/nt_internals.h" | 13 #include "sandbox/win/src/nt_internals.h" |
15 #include "sandbox/win/src/policy_low_level.h" | 14 #include "sandbox/win/src/policy_low_level.h" |
16 #include "sandbox/win/src/sandbox_policy.h" | 15 #include "sandbox/win/src/sandbox_policy.h" |
17 | 16 |
18 namespace sandbox { | 17 namespace sandbox { |
19 | 18 |
20 enum EvalResult; | 19 enum EvalResult; |
21 | 20 |
(...skipping 12 matching lines...) Expand all Loading... |
34 // Add basic file system rules. | 33 // Add basic file system rules. |
35 static bool SetInitialRules(LowLevelPolicy* policy); | 34 static bool SetInitialRules(LowLevelPolicy* policy); |
36 | 35 |
37 // Performs the desired policy action on a create request with an | 36 // Performs the desired policy action on a create request with an |
38 // API that is compatible with the IPC-received parameters. | 37 // API that is compatible with the IPC-received parameters. |
39 // 'client_info' : the target process that is making the request. | 38 // 'client_info' : the target process that is making the request. |
40 // 'eval_result' : The desired policy action to accomplish. | 39 // 'eval_result' : The desired policy action to accomplish. |
41 // 'file' : The target file or directory. | 40 // 'file' : The target file or directory. |
42 static bool CreateFileAction(EvalResult eval_result, | 41 static bool CreateFileAction(EvalResult eval_result, |
43 const ClientInfo& client_info, | 42 const ClientInfo& client_info, |
44 const base::string16& file, | 43 const base::string16 &file, |
45 uint32_t attributes, | 44 uint32 attributes, |
46 uint32_t desired_access, | 45 uint32 desired_access, |
47 uint32_t file_attributes, | 46 uint32 file_attributes, |
48 uint32_t share_access, | 47 uint32 share_access, |
49 uint32_t create_disposition, | 48 uint32 create_disposition, |
50 uint32_t create_options, | 49 uint32 create_options, |
51 HANDLE* handle, | 50 HANDLE* handle, |
52 NTSTATUS* nt_status, | 51 NTSTATUS* nt_status, |
53 ULONG_PTR* io_information); | 52 ULONG_PTR* io_information); |
54 | 53 |
55 // Performs the desired policy action on an open request with an | 54 // Performs the desired policy action on an open request with an |
56 // API that is compatible with the IPC-received parameters. | 55 // API that is compatible with the IPC-received parameters. |
57 // 'client_info' : the target process that is making the request. | 56 // 'client_info' : the target process that is making the request. |
58 // 'eval_result' : The desired policy action to accomplish. | 57 // 'eval_result' : The desired policy action to accomplish. |
59 // 'file' : The target file or directory. | 58 // 'file' : The target file or directory. |
60 static bool OpenFileAction(EvalResult eval_result, | 59 static bool OpenFileAction(EvalResult eval_result, |
61 const ClientInfo& client_info, | 60 const ClientInfo& client_info, |
62 const base::string16& file, | 61 const base::string16 &file, |
63 uint32_t attributes, | 62 uint32 attributes, |
64 uint32_t desired_access, | 63 uint32 desired_access, |
65 uint32_t share_access, | 64 uint32 share_access, |
66 uint32_t open_options, | 65 uint32 open_options, |
67 HANDLE* handle, | 66 HANDLE* handle, |
68 NTSTATUS* nt_status, | 67 NTSTATUS* nt_status, |
69 ULONG_PTR* io_information); | 68 ULONG_PTR* io_information); |
70 | 69 |
71 // Performs the desired policy action on a query request with an | 70 // Performs the desired policy action on a query request with an |
72 // API that is compatible with the IPC-received parameters. | 71 // API that is compatible with the IPC-received parameters. |
73 static bool QueryAttributesFileAction(EvalResult eval_result, | 72 static bool QueryAttributesFileAction(EvalResult eval_result, |
74 const ClientInfo& client_info, | 73 const ClientInfo& client_info, |
75 const base::string16& file, | 74 const base::string16 &file, |
76 uint32_t attributes, | 75 uint32 attributes, |
77 FILE_BASIC_INFORMATION* file_info, | 76 FILE_BASIC_INFORMATION* file_info, |
78 NTSTATUS* nt_status); | 77 NTSTATUS* nt_status); |
79 | 78 |
80 // Performs the desired policy action on a query request with an | 79 // Performs the desired policy action on a query request with an |
81 // API that is compatible with the IPC-received parameters. | 80 // API that is compatible with the IPC-received parameters. |
82 static bool QueryFullAttributesFileAction( | 81 static bool QueryFullAttributesFileAction( |
83 EvalResult eval_result, | 82 EvalResult eval_result, |
84 const ClientInfo& client_info, | 83 const ClientInfo& client_info, |
85 const base::string16& file, | 84 const base::string16 &file, |
86 uint32_t attributes, | 85 uint32 attributes, |
87 FILE_NETWORK_OPEN_INFORMATION* file_info, | 86 FILE_NETWORK_OPEN_INFORMATION* file_info, |
88 NTSTATUS* nt_status); | 87 NTSTATUS* nt_status); |
89 | 88 |
90 // Performs the desired policy action on a set_info request with an | 89 // Performs the desired policy action on a set_info request with an |
91 // API that is compatible with the IPC-received parameters. | 90 // API that is compatible with the IPC-received parameters. |
92 static bool SetInformationFileAction(EvalResult eval_result, | 91 static bool SetInformationFileAction(EvalResult eval_result, |
93 const ClientInfo& client_info, | 92 const ClientInfo& client_info, |
94 HANDLE target_file_handle, | 93 HANDLE target_file_handle, |
95 void* file_info, | 94 void* file_info, |
96 uint32_t length, | 95 uint32 length, |
97 uint32_t info_class, | 96 uint32 info_class, |
98 IO_STATUS_BLOCK* io_block, | 97 IO_STATUS_BLOCK* io_block, |
99 NTSTATUS* nt_status); | 98 NTSTATUS* nt_status); |
100 }; | 99 }; |
101 | 100 |
102 // Expands the path and check if it's a reparse point. Returns false if the path | 101 // Expands the path and check if it's a reparse point. Returns false if the path |
103 // cannot be trusted. | 102 // cannot be trusted. |
104 bool PreProcessName(base::string16* path); | 103 bool PreProcessName(base::string16* path); |
105 | 104 |
106 // Corrects global paths to have a correctly escaped NT prefix at the | 105 // Corrects global paths to have a correctly escaped NT prefix at the |
107 // beginning. If the name has no NT prefix (either normal or escaped) | 106 // beginning. If the name has no NT prefix (either normal or escaped) |
108 // add the escaped form to the string | 107 // add the escaped form to the string |
109 base::string16 FixNTPrefixForMatch(const base::string16& name); | 108 base::string16 FixNTPrefixForMatch(const base::string16& name); |
110 | 109 |
111 } // namespace sandbox | 110 } // namespace sandbox |
112 | 111 |
113 #endif // SANDBOX_SRC_FILESYSTEM_POLICY_H__ | 112 #endif // SANDBOX_SRC_FILESYSTEM_POLICY_H__ |
OLD | NEW |