Fixed operations for getidle

This commit is contained in:
Adolfo Gómez García 2019-12-04 15:00:10 +01:00
parent 5953a67d3a
commit 67feb4aefa
2 changed files with 7 additions and 3 deletions

View File

@ -215,8 +215,9 @@ def getIdleDuration():
return 0
# if lastInputInfo.dwTime > 1000000000: # Value toooo high, nonsense...
# return 0
millis = ctypes.windll.kernel32.GetTickCount() - lastInputInfo.dwTime # @UndefinedVariable
if millis < 0 or millis > 1000000000:
current = ctypes.c_uint(ctypes.windll.kernel32.GetTickCount())
millis = current.value - lastInputInfo.dwTime # @UndefinedVariable
if millis < 0:
return 0
return millis / 1000.0
except Exception as e:

View File

@ -107,12 +107,15 @@ class WinDomainOsManager(WindowsOsManager):
_str = ''
try:
uri = "%s://%s:%d" % ('ldap', server[0], server[1])
uri = "%s://%s" % ('ldaps', server[0])
logger.debug('URI: {0}'.format(uri))
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER) # Disable certificate check
l = ldap.initialize(uri=uri)
l.set_option(ldap.OPT_REFERRALS, 0)
# l.set_option(ldap.OPT_PROTOCOL_VERSION, 3)
# l.set_option(ldap.OPT_X_TLS,ldap.OPT_X_TLS_DEMAND)
# l.set_option( ldap.OPT_X_TLS_DEMAND, True )
l.network_timeout = l.timeout = 5
l.protocol_version = ldap.VERSION3