server/ldaputils.py
changeset 8250 171a9d6bff8f
parent 8244 c7d89541e3c5
child 8329 ac2b17bd7311
equal deleted inserted replaced
8249:c59c05c51321 8250:171a9d6bff8f
   225     def object_exists_in_ldap(self, dn):
   225     def object_exists_in_ldap(self, dn):
   226         cnx = self.get_connection().cnx #session.cnxset.connection(self.uri).cnx
   226         cnx = self.get_connection().cnx #session.cnxset.connection(self.uri).cnx
   227         if cnx is None:
   227         if cnx is None:
   228             return True # ldap unreachable, suppose it exists
   228             return True # ldap unreachable, suppose it exists
   229         try:
   229         try:
   230             cnx.search_s(base, scope, searchstr, attrs)
   230             cnx.search_s(dn, self.user_base_scope)
   231         except ldap.PARTIAL_RESULTS:
   231         except ldap.PARTIAL_RESULTS:
   232             pass
   232             pass
   233         except ldap.NO_SUCH_OBJECT:
   233         except ldap.NO_SUCH_OBJECT:
   234             return False
   234             return False
   235         return True
   235         return True