Пример #1
0
	def __init__(self, uid, pw):
		ld = ldap.ldap(settings.LDAP_HOST)
		dn = settings.LDAP_USER_DN.format(uid)
		print('Trying to bind with '+dn+'...')
		ld.simple_bind(dn, pw)
		self.group_base = lmap.lmap(dn=settings.LDAP_GROUPS_BASE, ldap=ld)
		self.uid = uid
		self.dn = dn
Пример #2
0
 def _ldap_connect(self):
     self.log("Connecting to LDAP server:", self.config.URI)
     try:
         ld = ldap.ldap(bytes(self.config.URI))
         ld.simple_bind(self.config.BINDDN, self.config.BINDPW)
         self.ldap = lmap.lmap(dn=self.config.BASE, ldap=ld)
     except ldap.LDAPError as e:
         self.log("No connection to the LDAP server! (", e, type(e), ")",
                  lvl=error)