我正在尝试验证用户是否有权访问该机器。
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')
但是,无论我输入什么name
或password
(比如说domain = None
)它总是通过。
我错过了什么吗?
更新:重现:
import win32security
print win32security.LogonUser (
"asdasdasdasdfagf",
None,
"asdasdasdasdasda",
win32security.LOGON32_LOGON_NETWORK,
win32security.LOGON32_PROVIDER_DEFAULT
)
输出:
<PyHANDLE at 34009576 (276)>