mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-14 19:24:27 +03:00
Now AD search on full path instead of OU
This commit is contained in:
parent
912c4d3d05
commit
5b7d02964d
@ -122,9 +122,9 @@ class WinDomainOsManager(WindowsOsManager):
|
|||||||
return obj['dn'] # Returns the DN
|
return obj['dn'] # Returns the DN
|
||||||
|
|
||||||
def __getMachine(self, l, machineName):
|
def __getMachine(self, l, machineName):
|
||||||
if self._ou:
|
# if self._ou:
|
||||||
base = self._ou
|
# base = self._ou
|
||||||
else:
|
# else:
|
||||||
base = ','.join(['DC=' + i for i in self._domain.split('.')])
|
base = ','.join(['DC=' + i for i in self._domain.split('.')])
|
||||||
|
|
||||||
fltr = '(&(objectClass=computer)(sAMAccountName={}$))'.format(ldaputil.escape(machineName))
|
fltr = '(&(objectClass=computer)(sAMAccountName={}$))'.format(ldaputil.escape(machineName))
|
||||||
@ -160,13 +160,13 @@ class WinDomainOsManager(WindowsOsManager):
|
|||||||
# #
|
# #
|
||||||
# Direct LDAP operation "modify", maybe this need to be added to ldaputil? :)
|
# Direct LDAP operation "modify", maybe this need to be added to ldaputil? :)
|
||||||
# #
|
# #
|
||||||
l.modify_s(group, ((ldap.MOD_ADD, 'member', machine),))
|
l.modify_s(group, ((ldap.MOD_ADD, 'member', machine),)) # @UndefinedVariable
|
||||||
error = None
|
error = None
|
||||||
break
|
break
|
||||||
except dns.resolver.NXDOMAIN: # No domain found, log it and pass
|
except dns.resolver.NXDOMAIN: # No domain found, log it and pass
|
||||||
logger.warning('Could not find _ldap._tcp.' + self._domain)
|
logger.warning('Could not find _ldap._tcp.' + self._domain)
|
||||||
log.doLog(userService, log.WARN, "Could not remove machine from domain (_ldap._tcp.{0} not found)".format(self._domain), log.OSMANAGER)
|
log.doLog(userService, log.WARN, "Could not remove machine from domain (_ldap._tcp.{0} not found)".format(self._domain), log.OSMANAGER)
|
||||||
except ldap.ALREADY_EXISTS:
|
except ldap.ALREADY_EXISTS: # @UndefinedVariable
|
||||||
# Already added this machine to this group, pass
|
# Already added this machine to this group, pass
|
||||||
error = None
|
error = None
|
||||||
break
|
break
|
||||||
@ -230,7 +230,7 @@ class WinDomainOsManager(WindowsOsManager):
|
|||||||
return [False, str(e)]
|
return [False, str(e)]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
l.search_st(self._ou, ldap.SCOPE_BASE)
|
l.search_st(self._ou, ldap.SCOPE_BASE) # @UndefinedVariable
|
||||||
except ldaputil.LDAPError as e:
|
except ldaputil.LDAPError as e:
|
||||||
return _('Check error: {0}').format(self.__getLdapError(e))
|
return _('Check error: {0}').format(self.__getLdapError(e))
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ class WinDomainOsManager(WindowsOsManager):
|
|||||||
ou = 'cn=Computers,dc=' + ',dc='.join(wd._domain.split('.'))
|
ou = 'cn=Computers,dc=' + ',dc='.join(wd._domain.split('.'))
|
||||||
|
|
||||||
logger.debug('Checking {0} with ou {1}'.format(wd._domain, ou))
|
logger.debug('Checking {0} with ou {1}'.format(wd._domain, ou))
|
||||||
r = l.search_st(ou, ldap.SCOPE_BASE)
|
r = l.search_st(ou, ldap.SCOPE_BASE) # @UndefinedVariable
|
||||||
logger.debug('Result of search: {0}'.format(r))
|
logger.debug('Result of search: {0}'.format(r))
|
||||||
|
|
||||||
except ldaputil.LDAPError:
|
except ldaputil.LDAPError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user