[python-win32] Re: Using win32security from IIS/CGI script

Roger Upole rwupole at msn.com
Sun Oct 16 16:51:54 CEST 2005


> Hi,
> 
> I'm trying to call the following win3security API as part of a CGI
> script being served up by IIS6 on W2k3.
> 
> secDes = win32security.GetNamedSecurityInfo(filename, \
> win32security.SE_FILE_OBJECT, \
> win32security.DACL_SECURITY_INFORMATION \
> win32security.GROUP_SECURITY_INFORMATION \ 
> win32security.OWNER_SECURITY_INFORMATION)
> 
> I have got the script running from a secure page (NT Auth) in the
> context of the user that is calling the script through IIS but I am
> getting an access denied error, as indicated below
> 
> E:\Inetpub\tools\AccessList.py in
> getAceList(filename=r'\\server\somefile') 
> secDes = win32security.GetNamedSecurityInfo(filename, \
> win32security.SE_FILE_OBJECT, \
> win32security.DACL_SECURITY_INFORMATION \
> | win32security.GROUP_SECURITY_INFORMATION \
> | win32security.OWNER_SECURITY_INFORMATION)
> 
> global win32security = <module 'win32security' from 'C:\Program
> Files\Python24\lib\site-packages\win32\win32security.pyd'>,
> win32security.DACL_SECURITY_INFORMATION = 4,
> win32security.GROUP_SECURITY_INFORMATION = 2,
> win32security.OWNER_SECURITY_INFORMATION = 1 
> 
> error: (5, 'GetNamedSecurityInfo', 'Access is denied.') 
> args = (5, 'GetNamedSecurityInfo', 'Access is denied.') 
> 
> I can confirm that it is running in the context of me as a user and
> This works ok if I run it interactively from PythonWin directly on the
> server under my account.
> 
> Can anyone point me in the right direction?
> 
> Thanks
> Peter

Can you do a normal open on the file, or is just the security
functions that fail ?  Also, how are you verifying that the
script is running as you when run under CGI?
Does win32api.GetUserName() return your user id ?

        Roger




More information about the Python-win32 mailing list