Hi,
I'm trying to write a plug-in for a ftp server of mine to permit the
integration with accounts defined on the Windows system.
What I basically need is impersonating a user, execute e filesystem
call (e.g. create a directory via os.mkdir()) and then switch back to
the original user (Administrator).
I wrote down this simple class which seems to fit pretty well for my purposes:

class WinNTAuthorizer:

    def impersonate_user(self, username, password):
        self.impersonated_user_handler = win32security.LogonUser(
                   username,
                   None,
                   password,
                   win32con.LOGON32_LOGON_INTERACTIVE,
                   win32con.LOGON32_PROVIDER_DEFAULT)
        win32security.ImpersonateLoggedOnUser(self.impersonated_user_handler)

    def terminate_impersonation(self):
        win32security.RevertToSelf()
        self.impersonated_user_handler.Close()


What I need now is impersonating the Guest user to handle the
anonymous logins (which it's exactly what IIS FTPd does) but I don't
know how to do it.
Does Guest account has a password or do I have to use something
different than LogonUser to manage it?
Could someone point me in the right direction?

Thanks in advance.


--- Giampaolo
http://code.google.com/p/pyftpdlib
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to