# rom .ldap_config import DEFAULT_PORT_LDAP, DEFAULT_PORT_LDAPS
from .ldap_config import DEFAULT_TIMEOUT, MAX_TIMEOUT
-__version__ = '0.1.2'
+__version__ = '0.1.3'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
ldap_bind_dn = LdapConfiguration.default_bind_dn
ldap_group.add_argument(
- '-h', '--ldap-host', metavar=_("HOST"), dest="ldap_host",
+ '-H', '--ldap-host', metavar=_("HOST"), dest="ldap_host",
help=_(
"Hostname or address of the LDAP server to use. Default: {!r}").format(
ldap_host),
from .xlate import XLATOR
-__version__ = '0.2.4'
+__version__ = '0.2.5'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
appname=appname, verbose=verbose, version=version, base_dir=base_dir,
initialized=False)
- self.host = host
+ if host is not None:
+ self.host = host
self.use_ldaps = use_ldaps
self.port = port
- self.base_dn = base_dn
- self.bind_dn = bind_dn
- self.bind_pw = bind_pw
+ if base_dn is not None:
+ self.base_dn = base_dn
+ if bind_dn is not None:
+ self.bind_dn = bind_dn
+ if bind_pw is not None:
+ self.bind_pw = bind_pw
if initialized:
self.initialized = True
section = self.cfg[section_name]
if sn == 'ldap':
+ LOG.debug(_("Evaluating LDAP config ..."))
+
for key in section.keys():
+ if self.verbose > 1:
+ LOG.debug(_("Evaluating LDAP section {!r} ...").format(key))
sub = section[key]
if key.lower().strip() == 'timeout':
self._eval_ldap_timeout(sub)
# -------------------------------------------------------------------------
def _eval_ldap_connection(self, connection_name, section):
+ if self.verbose > 2:
+ msg = _("Reading configuration of LDAP instance {!r} ...").format(connection_name)
+ LOG.debug(msg)
+
connection = LdapConnectionInfo(
appname=self.appname, verbose=self.verbose, base_dir=self.base_dir,
initialized=False)
LOG.error(msg)
continue
connection.port = port
+ continue
if self.re_ldap_base_dn_key.match(key):
if value.strip():
connection.bind_dn = value
continue
- if self.re_ldap_bind_pw.match(key):
+ if self.re_ldap_bind_pw_key.match(key):
connection.bind_pw = value
continue