subprocess and win32security.ImpersonateLoggedOnUser

Emin.shopper Martinian.shopper emin.shopper at gmail.com
Mon Jun 1 09:45:37 EDT 2009


Thanks. But how do I fix this so that the subprocess does inherit the
impersonated stuff?

On Mon, Jun 1, 2009 at 9:38 AM, Tim Golden <mail at timgolden.me.uk> wrote:
> Emin.shopper Martinian.shopper wrote:
>>
>> Dear Experts,
>>
>> I am having some issues with the subprocess module and how it
>> interacts with win32security.ImpersonateLoggedOnUser. Specifically, I
>> use the latter to change users but the new user does not seem to be
>> properly inherited when I spawn further subprocesses.
>>
>> I am doing something like
>>
>>    import win32security, win32con
>>    handle = win32security.LogonUser(
>>        user,domain,password,win32con.LOGON32_LOGON_INTERACTIVE,
>>        win32con.LOGON32_PROVIDER_DEFAULT)
>>
>>    win32security.ImpersonateLoggedOnUser(handle)
>>
>> Then spawning subprocesses but the subprocesses cannot read the same
>> UNC paths that that the parent could.
>
> http://support.microsoft.com/kb/111545
>
> """
> Even if a thread in the parent process impersonates a client and then
> creates a new process, the new process still runs under the parent's
> original security context and not the under the impersonation token. """
>
> TJG
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list