diff --git apps/useradmin/src/useradmin/ldap_access.py apps/useradmin/src/useradmin/ldap_access.py index dd7dfae128698dbae5399667afc754274df5ceda..c4152c54e5e34d8e66c16365e5aa51964b6e6a05 100644 --- apps/useradmin/src/useradmin/ldap_access.py +++ apps/useradmin/src/useradmin/ldap_access.py @@ -111,7 +111,10 @@ class LdapConnection(object): else: ldap.set_option(ldap.OPT_REFERRALS, 0) - self.ldap_handle = ldap.initialize(ldap_url) + if ldap_config.LDAP_DEBUG.get(): + ldap.set_option(ldap.OPT_DEBUG_LEVEL, ldap_config.LDAP_DEBUG_LEVEL.get()) + + self.ldap_handle = ldap.initialize(uri=ldap_url, trace_level=ldap_config.LDAP_TRACE_LEVEL.get()) if bind_user is not None: try: diff --git desktop/conf.dist/hue.ini desktop/conf.dist/hue.ini index 246f924ff0ce9ac46f0082813651781ce995802a..b445e11aa8e40c22553bed8363830166a0545ba5 100644 --- desktop/conf.dist/hue.ini +++ desktop/conf.dist/hue.ini @@ -269,6 +269,17 @@ # Whether or not to follow referrals ## follow_referrals=false + # Set to a value to enable python-ldap debugging. + ## ldap_debug= + + # Sets the debug level within the underlying LDAP C lib. + ## ldap_debug_level=255 + + # Possible values for trace_level are 0 for no logging, 1 for only logging the method calls with arguments, + # 2 for logging the method calls with arguments and the complete results and 9 for also logging the traceback of method calls. + ## ldap_trace_level=0 + + [[[users]]] # Base filter for searching for users diff --git desktop/core/src/desktop/conf.py desktop/core/src/desktop/conf.py index f25069b66c46319c02a141fc6037b7a26196e848..642869a6b56ec6c35d0aa37baf26655e290c3fa9 100644 --- desktop/core/src/desktop/conf.py +++ desktop/core/src/desktop/conf.py @@ -501,6 +501,18 @@ LDAP = ConfigSection( type=coerce_bool, default=False), + LDAP_DEBUG = Config("ldap_debug", + default=None, + help=_("Set to a value to enable python-ldap debugging.")), + LDAP_DEBUG_LEVEL = Config("ldap_debug_level", + default=255, + type=int, + help=_("Sets the debug level within the underlying LDAP C lib.")), + LDAP_TRACE_LEVEL = Config("ldap_trace_level", + default=0, + type=int, + help=_("Possible values for trace_level are 0 for no logging, 1 for only logging the method calls with arguments," + "2 for logging the method calls with arguments and the complete results and 9 for also logging the traceback of method calls.")), LDAP_SERVERS = UnspecifiedConfigSection( key="ldap_servers",