View | Details | Raw Unified | Return to bug 48721
Collapse All | Expand All

(-)a/base/univention-python/modules/uldap.py (-1 / +1 lines)
 Lines 890-896   class access: Link Here 
890
		if isLDAPUrl(ldap_url):
890
		if isLDAPUrl(ldap_url):
891
			conn_str = LDAPUrl(ldap_url).initializeUrl()
891
			conn_str = LDAPUrl(ldap_url).initializeUrl()
892
892
893
			lo_ref = ldap.ldapobject.ReconnectLDAPObject(conn_str, trace_stack_limit=None)
893
			lo_ref = ldap.ldapobject.ReconnectLDAPObject(conn_str, trace_stack_limit=None, retry_max=self.client_connection_attempt, retry_delay=1)
894
894
895
			if self.ca_certfile:
895
			if self.ca_certfile:
896
				lo_ref.set_option(ldap.OPT_X_TLS_CACERTFILE, self.ca_certfile)
896
				lo_ref.set_option(ldap.OPT_X_TLS_CACERTFILE, self.ca_certfile)
(-)a/management/univention-directory-manager-modules/modules/univention/admin/uldap.py (-2 / +10 lines)
 Lines 127-143   def getBaseDN(host='localhost', port=None, uri=None): # type: (str, Optional[in Link Here 
127
	:returns: The distinguished name of the LDAP root.
127
	:returns: The distinguished name of the LDAP root.
128
	:rtype: str
128
	:rtype: str
129
	"""
129
	"""
130
	try:
131
		client_retry_count = int(configRegistry.get('ldap/client/retry/count', 10))
132
	except ValueError:
133
		univention.debug.debug(univention.debug.LDAP, univention.debug.ERROR, "Unable to read ldap/client/retry/count, please reset to an integer value")
134
		client_retry_count = 10
135
136
	client_connection_attempt = client_retry_count + 1
137
130
	if not uri:
138
	if not uri:
131
		if not port:
139
		if not port:
132
			port = int(configRegistry.get('ldap/server/port', 7389))
140
			port = int(configRegistry.get('ldap/server/port', 7389))
133
		uri = "ldap://%s:%s" % (host, port)
141
		uri = "ldap://%s:%s" % (host, port)
134
	try:
142
	try:
135
		lo = ldap.ldapobject.ReconnectLDAPObject(uri, trace_stack_limit=None)
143
		lo = ldap.ldapobject.ReconnectLDAPObject(uri, trace_stack_limit=None, retry_max=client_connection_attempt, retry_delay=1)
136
		result = lo.search_s('', ldap.SCOPE_BASE, 'objectClass=*', ['NamingContexts'])
144
		result = lo.search_s('', ldap.SCOPE_BASE, 'objectClass=*', ['NamingContexts'])
137
		return result[0][1]['namingContexts'][0]
145
		return result[0][1]['namingContexts'][0]
138
	except ldap.SERVER_DOWN:
146
	except ldap.SERVER_DOWN:
139
		time.sleep(60)
147
		time.sleep(60)
140
	lo = ldap.ldapobject.ReconnectLDAPObject(uri, trace_stack_limit=None)
148
	lo = ldap.ldapobject.ReconnectLDAPObject(uri, trace_stack_limit=None, retry_max=client_connection_attempt, retry_delay=1)
141
	result = lo.search_s('', ldap.SCOPE_BASE, 'objectClass=*', ['NamingContexts'])
149
	result = lo.search_s('', ldap.SCOPE_BASE, 'objectClass=*', ['NamingContexts'])
142
	return result[0][1]['namingContexts'][0]
150
	return result[0][1]['namingContexts'][0]
143
151

Return to bug 48721