[pywin32-checkins] pywin32/win32/src PySECURITY_DESCRIPTOR.cpp,1.13,1.14
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2005-01-19 21:16:29
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6420/win32/src Modified Files: PySECURITY_DESCRIPTOR.cpp Log Message: Check that a security descriptor created from a buffer is self-relative Index: PySECURITY_DESCRIPTOR.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PySECURITY_DESCRIPTOR.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PySECURITY_DESCRIPTOR.cpp 8 Jan 2005 03:14:36 -0000 1.13 --- PySECURITY_DESCRIPTOR.cpp 19 Jan 2005 21:16:20 -0000 1.14 *************** *** 67,70 **** --- 67,83 ---- }; + BOOL _IsSelfRelative(PSECURITY_DESCRIPTOR psd) + { + // check if SD is relative or absolute + SECURITY_DESCRIPTOR_CONTROL sdc; + DWORD revision; + if (!::GetSecurityDescriptorControl(psd, &sdc, &revision)){ + return NULL; + } + if (sdc&SE_SELF_RELATIVE) + return TRUE; + return FALSE; + } + // @pymethod <o PySECURITY_DESCRIPTOR>|pywintypes|SECURITY_DESCRIPTOR|Creates a new SECURITY_DESCRIPTOR object PyObject *PyWinMethod_NewSECURITY_DESCRIPTOR(PyObject *self, PyObject *args) *************** *** 88,91 **** --- 101,108 ---- return NULL; } + if (!_IsSelfRelative(psd)){ + PyErr_SetString(PyExc_ValueError,"Security descriptor created from a buffer must be self relative"); + return NULL; + } return new PySECURITY_DESCRIPTOR(psd); } *************** *** 113,129 **** } - BOOL _IsSelfRelative(PSECURITY_DESCRIPTOR psd) - { - // check if SD is relative or absolute - SECURITY_DESCRIPTOR_CONTROL sdc; - DWORD revision; - if (!::GetSecurityDescriptorControl(psd, &sdc, &revision)){ - return NULL; - } - if (sdc&SE_SELF_RELATIVE) - return TRUE; - return FALSE; - } - // @pymethod |PySECURITY_DESCRIPTOR|IsSelfRelative|Returns 1 if security descriptor is self relative, 0 if absolute PyObject *PySECURITY_DESCRIPTOR::IsSelfRelative(PyObject *self, PyObject *args) --- 130,133 ---- |