I’m trying to verify that user has access to the machine.
I’m trying to use LogonUser as described here:
logging.info("checking credentials")
try:
win32security.LogonUser (
name,
domain,
password,
win32security.LOGON32_LOGON_NETWORK,
win32security.LOGON32_PROVIDER_DEFAULT
)
except win32security.error, e:
logging.warn(e)
raise e
else:
logging.info('pass')
However whatever I put as name or password (say domain = None) it always PASSES.
Am I missing something?
UPDATE: to reproduce:
import win32security
print win32security.LogonUser (
"asdasdasdasdfagf",
None,
"asdasdasdasdasda",
win32security.LOGON32_LOGON_NETWORK,
win32security.LOGON32_PROVIDER_DEFAULT
)
output:
<PyHANDLE at 34009576 (276)>
Though I doubt it’s actually the answer you are after, the only difference I can see between what you do to test, and the way I successfully in apps I use, is the use of the
LOGON32_LOGON_NETWORKflag instead of theLOGON32_LOGON_INTERACTIVEflag. For what our products do though, we have specific requirements for the Desktop Interactivity, and I doubt it’s actually a change that’ll affect your results.A domain value of
Noneshould look to the current domain, so if you’re really and truly able to run this code with any username and password on your system, then either your system has problems, or your Domain has problems.