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

Unified Diff: third_party/psutil/psutil/arch/mswindows/security.c

Issue 8159001: Update third_party/psutil and fix the licence issue with it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove the suppression and unnecessary files. Created 9 years, 2 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: third_party/psutil/psutil/arch/mswindows/security.c
diff --git a/third_party/psutil/psutil/arch/mswindows/security.c b/third_party/psutil/psutil/arch/mswindows/security.c
index ee6ff9d0fce1a86c88a2711b8a99d09e18373e51..5a07df2f5553722448e8688d99bdc3d4f71435c6 100644
--- a/third_party/psutil/psutil/arch/mswindows/security.c
+++ b/third_party/psutil/psutil/arch/mswindows/security.c
@@ -1,5 +1,9 @@
/*
- * $Id: security.c 772 2010-11-03 13:51:11Z g.rodola $
+ * $Id: security.c 1142 2011-10-05 18:45:49Z g.rodola $
+ *
+ * Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
*
* Security related functions for Windows platform (Set privileges such as
* SeDebug), as well as security helper functions.
@@ -26,7 +30,7 @@ token_from_handle(HANDLE hProcess) {
/*
* http://www.ddj.com/windows/184405986
*
- * there’s a way to determine whether we’re running under the Local System
+ * There's a way to determine whether we're running under the Local System
* account. However (you guessed it), we have to call more Win32 functions to
* determine this. Backing up through the code listing, we need to make another
* call to GetTokenInformation, but instead of passing through the TOKEN_USER
@@ -171,7 +175,7 @@ int SetSeDebug()
){
if (GetLastError() == ERROR_NO_TOKEN){
if (!ImpersonateSelf(SecurityImpersonation)){
- //Log2File("Error setting impersonation [SetSeDebug()]", L_DEBUG);
+ CloseHandle(hToken);
return 0;
}
if (!OpenThreadToken(GetCurrentThread(),
@@ -179,7 +183,8 @@ int SetSeDebug()
FALSE,
&hToken)
){
- //Log2File("Error Opening Thread Token", L_DEBUG);
+ RevertToSelf();
+ CloseHandle(hToken);
return 0;
}
}
@@ -187,10 +192,12 @@ int SetSeDebug()
// enable SeDebugPrivilege (open any process)
if (! SetPrivilege(hToken, SE_DEBUG_NAME, TRUE)){
- //Log2File("Error setting SeDebug Privilege [SetPrivilege()]", L_WARN);
+ RevertToSelf();
+ CloseHandle(hToken);
return 0;
}
+ RevertToSelf();
CloseHandle(hToken);
return 1;
}
« no previous file with comments | « third_party/psutil/psutil/arch/mswindows/security.h ('k') | third_party/psutil/psutil/arch/osx/process_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698