# ldap3 classes and objects
from ldap3 import Server, ServerPool, Connection, Reader, Writer, ObjectDef
# ldap3 constants
-from ldap3 import IP_V4_PREFERRED, ROUND_ROBIN, AUTO_BIND_NONE, ALL_ATTRIBUTES
+from ldap3 import IP_V4_ONLY, IP_V4_PREFERRED, ROUND_ROBIN, AUTO_BIND_NONE, ALL_ATTRIBUTES
from ldap3 import SUBTREE
from ldap3.core.exceptions import LDAPPasswordIsMandatoryError
cfg_encoding=cfg_encoding, need_config_file=need_config_file,
)
- if self.verbose > 3:
+ if self.verbose > 5:
set_library_log_detail_level(EXTENDED)
- elif self.verbose > 2:
+ elif self.verbose > 4:
set_library_log_detail_level(NETWORK)
- elif self.verbose > 1:
+ elif self.verbose > 3:
set_library_log_detail_level(PROTOCOL)
- elif self.verbose:
+ elif self.verbose > 2:
set_library_log_detail_level(BASIC)
else:
set_library_log_detail_level(ERROR)
mode=IP_V4_PREFERRED, connect_timeout=self.ldap_timeout)
# Init LDAP Server objects
- if len(self.ldap_hosts) > 1:
+ if len(self.ldap_hosts):
self.ldap_server = ServerPool(None, ROUND_ROBIN)
for h in self.ldap_hosts:
server = _get_ldap_server(h)
self.ldap_server.add(server)
- elif len(self.ldap_hosts) == 1:
- self.ldap_server = _get_ldap_server(self.ldap_hosts[0])
else:
msg = "No LDAP servers found in configuration."
raise PpLdapAppError(msg)