[pywin32-checkins] pywin32/win32/src win32security.i,1.42,1.43
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2007-08-02 04:35:13
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32119/win32/src Modified Files: win32security.i Log Message: Add IsTokenRestricted Index: win32security.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32security.i,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** win32security.i 1 Aug 2007 19:14:09 -0000 1.42 --- win32security.i 2 Aug 2007 04:35:14 -0000 1.43 *************** *** 72,75 **** --- 72,77 ---- typedef BOOL (WINAPI *ImpersonateAnonymousTokenfunc)(HANDLE); static ImpersonateAnonymousTokenfunc pfnImpersonateAnonymousToken=NULL; + typedef BOOL (WINAPI *IsTokenRestrictedfunc)(HANDLE); + static IsTokenRestrictedfunc pfnIsTokenRestricted = NULL; typedef PSecurityFunctionTableW (SEC_ENTRY *InitSecurityInterfacefunc)(void); *************** *** 835,838 **** --- 837,841 ---- loadapifunc("ConvertStringSecurityDescriptorToSecurityDescriptorW", advapi32_dll); pfnImpersonateAnonymousToken=(ImpersonateAnonymousTokenfunc)loadapifunc("ImpersonateAnonymousToken", advapi32_dll); + pfnIsTokenRestricted=(IsTokenRestrictedfunc)loadapifunc("IsTokenRestricted", advapi32_dll); // Load InitSecurityInterface, which returns a table of pointers to the SSPI functions so they don't all have to be *************** *** 988,994 **** ); - // @pyswig |ImpersonateAnonymousToken|Cause a thread to act in the security context of an anonymous token %native(ImpersonateAnonymousToken) PyImpersonateAnonymousToken; %{ static PyObject * PyImpersonateAnonymousToken(PyObject *self, PyObject *args) { --- 991,998 ---- ); %native(ImpersonateAnonymousToken) PyImpersonateAnonymousToken; + %native(IsTokenRestricted) PyIsTokenRestricted; %{ + // @pyswig |ImpersonateAnonymousToken|Cause a thread to act in the security context of an anonymous token static PyObject * PyImpersonateAnonymousToken(PyObject *self, PyObject *args) { *************** *** 1005,1008 **** --- 1009,1026 ---- return Py_None; } + + // @pyswig bool|IsTokenRestricted|Checks if a token contains restricted sids + static PyObject * PyIsTokenRestricted(PyObject *self, PyObject *args) + { + HANDLE th; // @pyparm <o PyHANDLE>|TokenHandle||Handle to an access token + PyObject *obth; + CHECK_PFN(IsTokenRestricted); + if (!PyArg_ParseTuple(args, "O:IsTokenRestricted", &obth)) + return NULL; + if (!PyWinObject_AsHANDLE(obth, &th)) + return NULL; + BOOL ret=(*pfnIsTokenRestricted)(th); + return PyBool_FromLong(ret); + } %} |