Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2978)

Unified Diff: sandbox/win/src/sandbox_policy_base.cc

Issue 1232963002: Sandbox: Make CreateRestrictedToken return a ScopedHandle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sandbox/win/src/sandbox_policy_base.cc
diff --git a/sandbox/win/src/sandbox_policy_base.cc b/sandbox/win/src/sandbox_policy_base.cc
index fcc4a7c651acd5f600279d2e2290f77bf05aa0c9..77266db4afcbddbbd72c359187323f0acc35460c 100644
--- a/sandbox/win/src/sandbox_policy_base.cc
+++ b/sandbox/win/src/sandbox_policy_base.cc
@@ -550,14 +550,11 @@ ResultCode PolicyBase::MakeTokens(base::win::ScopedHandle* initial,
// Create the 'naked' token. This will be the permanent token associated
// with the process and therefore with any thread that is not impersonating.
- HANDLE temp_handle;
- DWORD result = CreateRestrictedToken(&temp_handle, lockdown_level_,
+ DWORD result = CreateRestrictedToken(lockdown, lockdown_level_,
integrity_level_, PRIMARY);
if (ERROR_SUCCESS != result)
return SBOX_ERROR_GENERIC;
- lockdown->Set(temp_handle);
-
// If we're launching on the alternate desktop we need to make sure the
// integrity label on the object is no higher than the sandboxed process's
// integrity level. So, we lower the label on the desktop process if it's
@@ -622,12 +619,11 @@ ResultCode PolicyBase::MakeTokens(base::win::ScopedHandle* initial,
// Create the 'better' token. We use this token as the one that the main
// thread uses when booting up the process. It should contain most of
// what we need (before reaching main( ))
- result = CreateRestrictedToken(&temp_handle, initial_level_,
+ result = CreateRestrictedToken(initial, initial_level_,
integrity_level_, IMPERSONATION);
if (ERROR_SUCCESS != result)
return SBOX_ERROR_GENERIC;
- initial->Set(temp_handle);
return SBOX_ALL_OK;
}

Powered by Google App Engine
This is Rietveld 408576698