| OLD | NEW |
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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/filesystem_dispatcher.h" | 5 #include "sandbox/win/src/filesystem_dispatcher.h" |
| 6 | 6 |
| 7 #include "sandbox/win/src/crosscall_client.h" | 7 #include "sandbox/win/src/crosscall_client.h" |
| 8 #include "sandbox/win/src/filesystem_interception.h" | 8 #include "sandbox/win/src/filesystem_interception.h" |
| 9 #include "sandbox/win/src/filesystem_policy.h" | 9 #include "sandbox/win/src/filesystem_policy.h" |
| 10 #include "sandbox/win/src/interception.h" | 10 #include "sandbox/win/src/interception.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 case IPC_NTSETINFO_RENAME_TAG: | 77 case IPC_NTSETINFO_RENAME_TAG: |
| 78 return INTERCEPT_NT(manager, NtSetInformationFile, SET_INFO_FILE_ID, 24); | 78 return INTERCEPT_NT(manager, NtSetInformationFile, SET_INFO_FILE_ID, 24); |
| 79 | 79 |
| 80 default: | 80 default: |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 } | 83 } |
| 84 | 84 |
| 85 bool FilesystemDispatcher::NtCreateFile( | 85 bool FilesystemDispatcher::NtCreateFile( |
| 86 IPCInfo* ipc, std::wstring* name, DWORD attributes, DWORD desired_access, | 86 IPCInfo* ipc, base::string16* name, DWORD attributes, DWORD desired_access, |
| 87 DWORD file_attributes, DWORD share_access, DWORD create_disposition, | 87 DWORD file_attributes, DWORD share_access, DWORD create_disposition, |
| 88 DWORD create_options) { | 88 DWORD create_options) { |
| 89 if (!PreProcessName(*name, name)) { | 89 if (!PreProcessName(*name, name)) { |
| 90 // The path requested might contain a reparse point. | 90 // The path requested might contain a reparse point. |
| 91 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; | 91 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; |
| 92 return true; | 92 return true; |
| 93 } | 93 } |
| 94 | 94 |
| 95 const wchar_t* filename = name->c_str(); | 95 const wchar_t* filename = name->c_str(); |
| 96 | 96 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 119 return true; | 119 return true; |
| 120 } | 120 } |
| 121 // Return operation status on the IPC. | 121 // Return operation status on the IPC. |
| 122 ipc->return_info.extended[0].ulong_ptr = io_information; | 122 ipc->return_info.extended[0].ulong_ptr = io_information; |
| 123 ipc->return_info.nt_status = nt_status; | 123 ipc->return_info.nt_status = nt_status; |
| 124 ipc->return_info.handle = handle; | 124 ipc->return_info.handle = handle; |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 | 127 |
| 128 bool FilesystemDispatcher::NtOpenFile( | 128 bool FilesystemDispatcher::NtOpenFile( |
| 129 IPCInfo* ipc, std::wstring* name, DWORD attributes, DWORD desired_access, | 129 IPCInfo* ipc, base::string16* name, DWORD attributes, DWORD desired_access, |
| 130 DWORD share_access, DWORD open_options) { | 130 DWORD share_access, DWORD open_options) { |
| 131 if (!PreProcessName(*name, name)) { | 131 if (!PreProcessName(*name, name)) { |
| 132 // The path requested might contain a reparse point. | 132 // The path requested might contain a reparse point. |
| 133 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; | 133 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; |
| 134 return true; | 134 return true; |
| 135 } | 135 } |
| 136 | 136 |
| 137 const wchar_t* filename = name->c_str(); | 137 const wchar_t* filename = name->c_str(); |
| 138 | 138 |
| 139 ULONG broker = TRUE; | 139 ULONG broker = TRUE; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 159 return true; | 159 return true; |
| 160 } | 160 } |
| 161 // Return operation status on the IPC. | 161 // Return operation status on the IPC. |
| 162 ipc->return_info.extended[0].ulong_ptr = io_information; | 162 ipc->return_info.extended[0].ulong_ptr = io_information; |
| 163 ipc->return_info.nt_status = nt_status; | 163 ipc->return_info.nt_status = nt_status; |
| 164 ipc->return_info.handle = handle; | 164 ipc->return_info.handle = handle; |
| 165 return true; | 165 return true; |
| 166 } | 166 } |
| 167 | 167 |
| 168 bool FilesystemDispatcher::NtQueryAttributesFile( | 168 bool FilesystemDispatcher::NtQueryAttributesFile( |
| 169 IPCInfo* ipc, std::wstring* name, DWORD attributes, CountedBuffer* info) { | 169 IPCInfo* ipc, base::string16* name, DWORD attributes, CountedBuffer* info) { |
| 170 if (sizeof(FILE_BASIC_INFORMATION) != info->Size()) | 170 if (sizeof(FILE_BASIC_INFORMATION) != info->Size()) |
| 171 return false; | 171 return false; |
| 172 | 172 |
| 173 if (!PreProcessName(*name, name)) { | 173 if (!PreProcessName(*name, name)) { |
| 174 // The path requested might contain a reparse point. | 174 // The path requested might contain a reparse point. |
| 175 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; | 175 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; |
| 176 return true; | 176 return true; |
| 177 } | 177 } |
| 178 | 178 |
| 179 ULONG broker = TRUE; | 179 ULONG broker = TRUE; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 197 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; | 197 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; |
| 198 return true; | 198 return true; |
| 199 } | 199 } |
| 200 | 200 |
| 201 // Return operation status on the IPC. | 201 // Return operation status on the IPC. |
| 202 ipc->return_info.nt_status = nt_status; | 202 ipc->return_info.nt_status = nt_status; |
| 203 return true; | 203 return true; |
| 204 } | 204 } |
| 205 | 205 |
| 206 bool FilesystemDispatcher::NtQueryFullAttributesFile( | 206 bool FilesystemDispatcher::NtQueryFullAttributesFile( |
| 207 IPCInfo* ipc, std::wstring* name, DWORD attributes, CountedBuffer* info) { | 207 IPCInfo* ipc, base::string16* name, DWORD attributes, CountedBuffer* info) { |
| 208 if (sizeof(FILE_NETWORK_OPEN_INFORMATION) != info->Size()) | 208 if (sizeof(FILE_NETWORK_OPEN_INFORMATION) != info->Size()) |
| 209 return false; | 209 return false; |
| 210 | 210 |
| 211 if (!PreProcessName(*name, name)) { | 211 if (!PreProcessName(*name, name)) { |
| 212 // The path requested might contain a reparse point. | 212 // The path requested might contain a reparse point. |
| 213 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; | 213 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; |
| 214 return true; | 214 return true; |
| 215 } | 215 } |
| 216 | 216 |
| 217 ULONG broker = TRUE; | 217 ULONG broker = TRUE; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 return false; | 250 return false; |
| 251 if (length != info->Size()) | 251 if (length != info->Size()) |
| 252 return false; | 252 return false; |
| 253 | 253 |
| 254 FILE_RENAME_INFORMATION* rename_info = | 254 FILE_RENAME_INFORMATION* rename_info = |
| 255 reinterpret_cast<FILE_RENAME_INFORMATION*>(info->Buffer()); | 255 reinterpret_cast<FILE_RENAME_INFORMATION*>(info->Buffer()); |
| 256 | 256 |
| 257 if (!IsSupportedRenameCall(rename_info, length, info_class)) | 257 if (!IsSupportedRenameCall(rename_info, length, info_class)) |
| 258 return false; | 258 return false; |
| 259 | 259 |
| 260 std::wstring name; | 260 base::string16 name; |
| 261 name.assign(rename_info->FileName, rename_info->FileNameLength / | 261 name.assign(rename_info->FileName, rename_info->FileNameLength / |
| 262 sizeof(rename_info->FileName[0])); | 262 sizeof(rename_info->FileName[0])); |
| 263 if (!PreProcessName(name, &name)) { | 263 if (!PreProcessName(name, &name)) { |
| 264 // The path requested might contain a reparse point. | 264 // The path requested might contain a reparse point. |
| 265 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; | 265 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; |
| 266 return true; | 266 return true; |
| 267 } | 267 } |
| 268 | 268 |
| 269 ULONG broker = TRUE; | 269 ULONG broker = TRUE; |
| 270 const wchar_t* filename = name.c_str(); | 270 const wchar_t* filename = name.c_str(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 288 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; | 288 ipc->return_info.nt_status = STATUS_ACCESS_DENIED; |
| 289 return true; | 289 return true; |
| 290 } | 290 } |
| 291 | 291 |
| 292 // Return operation status on the IPC. | 292 // Return operation status on the IPC. |
| 293 ipc->return_info.nt_status = nt_status; | 293 ipc->return_info.nt_status = nt_status; |
| 294 return true; | 294 return true; |
| 295 } | 295 } |
| 296 | 296 |
| 297 } // namespace sandbox | 297 } // namespace sandbox |
| OLD | NEW |