import logging
import os
import argparse
+import re
try:
from pathlib import Path
# rom ..config.ldap import DEFAULT_PORT_LDAP, DEFAULT_PORT_LDAPS
from ..config.ldap import DEFAULT_TIMEOUT, MAX_TIMEOUT
-__version__ = '0.3.1'
+__version__ = '0.3.2'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
use_multiple_ldap_connections = False
show_cmdline_ldap_timeout = True
+ # pattern_re_ldap_dn = (
+ # '^([a-z][a-z0-9-]*)=(?![ #])(((?![\\="+,;<>]).)|(\\[ \\#="+,;<>])|(\\[a-f0-9][a-f0-9]))*'
+ # '(,([a-z][a-z0-9-]*)=(?![ #])(((?![\\="+,;<>]).)|(\\[ \\#="+,;<>])|(\\[a-f0-9][a-f0-9]))*)*$'
+ # )
+
+ an = r'[a-z][a-z0-9-]'
+ token_ldap_dn = r'(?:{an}*)=(?![ #])(((?![\="+,;<>]).)|(\[ \#="+,;<>])|(\{an}))*'.format(an=an)
+ pattern_re_ldap_dn = r'^{pat}(,{pat})*$'.format(pat=token_ldap_dn)
+ re_ldap_dn = re.compile(pattern_re_ldap_dn, re.IGNORECASE)
+
# -------------------------------------------------------------------------
def __init__(
self, appname=None, verbose=0, version=GLOBAL_VERSION, base_dir=None,
res = super(BaseLdapApplication, self).as_dict(short=short)
+ res['pattern_re_ldap_dn'] = self.pattern_re_ldap_dn
res['password_file'] = self.password_file
res['show_cmdline_ldap_timeout'] = self.show_cmdline_ldap_timeout
res['use_default_ldap_connection'] = self.use_default_ldap_connection