From 5e0bd14b2ef7aebd8cf0b56c6c043ddd5a870cc3 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 18 May 2022 13:37:40 +0200 Subject: [PATCH] Fixing lib/pp_admintools/ldap_config.py --- lib/pp_admintools/ldap_config.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/pp_admintools/ldap_config.py b/lib/pp_admintools/ldap_config.py index 79b8df9..5368abc 100644 --- a/lib/pp_admintools/ldap_config.py +++ b/lib/pp_admintools/ldap_config.py @@ -12,6 +12,7 @@ from __future__ import absolute_import # Standard module import logging import copy +import re # Third party modules @@ -30,7 +31,7 @@ from . import MAX_PORT_NUMBER, DEFAULT_CONFIG_DIR from .xlate import XLATOR -__version__ = '0.2.1' +__version__ = '0.2.2' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -127,17 +128,17 @@ class LdapConnectionInfo(FbBaseObject): @property def use_ldaps(self): """Should there be used LDAPS for communicating with the LDAP server?""" - return self.use_ldaps + return self._use_ldaps @use_ldaps.setter def use_ldaps(self, value): - self.use_ldaps = to_bool(value) + self._use_ldaps = to_bool(value) # ----------------------------------------------------------- @property def port(self): "The TCP port number of the LDAP server." - return self._api_port + return self._port @port.setter def port(self, value): @@ -271,7 +272,7 @@ class LdapConnectionDict(dict, FbGenericBaseObject): new = self.__class__() for key in self.keys(): - new[key] = copy.copy(self.[key]) + new[key] = copy.copy(self[key]) return new @@ -369,12 +370,12 @@ class LdapConfiguration(BaseMultiConfig): msg = _("Value {!r} for a timeout is invalid:").format(value) msg += ' ' + str(e) LOG.error(msg) - continue + return if timeout <= 0 or timeout > MAX_TIMEOUT: msg = _("Value {!r} for a timeout is invalid:").format(value) msg += ' ' + str(e) LOG.error(msg) - continue + return self.ldap_timeout = timeout @@ -392,7 +393,7 @@ class LdapConfiguration(BaseMultiConfig): value = section[key] - if self.re_ldap_host_key.match(key) + if self.re_ldap_host_key.match(key): if value.strip(): connection.host = value else: -- 2.39.5