from ldap3 import ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES
from ldap3 import MODIFY_ADD, MODIFY_DELETE, MODIFY_REPLACE
from ldap3.core.exceptions import LDAPInvalidDnError, LDAPInvalidValueError
-from ldap3.core.exceptions import LDAPException
+from ldap3.core.exceptions import LDAPException, LDAPBindError
# Own modules
from fb_tools.colored import ColoredFormatter
LOG.debug("Target server {s}: {re}".format(
s=self.tgt_server, re=repr(self.tgt_server)))
- self.target = Connection(
- self.tgt_server, self.config.tgt_bind_dn, self.config.tgt_bind_pw,
- client_strategy=SAFE_SYNC, auto_bind=True)
+ try:
+ self.target = Connection(
+ self.tgt_server, self.config.tgt_bind_dn, self.config.tgt_bind_pw,
+ client_strategy=SAFE_SYNC, auto_bind=True)
+ except LDAPBindError as e:
+ LOG.err("Could not connect to {t!r} as {u!r}: {e}".format(
+ t=self.config.tgt_server, u=self.config.tgt_bind_dn, e=e))
+ self.exit(4)
if self.verbose > 1:
LOG.debug(