summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 01:25:11 +0000
committerjschuh@chromium.org <jschuh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 01:25:11 +0000
commit5a3a81eba38162731c5b4a61cf6900bf89ac3a8b (patch)
treeeb90c36c85947cfb8ae5071e7c1178d41e7212a1
parent740a197e6a9964db73dab0e19ecae887adc23b15 (diff)
downloadchromium_src-5a3a81eba38162731c5b4a61cf6900bf89ac3a8b.zip
chromium_src-5a3a81eba38162731c5b4a61cf6900bf89ac3a8b.tar.gz
chromium_src-5a3a81eba38162731c5b4a61cf6900bf89ac3a8b.tar.bz2
Use the same handle for checking and duplicating in DuplicateHandleProxy
BUG=338524 R=cpu@chromium.org NOTRY=true Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=250744 Review URL: https://codereview.chromium.org/136543008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250890 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--sandbox/win/src/handle_dispatcher.cc6
-rw-r--r--sandbox/win/src/handle_policy.cc3
-rw-r--r--sandbox/win/src/handle_policy.h1
3 files changed, 4 insertions, 6 deletions
diff --git a/sandbox/win/src/handle_dispatcher.cc b/sandbox/win/src/handle_dispatcher.cc
index 26b8fc3..6acb6f9 100644
--- a/sandbox/win/src/handle_dispatcher.cc
+++ b/sandbox/win/src/handle_dispatcher.cc
@@ -53,10 +53,11 @@ bool HandleDispatcher::DuplicateHandleProxy(IPCInfo* ipc,
HANDLE handle_temp;
if (!::DuplicateHandle(ipc->client_info->process, source_handle,
::GetCurrentProcess(), &handle_temp,
- 0, FALSE, DUPLICATE_SAME_ACCESS)) {
+ 0, FALSE, DUPLICATE_SAME_ACCESS | options)) {
ipc->return_info.win32_result = ::GetLastError();
return false;
}
+ options &= ~DUPLICATE_CLOSE_SOURCE;
base::win::ScopedHandle handle(handle_temp);
// Get the object type (32 characters is safe; current max is 14).
@@ -78,8 +79,7 @@ bool HandleDispatcher::DuplicateHandleProxy(IPCInfo* ipc,
EvalResult eval = policy_base_->EvalPolicy(IPC_DUPLICATEHANDLEPROXY_TAG,
params.GetBase());
ipc->return_info.win32_result =
- HandlePolicy::DuplicateHandleProxyAction(eval, *ipc->client_info,
- source_handle,
+ HandlePolicy::DuplicateHandleProxyAction(eval, handle,
target_process_id,
&ipc->return_info.handle,
desired_access, options);
diff --git a/sandbox/win/src/handle_policy.cc b/sandbox/win/src/handle_policy.cc
index 718376e..f5f1c27 100644
--- a/sandbox/win/src/handle_policy.cc
+++ b/sandbox/win/src/handle_policy.cc
@@ -52,7 +52,6 @@ bool HandlePolicy::GenerateRules(const wchar_t* type_name,
}
DWORD HandlePolicy::DuplicateHandleProxyAction(EvalResult eval_result,
- const ClientInfo& client_info,
HANDLE source_handle,
DWORD target_process_id,
HANDLE* target_handle,
@@ -81,7 +80,7 @@ DWORD HandlePolicy::DuplicateHandleProxyAction(EvalResult eval_result,
HANDLE target_process = remote_target_process.IsValid() ?
remote_target_process.Get() : ::GetCurrentProcess();
DWORD result = ERROR_SUCCESS;
- if (!::DuplicateHandle(client_info.process, source_handle, target_process,
+ if (!::DuplicateHandle(::GetCurrentProcess(), source_handle, target_process,
target_handle, desired_access, FALSE,
options)) {
return ::GetLastError();
diff --git a/sandbox/win/src/handle_policy.h b/sandbox/win/src/handle_policy.h
index d91a039..ffe54b8 100644
--- a/sandbox/win/src/handle_policy.h
+++ b/sandbox/win/src/handle_policy.h
@@ -27,7 +27,6 @@ class HandlePolicy {
// Processes a 'TargetPolicy::DuplicateHandle()' request from the target.
static DWORD DuplicateHandleProxyAction(EvalResult eval_result,
- const ClientInfo& client_info,
HANDLE source_handle,
DWORD target_process_id,
HANDLE* target_handle,