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

(-)a/base/univention-lib/python/admember.py (-1 / +1 lines)
 Lines 608-614   def _server_supports_ssl(server): Link Here 
608
		lo.start_tls_s()
608
		lo.start_tls_s()
609
	except ldap.UNAVAILABLE:
609
	except ldap.UNAVAILABLE:
610
		return False
610
		return False
611
	except ldap.SERVER_DOWN:
611
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
612
		return False
612
		return False
613
	return True
613
	return True
614
614
(-)a/base/univention-pam/ldap-group-to-file.py (-1 / +1 lines)
 Lines 108-114   if __name__ == '__main__': Link Here 
108
108
109
	try:
109
	try:
110
		lo = univention.uldap.getMachineConnection(ldap_master=False)
110
		lo = univention.uldap.getMachineConnection(ldap_master=False)
111
	except ldap.SERVER_DOWN:
111
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
112
		print "Abort: Can't contact LDAP server."
112
		print "Abort: Can't contact LDAP server."
113
		sys.exit(1)
113
		sys.exit(1)
114
114
(-)a/base/univention-python/modules/uldap.py (-4 / +9 lines)
 Lines 127-133   def getBackupConnection(start_tls=2, decode_ignorelist=[], reconnect=True): # t Link Here 
127
	port = int(ucr.get('ldap/master/port', '7389'))
127
	port = int(ucr.get('ldap/master/port', '7389'))
128
	try:
128
	try:
129
		return access(host=ucr['ldap/master'], port=port, base=ucr['ldap/base'], binddn='cn=backup,' + ucr['ldap/base'], bindpw=bindpw, start_tls=start_tls, decode_ignorelist=decode_ignorelist, reconnect=reconnect)
129
		return access(host=ucr['ldap/master'], port=port, base=ucr['ldap/base'], binddn='cn=backup,' + ucr['ldap/base'], bindpw=bindpw, start_tls=start_tls, decode_ignorelist=decode_ignorelist, reconnect=reconnect)
130
	except ldap.SERVER_DOWN:
130
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
131
		if not ucr['ldap/backup']:
131
		if not ucr['ldap/backup']:
132
			raise
132
			raise
133
		backup = ucr['ldap/backup'].split(' ')[0]
133
		backup = ucr['ldap/backup'].split(' ')[0]
 Lines 161-167   def getMachineConnection(start_tls=2, decode_ignorelist=[], ldap_master=True, se Link Here 
161
		port = int(ucr.get('ldap/server/port', '7389'))
161
		port = int(ucr.get('ldap/server/port', '7389'))
162
		try:
162
		try:
163
			return access(host=ucr['ldap/server/name'], port=port, base=ucr['ldap/base'], binddn=ucr['ldap/hostdn'], bindpw=bindpw, start_tls=start_tls, decode_ignorelist=decode_ignorelist, reconnect=reconnect)
163
			return access(host=ucr['ldap/server/name'], port=port, base=ucr['ldap/base'], binddn=ucr['ldap/hostdn'], bindpw=bindpw, start_tls=start_tls, decode_ignorelist=decode_ignorelist, reconnect=reconnect)
164
		except ldap.SERVER_DOWN as exc:
164
		except (ldap.SERVER_DOWN, ldap.TIMEOUT) as exc:
165
			# ldap/server/name is down, try next server
165
			# ldap/server/name is down, try next server
166
			if not ucr.get('ldap/server/addition'):
166
			if not ucr.get('ldap/server/addition'):
167
				raise
167
				raise
 Lines 169-175   def getMachineConnection(start_tls=2, decode_ignorelist=[], ldap_master=True, se Link Here 
169
			for server in servers.split():
169
			for server in servers.split():
170
				try:
170
				try:
171
					return access(host=server, port=port, base=ucr['ldap/base'], binddn=ucr['ldap/hostdn'], bindpw=bindpw, start_tls=start_tls, decode_ignorelist=decode_ignorelist, reconnect=reconnect)
171
					return access(host=server, port=port, base=ucr['ldap/base'], binddn=ucr['ldap/hostdn'], bindpw=bindpw, start_tls=start_tls, decode_ignorelist=decode_ignorelist, reconnect=reconnect)
172
				except ldap.SERVER_DOWN:
172
				except (ldap.SERVER_DOWN, ldap.TIMEOUT):
173
					pass
173
					pass
174
			raise exc
174
			raise exc
175
175
 Lines 179-185   class access: Link Here 
179
	The low-level class to access a LDAP server.
179
	The low-level class to access a LDAP server.
180
	"""
180
	"""
181
181
182
	def __init__(self, host='localhost', port=None, base='', binddn='', bindpw='', start_tls=2, ca_certfile=None, decode_ignorelist=[], use_ldaps=False, uri=None, follow_referral=False, reconnect=True):
182
	def __init__(self, host='localhost', port=None, base='', binddn='', bindpw='', start_tls=2, ca_certfile=None, decode_ignorelist=[], use_ldaps=False, uri=None, follow_referral=False, reconnect=True, timeout=None):
183
		"""start_tls = 0 (no); 1 (try); 2 (must)"""
183
		"""start_tls = 0 (no); 1 (try); 2 (must)"""
184
		self.host = host
184
		self.host = host
185
		self.base = base
185
		self.base = base
 Lines 188-193   class access: Link Here 
188
		self.start_tls = start_tls
188
		self.start_tls = start_tls
189
		self.ca_certfile = ca_certfile
189
		self.ca_certfile = ca_certfile
190
		self.reconnect = reconnect
190
		self.reconnect = reconnect
191
		self.timeout = timeout
192
191
193
192
		self.port = int(port) if port else None
194
		self.port = int(port) if port else None
193
195
 Lines 275-280   class access: Link Here 
275
		else:
277
		else:
276
			univention.debug.debug(univention.debug.LDAP, univention.debug.INFO, 'establishing new connection')
278
			univention.debug.debug(univention.debug.LDAP, univention.debug.INFO, 'establishing new connection')
277
			self.lo = ldap.initialize(self.uri, trace_stack_limit=None)
279
			self.lo = ldap.initialize(self.uri, trace_stack_limit=None)
280
			if self.timeout:
281
				ldap.set_option(ldap.OPT_TIMEOUT, self.timeout)
282
				ldap.set_option(ldap.OPT_NETWORK_TIMEOUT, self.timeout)
278
283
279
		if ca_certfile:
284
		if ca_certfile:
280
			self.lo.set_option(ldap.OPT_X_TLS_CACERTFILE, ca_certfile)
285
			self.lo.set_option(ldap.OPT_X_TLS_CACERTFILE, ca_certfile)
(-)a/base/univention-quota/quota.py (-1 / +1 lines)
 Lines 114-120   def _is_container(new, old): Link Here 
114
def _get_ldap_connection():
114
def _get_ldap_connection():
115
	try:
115
	try:
116
		connection = univention.uldap.getMachineConnection(ldap_master=False)
116
		connection = univention.uldap.getMachineConnection(ldap_master=False)
117
	except ldap.SERVER_DOWN:
117
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
118
		connection = univention.uldap.getMachineConnection()
118
		connection = univention.uldap.getMachineConnection()
119
119
120
	return connection
120
	return connection
(-)a/management/univention-appcenter/conffiles/create_portal_entries.py (-3 / +3 lines)
 Lines 32-38    Link Here 
32
32
33
import re
33
import re
34
from ldap.dn import escape_dn_chars
34
from ldap.dn import escape_dn_chars
35
from ldap import SERVER_DOWN
35
from ldap import SERVER_DOWN, TIMEOUT
36
from base64 import b64encode
36
from base64 import b64encode
37
from copy import copy
37
from copy import copy
38
from urlparse import urlsplit
38
from urlparse import urlsplit
 Lines 227-233   def _handler(ucr, changes): Link Here 
227
def handler(ucr, changes):
227
def handler(ucr, changes):
228
	try:
228
	try:
229
		_handler(ucr, changes)
229
		_handler(ucr, changes)
230
	except SERVER_DOWN:
230
	except (SERVER_DOWN, TIMEOUT) as exc:
231
		portal_logger.error('LDAP server is not available.')
231
		portal_logger.error('LDAP server is not available (%s)' % exc.args[0])
232
	except Exception:
232
	except Exception:
233
		portal_logger.exception('Exception in UCR module create_portal_entries')
233
		portal_logger.exception('Exception in UCR module create_portal_entries')
(-)a/management/univention-appcenter/python/appcenter/actions/credentials.py (-3 / +3 lines)
 Lines 127-133   class CredentialsAction(UniventionAppAction): Link Here 
127
			raise ConnectionFailedInvalidMachineCredentials()
127
			raise ConnectionFailedInvalidMachineCredentials()
128
		except ldap.CONNECT_ERROR as exc:
128
		except ldap.CONNECT_ERROR as exc:
129
			raise ConnectionFailedConnectError(exc)
129
			raise ConnectionFailedConnectError(exc)
130
		except ldap.SERVER_DOWN:
130
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
131
			raise ConnectionFailedServerDown()
131
			raise ConnectionFailedServerDown()
132
132
133
	def _get_admin_connection(self):
133
	def _get_admin_connection(self):
 Lines 139-145   class CredentialsAction(UniventionAppAction): Link Here 
139
			raise ConnectionFailedInvalidAdminCredentials()
139
			raise ConnectionFailedInvalidAdminCredentials()
140
		except ldap.CONNECT_ERROR as exc:
140
		except ldap.CONNECT_ERROR as exc:
141
			raise ConnectionFailedConnectError(exc)
141
			raise ConnectionFailedConnectError(exc)
142
		except ldap.SERVER_DOWN:
142
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
143
			raise ConnectionFailedServerDown()
143
			raise ConnectionFailedServerDown()
144
144
145
	def _get_ldap_connection(self, args, allow_machine_connection=False, allow_admin_connection=True):
145
	def _get_ldap_connection(self, args, allow_machine_connection=False, allow_admin_connection=True):
 Lines 175-181   class CredentialsAction(UniventionAppAction): Link Here 
175
					return get_connection(userdn, password)
175
					return get_connection(userdn, password)
176
				except ldap.CONNECT_ERROR as exc:
176
				except ldap.CONNECT_ERROR as exc:
177
					raise ConnectionFailedConnectError(exc)
177
					raise ConnectionFailedConnectError(exc)
178
				except ldap.SERVER_DOWN:
178
				except (ldap.SERVER_DOWN, ldap.TIMEOUT):
179
					raise ConnectionFailedServerDown()
179
					raise ConnectionFailedServerDown()
180
				except ldap.INVALID_CREDENTIALS:
180
				except ldap.INVALID_CREDENTIALS:
181
					time.sleep(0.1)
181
					time.sleep(0.1)
(-)a/management/univention-directory-listener/src/notifier.c (-1 / +1 lines)
 Lines 184-190   int notifier_listen(univention_ldap_parameters_t *lp, bool write_transaction_fil Link Here 
184
		   to reconnect */
184
		   to reconnect */
185
		while ((rv = change_update_dn(&trans)) != LDAP_SUCCESS) {
185
		while ((rv = change_update_dn(&trans)) != LDAP_SUCCESS) {
186
			univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "change_update_dn failed: %d", rv);
186
			univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "change_update_dn failed: %d", rv);
187
			if (rv == LDAP_SERVER_DOWN)
187
			if (rv == LDAP_SERVER_DOWN || rv == LDAP_TIMEOUT)
188
				if ((rv = connect_to_ldap(trans.lp)) == 0)
188
				if ((rv = connect_to_ldap(trans.lp)) == 0)
189
					continue;
189
					continue;
190
			goto out;
190
			goto out;
(-)a/management/univention-directory-listener/src/utils.h (-1 / +1 lines)
 Lines 41-47   extern int get_ldap_retries(); Link Here 
41
			ldap_retries = get_ldap_retries();                                        \
41
			ldap_retries = get_ldap_retries();                                        \
42
		do {                                                                              \
42
		do {                                                                              \
43
			_rv = (cmd);                                                              \
43
			_rv = (cmd);                                                              \
44
			if (_rv != LDAP_SERVER_DOWN)                                              \
44
			if (_rv != LDAP_SERVER_DOWN && _rv != LDAP_TIMEOUT)                                              \
45
				break;                                                            \
45
				break;                                                            \
46
			while (_retry < ldap_retries && univention_ldap_open(lp) != LDAP_SUCCESS) \
46
			while (_retry < ldap_retries && univention_ldap_open(lp) != LDAP_SUCCESS) \
47
				sleep(1 << (_retry++ % 6));                                       \
47
				sleep(1 << (_retry++ % 6));                                       \
(-)a/management/univention-directory-manager-modules/modules/univention/admin/syntax.py (-1 / +1 lines)
 Lines 1817-1823   class ldapFilter(simple): Link Here 
1817
			lo.search_ext_s('', ldap.SCOPE_BASE, text)
1817
			lo.search_ext_s('', ldap.SCOPE_BASE, text)
1818
		except ldap.FILTER_ERROR:
1818
		except ldap.FILTER_ERROR:
1819
			raise univention.admin.uexceptions.valueError(_('Not a valid LDAP search filter'))
1819
			raise univention.admin.uexceptions.valueError(_('Not a valid LDAP search filter'))
1820
		except ldap.SERVER_DOWN:
1820
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
1821
			pass
1821
			pass
1822
		finally:
1822
		finally:
1823
			lo.unbind()
1823
			lo.unbind()
(-)a/management/univention-directory-manager-modules/modules/univention/admin/uldap.py (-6 / +4 lines)
 Lines 135-141   def getBaseDN(host='localhost', port=None, uri=None): # type: (str, Optional[in Link Here 
135
		lo = ldap.ldapobject.ReconnectLDAPObject(uri, trace_stack_limit=None)
135
		lo = ldap.ldapobject.ReconnectLDAPObject(uri, trace_stack_limit=None)
136
		result = lo.search_s('', ldap.SCOPE_BASE, 'objectClass=*', ['NamingContexts'])
136
		result = lo.search_s('', ldap.SCOPE_BASE, 'objectClass=*', ['NamingContexts'])
137
		return result[0][1]['namingContexts'][0]
137
		return result[0][1]['namingContexts'][0]
138
	except ldap.SERVER_DOWN:
138
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
139
		time.sleep(60)
139
		time.sleep(60)
140
	lo = ldap.ldapobject.ReconnectLDAPObject(uri, trace_stack_limit=None)
140
	lo = ldap.ldapobject.ReconnectLDAPObject(uri, trace_stack_limit=None)
141
	result = lo.search_s('', ldap.SCOPE_BASE, 'objectClass=*', ['NamingContexts'])
141
	result = lo.search_s('', ldap.SCOPE_BASE, 'objectClass=*', ['NamingContexts'])
 Lines 498-504   class access: Link Here 
498
	def start_tls(self):
498
	def start_tls(self):
499
		return self.lo.start_tls
499
		return self.lo.start_tls
500
500
501
	def __init__(self, host='localhost', port=None, base='', binddn='', bindpw='', start_tls=2, lo=None, follow_referral=False):
501
	def __init__(self, host='localhost', port=None, base='', binddn='', bindpw='', start_tls=2, lo=None, follow_referral=False, timeout=None):
502
		"""
502
		"""
503
		:param str host: The hostname of the LDAP server.
503
		:param str host: The hostname of the LDAP server.
504
		:param int port: The TCP port number of the LDAP server.
504
		:param int port: The TCP port number of the LDAP server.
 Lines 506-514   class access: Link Here 
506
		:param str binddn: The distinguished name of the account.
506
		:param str binddn: The distinguished name of the account.
507
		:param str bindpw: The user password for simple authentication.
507
		:param str bindpw: The user password for simple authentication.
508
		:param int start_tls: Negotiate TLS with server. If `2` is given, the command will require the operation to be successful.
508
		:param int start_tls: Negotiate TLS with server. If `2` is given, the command will require the operation to be successful.
509
		:param univention.uldap.access: Low-level
509
		:param univention.uldap.access lo: Low-level
510
511
		:param str uri: A complete LDAP URI.
512
		"""
510
		"""
513
		if lo:
511
		if lo:
514
			self.lo = lo
512
			self.lo = lo
 Lines 516-522   class access: Link Here 
516
			if not port:
514
			if not port:
517
				port = int(configRegistry.get('ldap/server/port', 7389))
515
				port = int(configRegistry.get('ldap/server/port', 7389))
518
			try:
516
			try:
519
				self.lo = univention.uldap.access(host, port, base, binddn, bindpw, start_tls, follow_referral=follow_referral)
517
				self.lo = univention.uldap.access(host, port, base, binddn, bindpw, start_tls, follow_referral=follow_referral, timeout=timeout)
520
			except ldap.INVALID_CREDENTIALS:
518
			except ldap.INVALID_CREDENTIALS:
521
				raise univention.admin.uexceptions.authFail(_("Authentication failed"))
519
				raise univention.admin.uexceptions.authFail(_("Authentication failed"))
522
			except ldap.UNWILLING_TO_PERFORM:
520
			except ldap.UNWILLING_TO_PERFORM:
(-)a/management/univention-directory-manager-modules/modules/univention/admincli/admin.py (-1 / +1 lines)
 Lines 396-402   def doit(arglist): Link Here 
396
	out = []
396
	out = []
397
	try:
397
	try:
398
		out = _doit(arglist)
398
		out = _doit(arglist)
399
	except ldap.SERVER_DOWN:
399
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
400
		return out + ["E: The LDAP Server is currently not available.", "OPERATION FAILED"]
400
		return out + ["E: The LDAP Server is currently not available.", "OPERATION FAILED"]
401
	except univention.admin.uexceptions.base, e:
401
	except univention.admin.uexceptions.base, e:
402
		univention.debug.debug(univention.debug.ADMIN, univention.debug.WARN, traceback.format_exc())
402
		univention.debug.debug(univention.debug.ADMIN, univention.debug.WARN, traceback.format_exc())
(-)a/management/univention-directory-manager-modules/scripts/convert-user-base64-photos (-1 / +1 lines)
 Lines 112-117   if __name__ == '__main__': Link Here 
112
	# action!
112
	# action!
113
	try:
113
	try:
114
		run(args[0], verbose=options.verbose)
114
		run(args[0], verbose=options.verbose)
115
	except ldap.SERVER_DOWN as e:
115
	except (ldap.SERVER_DOWN, ldap.TIMEOUT) as e:
116
		print >>sys.stderr, 'ERROR: could not contact LDAP server: %s' % e
116
		print >>sys.stderr, 'ERROR: could not contact LDAP server: %s' % e
117
		sys.exit(1)
117
		sys.exit(1)
(-)a/management/univention-management-console/src/univention/management/console/base.py (-1 / +1 lines)
 Lines 296-302   class Base(signals.Provider, Translation): Link Here 
296
			exc = exc.original_exception
296
			exc = exc.original_exception
297
		if isinstance(exc, udm_errors.ldapError) and isinstance(getattr(exc, 'original_exception', None), ldap.INVALID_CREDENTIALS):
297
		if isinstance(exc, udm_errors.ldapError) and isinstance(getattr(exc, 'original_exception', None), ldap.INVALID_CREDENTIALS):
298
			exc = exc.original_exception
298
			exc = exc.original_exception
299
		if isinstance(exc, ldap.SERVER_DOWN):
299
		if isinstance(exc, ldap.SERVER_DOWN) or isinstance(exc, ldap.TIMEOUT):
300
			raise LDAP_ServerDown()
300
			raise LDAP_ServerDown()
301
		if isinstance(exc, ldap.CONNECT_ERROR):
301
		if isinstance(exc, ldap.CONNECT_ERROR):
302
			raise LDAP_ConnectionFailed(exc)
302
			raise LDAP_ConnectionFailed(exc)
(-)a/services/univention-ad-connector/modules/univention/connector/__init__.py (-14 / +14 lines)
 Lines 119-125   def dictonary_lowercase(dict): Link Here 
119
	else:
119
	else:
120
		try:  # should be string
120
		try:  # should be string
121
			return dict.lower()
121
			return dict.lower()
122
		except (ldap.SERVER_DOWN, SystemExit):
122
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
123
			raise
123
			raise
124
		except:  # FIXME: which exception is to be caught?
124
		except:  # FIXME: which exception is to be caught?
125
			pass
125
			pass
 Lines 131-137   def compare_lowercase(val1, val2): Link Here 
131
			return True
131
			return True
132
		else:
132
		else:
133
			return False
133
			return False
134
	except (ldap.SERVER_DOWN, SystemExit):
134
	except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
135
		raise
135
		raise
136
	except:  # FIXME: which exception is to be caught?
136
	except:  # FIXME: which exception is to be caught?
137
		return False
137
		return False
 Lines 478-484   class ucs: Link Here 
478
			ud.debug(ud.LDAP, ud.INFO, 'Lost connection to the LDAP server. Trying to reconnect ...')
478
			ud.debug(ud.LDAP, ud.INFO, 'Lost connection to the LDAP server. Trying to reconnect ...')
479
			try:
479
			try:
480
				self.open_ucs()
480
				self.open_ucs()
481
			except ldap.SERVER_DOWN:
481
			except (ldap.SERVER_DOWN, ldap.TIMEOUT):
482
				ud.debug(ud.LDAP, ud.INFO, 'LDAP-Server seems to be down')
482
				ud.debug(ud.LDAP, ud.INFO, 'LDAP-Server seems to be down')
483
				raise search_exception
483
				raise search_exception
484
484
 Lines 487-493   class ucs: Link Here 
487
		if '%s/debug/function' % self.CONFIGBASENAME in self.baseConfig:
487
		if '%s/debug/function' % self.CONFIGBASENAME in self.baseConfig:
488
			try:
488
			try:
489
				function_level = int(self.baseConfig['%s/debug/function' % self.CONFIGBASENAME])
489
				function_level = int(self.baseConfig['%s/debug/function' % self.CONFIGBASENAME])
490
			except (ldap.SERVER_DOWN, SystemExit):
490
			except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
491
				raise
491
				raise
492
			except:  # FIXME: which exception is to be caught?
492
			except:  # FIXME: which exception is to be caught?
493
				function_level = 0
493
				function_level = 0
 Lines 615-621   class ucs: Link Here 
615
				try:
615
				try:
616
					ret.append((self._decode_dn_from_config_option(d1), self._decode_dn_from_config_option(self._get_config_option(config_space, d1))))
616
					ret.append((self._decode_dn_from_config_option(d1), self._decode_dn_from_config_option(self._get_config_option(config_space, d1))))
617
					return_update = True
617
					return_update = True
618
				except (ldap.SERVER_DOWN, SystemExit):
618
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
619
					raise
619
					raise
620
				except:  # FIXME: which exception is to be caught?
620
				except:  # FIXME: which exception is to be caught?
621
					count = count + 1
621
					count = count + 1
 Lines 753-759   class ucs: Link Here 
753
							change_type = "add"
753
							change_type = "add"
754
							old_dn = ''  # there may be an old_dn if object was moved from ignored container
754
							old_dn = ''  # there may be an old_dn if object was moved from ignored container
755
							ud.debug(ud.LDAP, ud.INFO, "__sync_file_from_ucs: objected was added")
755
							ud.debug(ud.LDAP, ud.INFO, "__sync_file_from_ucs: objected was added")
756
				except (ldap.SERVER_DOWN, SystemExit):
756
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
757
					raise
757
					raise
758
				except:
758
				except:
759
					# the ignore_object method might throw an exception if the subschema will be synced
759
					# the ignore_object method might throw an exception if the subschema will be synced
 Lines 784-790   class ucs: Link Here 
784
							return False
784
							return False
785
						else:
785
						else:
786
							return True
786
							return True
787
					except (ldap.SERVER_DOWN, SystemExit):
787
					except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
788
						raise
788
						raise
789
					except:  # FIXME: which exception is to be caught?
789
					except:  # FIXME: which exception is to be caught?
790
						self._save_rejected_ucs(filename, dn)
790
						self._save_rejected_ucs(filename, dn)
 Lines 835-841   class ucs: Link Here 
835
835
836
			ucs_object = univention.admin.objects.get(module, co=None, lo=self.lo, position='', dn=searchdn)
836
			ucs_object = univention.admin.objects.get(module, co=None, lo=self.lo, position='', dn=searchdn)
837
			ud.debug(ud.LDAP, ud.INFO, "get_ucs_object: object found: %s" % searchdn)
837
			ud.debug(ud.LDAP, ud.INFO, "get_ucs_object: object found: %s" % searchdn)
838
		except (ldap.SERVER_DOWN, SystemExit):
838
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
839
			raise
839
			raise
840
		except:  # FIXME: which exception is to be caught?
840
		except:  # FIXME: which exception is to be caught?
841
			ud.debug(ud.LDAP, ud.INFO, "get_ucs_object: object search failed: %s" % searchdn)
841
			ud.debug(ud.LDAP, ud.INFO, "get_ucs_object: object search failed: %s" % searchdn)
 Lines 906-912   class ucs: Link Here 
906
							pass
906
							pass
907
						self._remove_rejected_ucs(filename)
907
						self._remove_rejected_ucs(filename)
908
						change_counter += 1
908
						change_counter += 1
909
				except (ldap.SERVER_DOWN, SystemExit):
909
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
910
					raise
910
					raise
911
				except:  # FIXME: which exception is to be caught?
911
				except:  # FIXME: which exception is to be caught?
912
					self._save_rejected_ucs(filename, dn)
912
					self._save_rejected_ucs(filename, dn)
 Lines 988-994   class ucs: Link Here 
988
						for i in [0, 1]:  # do it twice if the LDAP connection was closed
988
						for i in [0, 1]:  # do it twice if the LDAP connection was closed
989
							try:
989
							try:
990
								sync_successfull = self.__sync_file_from_ucs(filename, traceback_level=traceback_level)
990
								sync_successfull = self.__sync_file_from_ucs(filename, traceback_level=traceback_level)
991
							except (ldap.SERVER_DOWN, SystemExit):
991
							except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
992
								# once again, ldap idletimeout ...
992
								# once again, ldap idletimeout ...
993
								if i == 0:
993
								if i == 0:
994
									self.open_ucs()
994
									self.open_ucs()
 Lines 1202-1208   class ucs: Link Here 
1202
				return True
1202
				return True
1203
			else:
1203
			else:
1204
				ud.debug(ud.LDAP, ud.INFO, "move_in_ucs: move object from %s to %s" % (object['olddn'], object['dn']))
1204
				ud.debug(ud.LDAP, ud.INFO, "move_in_ucs: move object from %s to %s" % (object['olddn'], object['dn']))
1205
		except (ldap.SERVER_DOWN, SystemExit):
1205
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1206
			raise
1206
			raise
1207
		except:  # FIXME: which exception is to be caught?
1207
		except:  # FIXME: which exception is to be caught?
1208
			ud.debug(ud.LDAP, ud.INFO, "move_in_ucs: move object in UCS")
1208
			ud.debug(ud.LDAP, ud.INFO, "move_in_ucs: move object in UCS")
 Lines 1277-1283   class ucs: Link Here 
1277
						if not self.sync_to_ucs(key, subobject, object_mapping['dn']):
1277
						if not self.sync_to_ucs(key, subobject, object_mapping['dn']):
1278
							try:
1278
							try:
1279
								ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed: %s" % result[0])
1279
								ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed: %s" % result[0])
1280
							except (ldap.SERVER_DOWN, SystemExit):
1280
							except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1281
								raise
1281
								raise
1282
							except:  # FIXME: which exception is to be caught?
1282
							except:  # FIXME: which exception is to be caught?
1283
								ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed")
1283
								ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed")
 Lines 1380-1386   class ucs: Link Here 
1380
		except univention.admin.uexceptions.valueMayNotChange, msg:
1380
		except univention.admin.uexceptions.valueMayNotChange, msg:
1381
			ud.debug(ud.LDAP, ud.ERROR, "Value may not change: %s (%s)" % (msg, object['dn']))
1381
			ud.debug(ud.LDAP, ud.ERROR, "Value may not change: %s (%s)" % (msg, object['dn']))
1382
			return False
1382
			return False
1383
		except (ldap.SERVER_DOWN, SystemExit):
1383
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1384
			# LDAP idletimeout? try once again
1384
			# LDAP idletimeout? try once again
1385
			if retry:
1385
			if retry:
1386
				self.open_ucs()
1386
				self.open_ucs()
 Lines 1468-1474   class ucs: Link Here 
1468
							return True
1468
							return True
1469
						else:
1469
						else:
1470
							return False
1470
							return False
1471
					except (ldap.SERVER_DOWN, SystemExit):
1471
					except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1472
						raise
1472
						raise
1473
					except:
1473
					except:
1474
						ud.debug(ud.LDAP, ud.WARN, "attribute_filter: Failed to convert attributes for bitwise filter")
1474
						ud.debug(ud.LDAP, ud.WARN, "attribute_filter: Failed to convert attributes for bitwise filter")
(-)a/services/univention-ad-connector/modules/univention/connector/ad/__init__.py (-15 / +15 lines)
 Lines 161-167   def encode_ad_object(ad_object): Link Here 
161
			else:
161
			else:
162
				try:
162
				try:
163
					ad_object[key] = encode_attriblist(ad_object[key])
163
					ad_object[key] = encode_attriblist(ad_object[key])
164
				except (ldap.SERVER_DOWN, SystemExit):
164
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
165
					raise
165
					raise
166
				except:  # FIXME: which exception is to be caught?
166
				except:  # FIXME: which exception is to be caught?
167
					ud.debug(ud.LDAP, ud.WARN, "encode_ad_object: encode attrib %s failed, ignored!" % key)
167
					ud.debug(ud.LDAP, ud.WARN, "encode_ad_object: encode attrib %s failed, ignored!" % key)
 Lines 1061-1067   class ad(univention.connector.ucs): Link Here 
1061
			except:  # FIXME: which exception is to be caught?
1061
			except:  # FIXME: which exception is to be caught?
1062
				ud.debug(ud.LDAP, ud.INFO, "get_object: got object: <print failed>")
1062
				ud.debug(ud.LDAP, ud.INFO, "get_object: got object: <print failed>")
1063
			return encode_ad_object(ad_object)
1063
			return encode_ad_object(ad_object)
1064
		except (ldap.SERVER_DOWN, SystemExit):
1064
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1065
			raise
1065
			raise
1066
		except:  # FIXME: which exception is to be caught?
1066
		except:  # FIXME: which exception is to be caught?
1067
			pass
1067
			pass
 Lines 1164-1170   class ad(univention.connector.ucs): Link Here 
1164
			else:
1164
			else:
1165
				# Every object has got a uSNCreated
1165
				# Every object has got a uSNCreated
1166
				returnObjects = search_ad_changes_by_attribute('uSNCreated', lastUSN + 1)
1166
				returnObjects = search_ad_changes_by_attribute('uSNCreated', lastUSN + 1)
1167
		except (ldap.SERVER_DOWN, SystemExit):
1167
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1168
			raise
1168
			raise
1169
		except ldap.SIZELIMIT_EXCEEDED:
1169
		except ldap.SIZELIMIT_EXCEEDED:
1170
			# The LDAP control page results was not sucessful. Without this control
1170
			# The LDAP control page results was not sucessful. Without this control
 Lines 1580-1586   class ad(univention.connector.ucs): Link Here 
1580
						ad_members_from_ucs.append(ad_dn.lower())
1580
						ad_members_from_ucs.append(ad_dn.lower())
1581
						self.group_mapping_cache_ucs[member_dn.lower()] = ad_dn
1581
						self.group_mapping_cache_ucs[member_dn.lower()] = ad_dn
1582
						self.__group_cache_ucs_append_member(object_ucs['dn'], member_dn)
1582
						self.__group_cache_ucs_append_member(object_ucs['dn'], member_dn)
1583
				except (ldap.SERVER_DOWN, SystemExit):
1583
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1584
					raise
1584
					raise
1585
				except:  # FIXME: which exception is to be caught?
1585
				except:  # FIXME: which exception is to be caught?
1586
					ud.debug(ud.LDAP, ud.INFO, "group_members_sync_from_ucs: failed to get dn from ad, assume object doesn't exist")
1586
					ud.debug(ud.LDAP, ud.INFO, "group_members_sync_from_ucs: failed to get dn from ad, assume object doesn't exist")
 Lines 1601-1607   class ad(univention.connector.ucs): Link Here 
1601
					elif self._ignore_object(key, {'dn': member_dn, 'attributes': ad_object}):
1601
					elif self._ignore_object(key, {'dn': member_dn, 'attributes': ad_object}):
1602
						ad_members_from_ucs.append(member_dn.lower())
1602
						ad_members_from_ucs.append(member_dn.lower())
1603
						ud.debug(ud.LDAP, ud.INFO, "group_members_sync_from_ucs: Object ignored in AD [%s], key = [%s]" % (ucs_dn, key))
1603
						ud.debug(ud.LDAP, ud.INFO, "group_members_sync_from_ucs: Object ignored in AD [%s], key = [%s]" % (ucs_dn, key))
1604
				except (ldap.SERVER_DOWN, SystemExit):
1604
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1605
					raise
1605
					raise
1606
				except:  # FIXME: which exception is to be caught?
1606
				except:  # FIXME: which exception is to be caught?
1607
					self._debug_traceback(ud.INFO, "group_members_sync_from_ucs: failed to get dn from ad which is groupmember")
1607
					self._debug_traceback(ud.INFO, "group_members_sync_from_ucs: failed to get dn from ad which is groupmember")
 Lines 1672-1678   class ad(univention.connector.ucs): Link Here 
1672
1672
1673
			try:
1673
			try:
1674
				self.lo_ad.lo.modify_s(compatible_modstring(object['dn']), [(ldap.MOD_REPLACE, 'member', modlist_members)])
1674
				self.lo_ad.lo.modify_s(compatible_modstring(object['dn']), [(ldap.MOD_REPLACE, 'member', modlist_members)])
1675
			except (ldap.SERVER_DOWN, SystemExit):
1675
			except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1676
				raise
1676
				raise
1677
			except:  # FIXME: which exception is to be caught?
1677
			except:  # FIXME: which exception is to be caught?
1678
				ud.debug(ud.LDAP, ud.WARN, "group_members_sync_from_ucs: failed to sync members: (%s,%s)" % (object['dn'], [(ldap.MOD_REPLACE, 'member', modlist_members)]))
1678
				ud.debug(ud.LDAP, ud.WARN, "group_members_sync_from_ucs: failed to sync members: (%s,%s)" % (object['dn'], [(ldap.MOD_REPLACE, 'member', modlist_members)]))
 Lines 1849-1855   class ad(univention.connector.ucs): Link Here 
1849
							self.__group_cache_con_append_member(ad_object['dn'], member_dn)
1849
							self.__group_cache_con_append_member(ad_object['dn'], member_dn)
1850
						else:
1850
						else:
1851
							ud.debug(ud.LDAP, ud.INFO, "Failed to find %s via self.lo.get" % ucs_dn)
1851
							ud.debug(ud.LDAP, ud.INFO, "Failed to find %s via self.lo.get" % ucs_dn)
1852
					except (ldap.SERVER_DOWN, SystemExit):
1852
					except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1853
						raise
1853
						raise
1854
					except:  # FIXME: which exception is to be caught?
1854
					except:  # FIXME: which exception is to be caught?
1855
						ud.debug(ud.LDAP, ud.INFO, "group_members_sync_to_ucs: failed to get dn from ucs, assume object doesn't exist")
1855
						ud.debug(ud.LDAP, ud.INFO, "group_members_sync_to_ucs: failed to get dn from ucs, assume object doesn't exist")
 Lines 1882-1888   class ad(univention.connector.ucs): Link Here 
1882
								ucs_members_from_ad[k].append(member_dn.lower())
1882
								ucs_members_from_ad[k].append(member_dn.lower())
1883
							break
1883
							break
1884
1884
1885
				except (ldap.SERVER_DOWN, SystemExit):
1885
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1886
					raise
1886
					raise
1887
				except:  # FIXME: which exception is to be caught?
1887
				except:  # FIXME: which exception is to be caught?
1888
					self._debug_traceback(ud.INFO, "group_members_sync_to_ucs: failed to get dn from ucs which is groupmember")
1888
					self._debug_traceback(ud.INFO, "group_members_sync_to_ucs: failed to get dn from ucs which is groupmember")
 Lines 2109-2115   class ad(univention.connector.ucs): Link Here 
2109
								sync_successfull = self.sync_to_ucs(property_key, mapped_object, dn)
2109
								sync_successfull = self.sync_to_ucs(property_key, mapped_object, dn)
2110
							else:
2110
							else:
2111
								sync_successfull = True
2111
								sync_successfull = True
2112
						except (ldap.SERVER_DOWN, SystemExit):
2112
						except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2113
							raise
2113
							raise
2114
						except:  # FIXME: which exception is to be caught?
2114
						except:  # FIXME: which exception is to be caught?
2115
							self._debug_traceback(ud.ERROR, "sync of rejected object failed \n\t%s" % (object['dn']))
2115
							self._debug_traceback(ud.ERROR, "sync of rejected object failed \n\t%s" % (object['dn']))
 Lines 2119-2125   class ad(univention.connector.ucs): Link Here 
2119
							self._remove_rejected(id)
2119
							self._remove_rejected(id)
2120
							self.__update_lastUSN(object)
2120
							self.__update_lastUSN(object)
2121
							self._set_DN_for_GUID(elements[0][1]['objectGUID'][0], elements[0][0])
2121
							self._set_DN_for_GUID(elements[0][1]['objectGUID'][0], elements[0][0])
2122
				except (ldap.SERVER_DOWN, SystemExit):
2122
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2123
					raise
2123
					raise
2124
				except Exception:
2124
				except Exception:
2125
					self._debug_traceback(ud.ERROR, "unexpected Error during ad.resync_rejected")
2125
					self._debug_traceback(ud.ERROR, "unexpected Error during ad.resync_rejected")
 Lines 2138-2144   class ad(univention.connector.ucs): Link Here 
2138
		changes = []
2138
		changes = []
2139
		try:
2139
		try:
2140
			changes = self.__search_ad_changes(show_deleted=show_deleted)
2140
			changes = self.__search_ad_changes(show_deleted=show_deleted)
2141
		except (ldap.SERVER_DOWN, SystemExit):
2141
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2142
			raise
2142
			raise
2143
		except:  # FIXME: which exception is to be caught?
2143
		except:  # FIXME: which exception is to be caught?
2144
			self._debug_traceback(ud.WARN, "Exception during search_ad_changes")
2144
			self._debug_traceback(ud.WARN, "Exception during search_ad_changes")
 Lines 2195-2201   class ad(univention.connector.ucs): Link Here 
2195
							sync_successfull = self.sync_to_ucs(property_key, mapped_object, object['dn'])
2195
							sync_successfull = self.sync_to_ucs(property_key, mapped_object, object['dn'])
2196
						else:
2196
						else:
2197
							sync_successfull = True
2197
							sync_successfull = True
2198
					except (ldap.SERVER_DOWN, SystemExit):
2198
					except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2199
						raise
2199
						raise
2200
					except univention.admin.uexceptions.ldapError, msg:
2200
					except univention.admin.uexceptions.ldapError, msg:
2201
						ud.debug(ud.LDAP, ud.INFO, "Exception during poll with message (1) %s" % msg)
2201
						ud.debug(ud.LDAP, ud.INFO, "Exception during poll with message (1) %s" % msg)
 Lines 2222-2228   class ad(univention.connector.ucs): Link Here 
2222
						try:
2222
						try:
2223
							GUID = old_element[1]['objectGUID'][0]
2223
							GUID = old_element[1]['objectGUID'][0]
2224
							self._set_DN_for_GUID(GUID, old_element[0])
2224
							self._set_DN_for_GUID(GUID, old_element[0])
2225
						except (ldap.SERVER_DOWN, SystemExit):
2225
						except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2226
							raise
2226
							raise
2227
						except:  # FIXME: which exception is to be caught?
2227
						except:  # FIXME: which exception is to be caught?
2228
							self._debug_traceback(ud.WARN, "Exception during set_DN_for_GUID")
2228
							self._debug_traceback(ud.WARN, "Exception during set_DN_for_GUID")
 Lines 2286-2292   class ad(univention.connector.ucs): Link Here 
2286
			# the old object was moved in UCS, but does this object exist in AD?
2286
			# the old object was moved in UCS, but does this object exist in AD?
2287
			try:
2287
			try:
2288
				old_object = self.lo_ad.get(compatible_modstring(old_dn))
2288
				old_object = self.lo_ad.get(compatible_modstring(old_dn))
2289
			except (ldap.SERVER_DOWN, SystemExit):
2289
			except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2290
				raise
2290
				raise
2291
			except:
2291
			except:
2292
				old_object = None
2292
				old_object = None
 Lines 2553-2559   class ad(univention.connector.ucs): Link Here 
2553
					if not self.sync_from_ucs(key, subobject, object_mapping['dn']):
2553
					if not self.sync_from_ucs(key, subobject, object_mapping['dn']):
2554
						try:
2554
						try:
2555
							ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed: %s" % result[0])
2555
							ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed: %s" % result[0])
2556
						except (ldap.SERVER_DOWN, SystemExit):
2556
						except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2557
							raise
2557
							raise
2558
						except:  # FIXME: which exception is to be caught?
2558
						except:  # FIXME: which exception is to be caught?
2559
							ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed")
2559
							ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed")
(-)a/services/univention-ad-connector/modules/univention/connector/ad/main.py (-6 / +6 lines)
 Lines 191-197   def connect(): Link Here 
191
				baseConfig['%s/ad/listener/dir' % CONFIGBASENAME]
191
				baseConfig['%s/ad/listener/dir' % CONFIGBASENAME]
192
			)
192
			)
193
			ad_init = True
193
			ad_init = True
194
		except ldap.SERVER_DOWN:
194
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
195
			print "Warning: Can't initialize LDAP-Connections, wait..."
195
			print "Warning: Can't initialize LDAP-Connections, wait..."
196
			sys.stdout.flush()
196
			sys.stdout.flush()
197
			time.sleep(poll_sleep)
197
			time.sleep(poll_sleep)
 Lines 204-210   def connect(): Link Here 
204
		try:
204
		try:
205
			ad.initialize_ucs()
205
			ad.initialize_ucs()
206
			ucs_init = True
206
			ucs_init = True
207
		except ldap.SERVER_DOWN:
207
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
208
			print "Can't contact LDAP server during ucs-poll, sync not possible."
208
			print "Can't contact LDAP server during ucs-poll, sync not possible."
209
			sys.stdout.flush()
209
			sys.stdout.flush()
210
			time.sleep(poll_sleep)
210
			time.sleep(poll_sleep)
 Lines 215-221   def connect(): Link Here 
215
		try:
215
		try:
216
			ad.initialize()
216
			ad.initialize()
217
			ad_init = True
217
			ad_init = True
218
		except ldap.SERVER_DOWN:
218
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
219
			print "Can't contact LDAP server during ucs-poll, sync not possible."
219
			print "Can't contact LDAP server during ucs-poll, sync not possible."
220
			sys.stdout.flush()
220
			sys.stdout.flush()
221
			time.sleep(poll_sleep)
221
			time.sleep(poll_sleep)
 Lines 239-245   def connect(): Link Here 
239
					continue
239
					continue
240
				else:
240
				else:
241
					break
241
					break
242
			except ldap.SERVER_DOWN:
242
			except (ldap.SERVER_DOWN, ldap.TIMEOUT):
243
				print "Can't contact LDAP server during ucs-poll, sync not possible."
243
				print "Can't contact LDAP server during ucs-poll, sync not possible."
244
				connected = False
244
				connected = False
245
				sys.stdout.flush()
245
				sys.stdout.flush()
 Lines 255-261   def connect(): Link Here 
255
					continue
255
					continue
256
				else:
256
				else:
257
					break
257
					break
258
			except ldap.SERVER_DOWN:
258
			except (ldap.SERVER_DOWN, ldap.TIMEOUT):
259
				print "Can't contact LDAP server during ad-poll, sync not possible."
259
				print "Can't contact LDAP server during ad-poll, sync not possible."
260
				connected = False
260
				connected = False
261
				sys.stdout.flush()
261
				sys.stdout.flush()
 Lines 268-274   def connect(): Link Here 
268
				retry_rejected = 0
268
				retry_rejected = 0
269
			else:
269
			else:
270
				retry_rejected += 1
270
				retry_rejected += 1
271
		except ldap.SERVER_DOWN:
271
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
272
			print "Can't contact LDAP server during resync rejected, sync not possible."
272
			print "Can't contact LDAP server during resync rejected, sync not possible."
273
			connected = False
273
			connected = False
274
			sys.stdout.flush()
274
			sys.stdout.flush()
(-)a/services/univention-ad-connector/scripts/make-deleted-objects-readable-for-this-machine (-1 / +1 lines)
 Lines 171-177   class AD_DSACL_modifier(): Link Here 
171
					self.ucr['%s/ad/ldap/certificate' % CONFIGBASENAME]
171
					self.ucr['%s/ad/ldap/certificate' % CONFIGBASENAME]
172
				)
172
				)
173
				ad_init = True
173
				ad_init = True
174
			except ldap.SERVER_DOWN:
174
			except (ldap.SERVER_DOWN, ldap.TIMEOUT):
175
				print "Warning: Can't initialize LDAP-Connections, wait..."
175
				print "Warning: Can't initialize LDAP-Connections, wait..."
176
				sys.stdout.flush()
176
				sys.stdout.flush()
177
				time.sleep(poll_sleep)
177
				time.sleep(poll_sleep)
(-)a/services/univention-ad-connector/scripts/well-known-sid-object-rename (-1 / +1 lines)
 Lines 184-190   class Well_Known_SID_object_renamer(): Link Here 
184
					self.ucr['%s/ad/ldap/certificate' % CONFIGBASENAME]
184
					self.ucr['%s/ad/ldap/certificate' % CONFIGBASENAME]
185
				)
185
				)
186
				ad_init = True
186
				ad_init = True
187
			except ldap.SERVER_DOWN:
187
			except (ldap.SERVER_DOWN, ldap.TIMEOUT):
188
				print "Warning: Can't initialize LDAP-Connections, wait..."
188
				print "Warning: Can't initialize LDAP-Connections, wait..."
189
				sys.stdout.flush()
189
				sys.stdout.flush()
190
				time.sleep(poll_sleep)
190
				time.sleep(poll_sleep)
(-)a/services/univention-radius/usr/bin/univention-radius-check-access (-2 / +2 lines)
 Lines 37-43   from univention.networkaccess import traceStationWhitelist Link Here 
37
import optparse
37
import optparse
38
import sys
38
import sys
39
import univention.uldap
39
import univention.uldap
40
from ldap import SERVER_DOWN
40
from ldap import SERVER_DOWN, TIMEOUT
41
41
42
42
43
def main():
43
def main():
 Lines 49-55   def main(): Link Here 
49
	try:
49
	try:
50
		# try ldap/server/name, then each of ldap/server/addition
50
		# try ldap/server/name, then each of ldap/server/addition
51
		ldapConnection = univention.uldap.getMachineConnection(ldap_master=False, reconnect=False)
51
		ldapConnection = univention.uldap.getMachineConnection(ldap_master=False, reconnect=False)
52
	except SERVER_DOWN:
52
    except (SERVER_DOWN, TIMEOUT):
53
		# then master dc
53
		# then master dc
54
		ldapConnection = univention.uldap.getMachineConnection()
54
		ldapConnection = univention.uldap.getMachineConnection()
55
	exitCode = 0
55
	exitCode = 0
(-)a/services/univention-radius/usr/bin/univention-radius-ntlm-auth (-2 / +2 lines)
 Lines 37-43   import optparse Link Here 
37
import sys
37
import sys
38
import univention.pyMsChapV2 as pyMsChapV2
38
import univention.pyMsChapV2 as pyMsChapV2
39
import univention.uldap
39
import univention.uldap
40
from ldap import SERVER_DOWN
40
from ldap import SERVER_DOWN, TIMEOUT
41
41
42
42
43
def main():
43
def main():
 Lines 74-80   def main(): Link Here 
74
	try:
74
	try:
75
		# try ldap/server/name, then each of ldap/server/addition
75
		# try ldap/server/name, then each of ldap/server/addition
76
		ldapConnection = univention.uldap.getMachineConnection(ldap_master=False, reconnect=False)
76
		ldapConnection = univention.uldap.getMachineConnection(ldap_master=False, reconnect=False)
77
	except SERVER_DOWN:
77
	except (SERVER_DOWN, TIMEOUT):
78
		# then master dc
78
		# then master dc
79
		ldapConnection = univention.uldap.getMachineConnection()
79
		ldapConnection = univention.uldap.getMachineConnection()
80
	PasswordHash = getNTPasswordHash(ldapConnection, options.Username, stationId)
80
	PasswordHash = getNTPasswordHash(ldapConnection, options.Username, stationId)
(-)a/services/univention-s4-connector/modules/univention/s4connector/__init__.py (-19 / +19 lines)
 Lines 136-142   def dictonary_lowercase(dict): Link Here 
136
	else:
136
	else:
137
		try:  # should be string
137
		try:  # should be string
138
			return dict.lower()
138
			return dict.lower()
139
		except (ldap.SERVER_DOWN, SystemExit):
139
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
140
			raise
140
			raise
141
		except:  # FIXME: which exception is to be caught?
141
		except:  # FIXME: which exception is to be caught?
142
			pass
142
			pass
 Lines 152-158   def compare_lowercase(val1, val2): Link Here 
152
			return True
152
			return True
153
		else:
153
		else:
154
			return False
154
			return False
155
	except (ldap.SERVER_DOWN, SystemExit):
155
	except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
156
		raise
156
		raise
157
	except:  # FIXME: which exception is to be caught?
157
	except:  # FIXME: which exception is to be caught?
158
		return False
158
		return False
 Lines 533-540   class ucs: Link Here 
533
				self.open_ucs()
533
				self.open_ucs()
534
				result = self.lo.search(filter=filter, base=base, scope=scope, attr=attr, unique=unique, required=required, timeout=timeout, sizelimit=sizelimit)
534
				result = self.lo.search(filter=filter, base=base, scope=scope, attr=attr, unique=unique, required=required, timeout=timeout, sizelimit=sizelimit)
535
				return result
535
				return result
536
			except ldap.SERVER_DOWN, e:
536
			except (ldap.SERVER_DOWN, ldap.TIMEOUT) as exc:
537
				ud.debug(ud.LDAP, ud.INFO, 'LDAP-Server seems to be down')
537
				ud.debug(ud.LDAP, ud.INFO, 'LDAP-Server seems to be down (%s)' % exc.args[0])
538
				raise search_exception
538
				raise search_exception
539
539
540
	def init_debug(self):
540
	def init_debug(self):
 Lines 542-548   class ucs: Link Here 
542
		if '%s/debug/function' % self.CONFIGBASENAME in self.baseConfig:
542
		if '%s/debug/function' % self.CONFIGBASENAME in self.baseConfig:
543
			try:
543
			try:
544
				function_level = int(self.baseConfig['%s/debug/function' % self.CONFIGBASENAME])
544
				function_level = int(self.baseConfig['%s/debug/function' % self.CONFIGBASENAME])
545
			except (ldap.SERVER_DOWN, SystemExit):
545
			except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
546
				raise
546
				raise
547
			except:  # FIXME: which exception is to be caught?
547
			except:  # FIXME: which exception is to be caught?
548
				function_level = 0
548
				function_level = 0
 Lines 707-713   class ucs: Link Here 
707
				try:
707
				try:
708
					ret.append((self._decode_dn_from_config_option(d1), self._decode_dn_from_config_option(self._get_config_option(config_space, d1))))
708
					ret.append((self._decode_dn_from_config_option(d1), self._decode_dn_from_config_option(self._get_config_option(config_space, d1))))
709
					return_update = True
709
					return_update = True
710
				except (ldap.SERVER_DOWN, SystemExit):
710
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
711
					raise
711
					raise
712
				except:  # FIXME: which exception is to be caught?
712
				except:  # FIXME: which exception is to be caught?
713
					count = count + 1
713
					count = count + 1
 Lines 868-874   class ucs: Link Here 
868
							change_type = "add"
868
							change_type = "add"
869
							old_dn = ''  # there may be an old_dn if object was moved from ignored container
869
							old_dn = ''  # there may be an old_dn if object was moved from ignored container
870
							ud.debug(ud.LDAP, ud.INFO, "__sync_file_from_ucs: object was added: %s" % dn)
870
							ud.debug(ud.LDAP, ud.INFO, "__sync_file_from_ucs: object was added: %s" % dn)
871
				except (ldap.SERVER_DOWN, SystemExit):
871
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
872
					raise
872
					raise
873
				except:
873
				except:
874
					# the ignore_object method might throw an exception if the subschema will be synced
874
					# the ignore_object method might throw an exception if the subschema will be synced
 Lines 900-906   class ucs: Link Here 
900
							return False
900
							return False
901
						else:
901
						else:
902
							return True
902
							return True
903
					except (ldap.SERVER_DOWN, SystemExit):
903
					except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
904
						raise
904
						raise
905
					except ldap.NO_SUCH_OBJECT:
905
					except ldap.NO_SUCH_OBJECT:
906
						self._save_rejected_ucs(filename, dn)
906
						self._save_rejected_ucs(filename, dn)
 Lines 937-943   class ucs: Link Here 
937
				return None
937
				return None
938
			except ldap.INVALID_SYNTAX:
938
			except ldap.INVALID_SYNTAX:
939
				return None
939
				return None
940
			except (ldap.SERVER_DOWN, SystemExit):
940
			except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
941
				self.open_ucs()
941
				self.open_ucs()
942
				continue
942
				continue
943
943
 Lines 957-963   class ucs: Link Here 
957
				return None
957
				return None
958
			except ldap.INVALID_SYNTAX:
958
			except ldap.INVALID_SYNTAX:
959
				return None
959
				return None
960
			except (ldap.SERVER_DOWN, SystemExit):
960
			except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
961
				self.open_ucs()
961
				self.open_ucs()
962
				continue
962
				continue
963
963
 Lines 986-992   class ucs: Link Here 
986
986
987
			ucs_object = univention.admin.objects.get(module, co=None, lo=self.lo, position='', dn=searchdn)
987
			ucs_object = univention.admin.objects.get(module, co=None, lo=self.lo, position='', dn=searchdn)
988
			ud.debug(ud.LDAP, ud.INFO, "get_ucs_object: object found: %s" % searchdn)
988
			ud.debug(ud.LDAP, ud.INFO, "get_ucs_object: object found: %s" % searchdn)
989
		except (ldap.SERVER_DOWN, SystemExit):
989
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
990
			raise
990
			raise
991
		except:  # FIXME: which exception is to be caught?
991
		except:  # FIXME: which exception is to be caught?
992
			ud.debug(ud.LDAP, ud.INFO, "get_ucs_object: object search failed: %s" % searchdn)
992
			ud.debug(ud.LDAP, ud.INFO, "get_ucs_object: object search failed: %s" % searchdn)
 Lines 1057-1063   class ucs: Link Here 
1057
							pass
1057
							pass
1058
						self._remove_rejected_ucs(filename)
1058
						self._remove_rejected_ucs(filename)
1059
						change_counter += 1
1059
						change_counter += 1
1060
				except (ldap.SERVER_DOWN, SystemExit):
1060
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1061
					raise
1061
					raise
1062
				except:  # FIXME: which exception is to be caught?
1062
				except:  # FIXME: which exception is to be caught?
1063
					self._save_rejected_ucs(filename, dn)
1063
					self._save_rejected_ucs(filename, dn)
 Lines 1118-1124   class ucs: Link Here 
1118
					for i in [0, 1]:  # do it twice if the LDAP connection was closed
1118
					for i in [0, 1]:  # do it twice if the LDAP connection was closed
1119
						try:
1119
						try:
1120
							sync_successfull = self.__sync_file_from_ucs(filename, traceback_level=traceback_level)
1120
							sync_successfull = self.__sync_file_from_ucs(filename, traceback_level=traceback_level)
1121
						except (ldap.SERVER_DOWN, SystemExit):
1121
						except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1122
							# once again, ldap idletimeout ...
1122
							# once again, ldap idletimeout ...
1123
							if i == 0:
1123
							if i == 0:
1124
								self.open_ucs()
1124
								self.open_ucs()
 Lines 1381-1387   class ucs: Link Here 
1381
				return True
1381
				return True
1382
			else:
1382
			else:
1383
				ud.debug(ud.LDAP, ud.INFO, "move_in_ucs: move object from %s to %s" % (object['olddn'], object['dn']))
1383
				ud.debug(ud.LDAP, ud.INFO, "move_in_ucs: move object from %s to %s" % (object['olddn'], object['dn']))
1384
		except (ldap.SERVER_DOWN, SystemExit):
1384
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1385
			raise
1385
			raise
1386
		except:  # FIXME: which exception is to be caught?
1386
		except:  # FIXME: which exception is to be caught?
1387
			ud.debug(ud.LDAP, ud.INFO, "move_in_ucs: move object in UCS")
1387
			ud.debug(ud.LDAP, ud.INFO, "move_in_ucs: move object in UCS")
 Lines 1475-1481   class ucs: Link Here 
1475
						if not self.sync_to_ucs(key, subobject_ucs, back_mapped_subobject['dn'], object):
1475
						if not self.sync_to_ucs(key, subobject_ucs, back_mapped_subobject['dn'], object):
1476
							try:
1476
							try:
1477
								ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed: %s" % result[0])
1477
								ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed: %s" % result[0])
1478
							except (ldap.SERVER_DOWN, SystemExit):
1478
							except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1479
								raise
1479
								raise
1480
							except:  # FIXME: which exception is to be caught?
1480
							except:  # FIXME: which exception is to be caught?
1481
								ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed")
1481
								ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed")
 Lines 1508-1514   class ucs: Link Here 
1508
1508
1509
		try:
1509
		try:
1510
			ud.debug(ud.LDAP, ud.PROCESS, 'sync to ucs:   [%14s] [%10s] %s' % (property_type, object['modtype'], object['dn']))
1510
			ud.debug(ud.LDAP, ud.PROCESS, 'sync to ucs:   [%14s] [%10s] %s' % (property_type, object['modtype'], object['dn']))
1511
		except (ldap.SERVER_DOWN, SystemExit):
1511
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1512
			raise
1512
			raise
1513
		except:  # FIXME: which exception is to be caught?
1513
		except:  # FIXME: which exception is to be caught?
1514
			ud.debug(ud.LDAP, ud.PROCESS, 'sync to ucs...')
1514
			ud.debug(ud.LDAP, ud.PROCESS, 'sync to ucs...')
 Lines 1610-1616   class ucs: Link Here 
1610
						ud.debug(ud.LDAP, ud.INFO, "Call post_ucs_modify_functions: %s" % f)
1610
						ud.debug(ud.LDAP, ud.INFO, "Call post_ucs_modify_functions: %s" % f)
1611
						f(self, property_type, object)
1611
						f(self, property_type, object)
1612
						ud.debug(ud.LDAP, ud.INFO, "Call post_ucs_modify_functions: %s (done)" % f)
1612
						ud.debug(ud.LDAP, ud.INFO, "Call post_ucs_modify_functions: %s (done)" % f)
1613
			except (ldap.SERVER_DOWN, SystemExit):
1613
			except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1614
				raise
1614
				raise
1615
			except:  # FIXME: which exception is to be caught?
1615
			except:  # FIXME: which exception is to be caught?
1616
				self._debug_traceback(ud.ERROR, "failed in post_con_modify_functions")
1616
				self._debug_traceback(ud.ERROR, "failed in post_con_modify_functions")
 Lines 1633-1639   class ucs: Link Here 
1633
		except univention.admin.uexceptions.valueMayNotChange, msg:
1633
		except univention.admin.uexceptions.valueMayNotChange, msg:
1634
			ud.debug(ud.LDAP, ud.ERROR, "Value may not change: %s (%s)" % (msg, object['dn']))
1634
			ud.debug(ud.LDAP, ud.ERROR, "Value may not change: %s (%s)" % (msg, object['dn']))
1635
			return False
1635
			return False
1636
		except (ldap.SERVER_DOWN, SystemExit):
1636
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1637
			raise
1637
			raise
1638
		except:  # FIXME: which exception is to be caught?
1638
		except:  # FIXME: which exception is to be caught?
1639
			self._debug_traceback(ud.ERROR, "Unknown Exception during sync_to_ucs")
1639
			self._debug_traceback(ud.ERROR, "Unknown Exception during sync_to_ucs")
 Lines 1716-1722   class ucs: Link Here 
1716
							return True
1716
							return True
1717
						else:
1717
						else:
1718
							return False
1718
							return False
1719
					except (ldap.SERVER_DOWN, SystemExit):
1719
					except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1720
						raise
1720
						raise
1721
					except:
1721
					except:
1722
						ud.debug(ud.LDAP, ud.WARN, "attribute_filter: Failed to convert attributes for bitwise filter")
1722
						ud.debug(ud.LDAP, ud.WARN, "attribute_filter: Failed to convert attributes for bitwise filter")
(-)a/services/univention-s4-connector/modules/univention/s4connector/s4/__init__.py (-17 / +17 lines)
 Lines 192-198   def encode_s4_object(s4_object): Link Here 
192
			else:
192
			else:
193
				try:
193
				try:
194
					s4_object[key] = encode_attriblist(s4_object[key])
194
					s4_object[key] = encode_attriblist(s4_object[key])
195
				except (ldap.SERVER_DOWN, SystemExit):
195
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
196
					raise
196
					raise
197
				except:  # FIXME: which exception is to be caught?
197
				except:  # FIXME: which exception is to be caught?
198
					ud.debug(ud.LDAP, ud.WARN, "encode_s4_object: encode attrib %s failed, ignored!" % key)
198
					ud.debug(ud.LDAP, ud.WARN, "encode_s4_object: encode attrib %s failed, ignored!" % key)
 Lines 1123-1129   class s4(univention.s4connector.ucs): Link Here 
1123
				except:  # FIXME: which exception is to be caught?
1123
				except:  # FIXME: which exception is to be caught?
1124
					ud.debug(ud.LDAP, ud.INFO, "get_object: got object: <print failed>")
1124
					ud.debug(ud.LDAP, ud.INFO, "get_object: got object: <print failed>")
1125
				return dn
1125
				return dn
1126
			except (ldap.SERVER_DOWN, SystemExit):
1126
			except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1127
				if i == 0:
1127
				if i == 0:
1128
					self.open_s4()
1128
					self.open_s4()
1129
					continue
1129
					continue
 Lines 1191-1197   class s4(univention.s4connector.ucs): Link Here 
1191
				except:  # FIXME: which exception is to be caught?
1191
				except:  # FIXME: which exception is to be caught?
1192
					ud.debug(ud.LDAP, ud.INFO, "get_object: got object: <print failed>")
1192
					ud.debug(ud.LDAP, ud.INFO, "get_object: got object: <print failed>")
1193
				return encode_s4_object(s4_object)
1193
				return encode_s4_object(s4_object)
1194
			except (ldap.SERVER_DOWN, SystemExit):
1194
			except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1195
				if i == 0:
1195
				if i == 0:
1196
					self.open_s4()
1196
					self.open_s4()
1197
					continue
1197
					continue
 Lines 1320-1326   class s4(univention.s4connector.ucs): Link Here 
1320
			else:
1320
			else:
1321
				# Every object has got a uSNCreated
1321
				# Every object has got a uSNCreated
1322
				returnObjects = search_s4_changes_by_attribute('uSNCreated', lastUSN + 1)
1322
				returnObjects = search_s4_changes_by_attribute('uSNCreated', lastUSN + 1)
1323
		except (ldap.SERVER_DOWN, SystemExit):
1323
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1324
			raise
1324
			raise
1325
		except ldap.SIZELIMIT_EXCEEDED:
1325
		except ldap.SIZELIMIT_EXCEEDED:
1326
			# The LDAP control page results was not sucessful. Without this control
1326
			# The LDAP control page results was not sucessful. Without this control
 Lines 1735-1741   class s4(univention.s4connector.ucs): Link Here 
1735
						s4_members_from_ucs.add(s4_dn.lower())
1735
						s4_members_from_ucs.add(s4_dn.lower())
1736
						self.group_member_mapping_cache_ucs[member_dn.lower()] = s4_dn
1736
						self.group_member_mapping_cache_ucs[member_dn.lower()] = s4_dn
1737
						self.__group_cache_ucs_append_member(object_ucs_dn, member_dn)
1737
						self.__group_cache_ucs_append_member(object_ucs_dn, member_dn)
1738
				except (ldap.SERVER_DOWN, SystemExit):
1738
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1739
					raise
1739
					raise
1740
				except:  # FIXME: which exception is to be caught?
1740
				except:  # FIXME: which exception is to be caught?
1741
					ud.debug(ud.LDAP, ud.INFO, "group_members_sync_from_ucs: failed to get S4 dn for UCS group member %s, assume object doesn't exist" % member_dn)
1741
					ud.debug(ud.LDAP, ud.INFO, "group_members_sync_from_ucs: failed to get S4 dn for UCS group member %s, assume object doesn't exist" % member_dn)
 Lines 1759-1765   class s4(univention.s4connector.ucs): Link Here 
1759
						## Keep the member in Samba/AD if it's also present in OpenLDAP but ignored in synchronization?
1759
						## Keep the member in Samba/AD if it's also present in OpenLDAP but ignored in synchronization?
1760
						s4_members_from_ucs.add(member_dn.lower())
1760
						s4_members_from_ucs.add(member_dn.lower())
1761
						ud.debug(ud.LDAP, ud.INFO, "group_members_sync_from_ucs: Object ignored in S4 [%s], key = [%s]" % (ucs_dn, mo_key))
1761
						ud.debug(ud.LDAP, ud.INFO, "group_members_sync_from_ucs: Object ignored in S4 [%s], key = [%s]" % (ucs_dn, mo_key))
1762
				except (ldap.SERVER_DOWN, SystemExit):
1762
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1763
					raise
1763
					raise
1764
				except:  # FIXME: which exception is to be caught?
1764
				except:  # FIXME: which exception is to be caught?
1765
					self._debug_traceback(ud.INFO, "group_members_sync_from_ucs: failed to get UCS dn for S4 group member %s" % member_dn)
1765
					self._debug_traceback(ud.INFO, "group_members_sync_from_ucs: failed to get UCS dn for S4 group member %s" % member_dn)
 Lines 1826-1832   class s4(univention.s4connector.ucs): Link Here 
1826
			ud.debug(ud.LDAP, ud.ALL, "group_members_sync_from_ucs: modlist: %s" % modlist_members)
1826
			ud.debug(ud.LDAP, ud.ALL, "group_members_sync_from_ucs: modlist: %s" % modlist_members)
1827
			try:
1827
			try:
1828
				self.lo_s4.lo.modify_s(compatible_modstring(object['dn']), [(ldap.MOD_REPLACE, 'member', modlist_members)])
1828
				self.lo_s4.lo.modify_s(compatible_modstring(object['dn']), [(ldap.MOD_REPLACE, 'member', modlist_members)])
1829
			except (ldap.SERVER_DOWN, SystemExit):
1829
			except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
1830
				raise
1830
				raise
1831
			except:  # FIXME: which exception is to be caught?
1831
			except:  # FIXME: which exception is to be caught?
1832
				ud.debug(ud.LDAP, ud.WARN, "group_members_sync_from_ucs: failed to sync members: (%s,%s)" % (object['dn'], [(ldap.MOD_REPLACE, 'member', modlist_members)]))
1832
				ud.debug(ud.LDAP, ud.WARN, "group_members_sync_from_ucs: failed to sync members: (%s,%s)" % (object['dn'], [(ldap.MOD_REPLACE, 'member', modlist_members)]))
 Lines 2013-2019   class s4(univention.s4connector.ucs): Link Here 
2013
							self.__group_cache_con_append_member(s4_object_dn, member_dn)
2013
							self.__group_cache_con_append_member(s4_object_dn, member_dn)
2014
						else:
2014
						else:
2015
							ud.debug(ud.LDAP, ud.INFO, "Failed to find %s via self.lo.get" % ucs_dn)
2015
							ud.debug(ud.LDAP, ud.INFO, "Failed to find %s via self.lo.get" % ucs_dn)
2016
					except (ldap.SERVER_DOWN, SystemExit):
2016
					except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2017
						raise
2017
						raise
2018
					except:  # FIXME: which exception is to be caught?
2018
					except:  # FIXME: which exception is to be caught?
2019
						ud.debug(ud.LDAP, ud.INFO, "group_members_sync_to_ucs: failed to get UCS dn for S4 group member %s, assume object doesn't exist" % member_dn)
2019
						ud.debug(ud.LDAP, ud.INFO, "group_members_sync_to_ucs: failed to get UCS dn for S4 group member %s, assume object doesn't exist" % member_dn)
 Lines 2047-2053   class s4(univention.s4connector.ucs): Link Here 
2047
								ucs_members_from_s4[k].append(member_dn_lower)
2047
								ucs_members_from_s4[k].append(member_dn_lower)
2048
							break
2048
							break
2049
2049
2050
				except (ldap.SERVER_DOWN, SystemExit):
2050
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2051
					raise
2051
					raise
2052
				except:  # FIXME: which exception is to be caught?
2052
				except:  # FIXME: which exception is to be caught?
2053
					self._debug_traceback(ud.INFO, "group_members_sync_to_ucs: failed to get S4 dn for UCS group member %s" % member_dn)
2053
					self._debug_traceback(ud.INFO, "group_members_sync_to_ucs: failed to get S4 dn for UCS group member %s" % member_dn)
 Lines 2254-2260   class s4(univention.s4connector.ucs): Link Here 
2254
								sync_successfull = self.sync_to_ucs(property_key, mapped_object, dn, object)
2254
								sync_successfull = self.sync_to_ucs(property_key, mapped_object, dn, object)
2255
							else:
2255
							else:
2256
								sync_successfull = True
2256
								sync_successfull = True
2257
						except (ldap.SERVER_DOWN, SystemExit):
2257
						except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2258
							raise
2258
							raise
2259
						except:  # FIXME: which exception is to be caught?
2259
						except:  # FIXME: which exception is to be caught?
2260
							self._debug_traceback(ud.ERROR, "sync of rejected object failed \n\t%s" % (object['dn']))
2260
							self._debug_traceback(ud.ERROR, "sync of rejected object failed \n\t%s" % (object['dn']))
 Lines 2264-2270   class s4(univention.s4connector.ucs): Link Here 
2264
							self._remove_rejected(id)
2264
							self._remove_rejected(id)
2265
							self.__update_lastUSN(object)
2265
							self.__update_lastUSN(object)
2266
							self._set_DN_for_GUID(elements[0][1]['objectGUID'][0], elements[0][0])
2266
							self._set_DN_for_GUID(elements[0][1]['objectGUID'][0], elements[0][0])
2267
				except (ldap.SERVER_DOWN, SystemExit):
2267
				except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2268
					raise
2268
					raise
2269
				except Exception, msg:
2269
				except Exception, msg:
2270
					self._debug_traceback(ud.ERROR, "unexpected Error during s4.resync_rejected")
2270
					self._debug_traceback(ud.ERROR, "unexpected Error during s4.resync_rejected")
 Lines 2282-2288   class s4(univention.s4connector.ucs): Link Here 
2282
		changes = []
2282
		changes = []
2283
		try:
2283
		try:
2284
			changes = self.__search_s4_changes(show_deleted=show_deleted)
2284
			changes = self.__search_s4_changes(show_deleted=show_deleted)
2285
		except (ldap.SERVER_DOWN, SystemExit):
2285
		except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2286
			raise
2286
			raise
2287
		except:  # FIXME: which exception is to be caught?
2287
		except:  # FIXME: which exception is to be caught?
2288
			self._debug_traceback(ud.WARN, "Exception during search_s4_changes")
2288
			self._debug_traceback(ud.WARN, "Exception during search_s4_changes")
 Lines 2299-2305   class s4(univention.s4connector.ucs): Link Here 
2299
		# Check if the connection to UCS ldap exists. Otherwise re-create the session.
2299
		# Check if the connection to UCS ldap exists. Otherwise re-create the session.
2300
		try:
2300
		try:
2301
			self.search_ucs(scope=ldap.SCOPE_BASE)
2301
			self.search_ucs(scope=ldap.SCOPE_BASE)
2302
		except ldap.SERVER_DOWN:
2302
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
2303
			ud.debug(ud.LDAP, ud.INFO, "UCS LDAP connection was closed, re-open the connection.")
2303
			ud.debug(ud.LDAP, ud.INFO, "UCS LDAP connection was closed, re-open the connection.")
2304
			self.open_ucs()
2304
			self.open_ucs()
2305
2305
 Lines 2346-2352   class s4(univention.s4connector.ucs): Link Here 
2346
							sync_successfull = self.sync_to_ucs(property_key, mapped_object, object['dn'], object)
2346
							sync_successfull = self.sync_to_ucs(property_key, mapped_object, object['dn'], object)
2347
						else:
2347
						else:
2348
							sync_successfull = True
2348
							sync_successfull = True
2349
					except ldap.SERVER_DOWN:
2349
					except (ldap.SERVER_DOWN, ldap.TIMEOUT):
2350
						ud.debug(ud.LDAP, ud.ERROR, "Got server downn during sync, re-open ucs and s4 the connection")
2350
						ud.debug(ud.LDAP, ud.ERROR, "Got server downn during sync, re-open ucs and s4 the connection")
2351
						time.sleep(1)
2351
						time.sleep(1)
2352
						self.open_ucs()
2352
						self.open_ucs()
 Lines 2378-2384   class s4(univention.s4connector.ucs): Link Here 
2378
						try:
2378
						try:
2379
							GUID = old_element[1]['objectGUID'][0]
2379
							GUID = old_element[1]['objectGUID'][0]
2380
							self._set_DN_for_GUID(GUID, old_element[0])
2380
							self._set_DN_for_GUID(GUID, old_element[0])
2381
						except (ldap.SERVER_DOWN, SystemExit):
2381
						except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2382
							raise
2382
							raise
2383
						except:  # FIXME: which exception is to be caught?
2383
						except:  # FIXME: which exception is to be caught?
2384
							self._debug_traceback(ud.WARN, "Exception during set_DN_for_GUID")
2384
							self._debug_traceback(ud.WARN, "Exception during set_DN_for_GUID")
 Lines 2446-2452   class s4(univention.s4connector.ucs): Link Here 
2446
			# the old object was moved in UCS, but does this object exist in S4?
2446
			# the old object was moved in UCS, but does this object exist in S4?
2447
			try:
2447
			try:
2448
				old_object = self.lo_s4.lo.search_ext_s(compatible_modstring(old_dn), ldap.SCOPE_BASE, 'objectClass=*', timeout=-1, sizelimit=0)
2448
				old_object = self.lo_s4.lo.search_ext_s(compatible_modstring(old_dn), ldap.SCOPE_BASE, 'objectClass=*', timeout=-1, sizelimit=0)
2449
			except (ldap.SERVER_DOWN, SystemExit):
2449
			except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2450
				raise
2450
				raise
2451
			except:
2451
			except:
2452
				old_object = None
2452
				old_object = None
 Lines 2812-2818   class s4(univention.s4connector.ucs): Link Here 
2812
					if not self.sync_from_ucs(key, subobject_s4, back_mapped_subobject['dn']):
2812
					if not self.sync_from_ucs(key, subobject_s4, back_mapped_subobject['dn']):
2813
						try:
2813
						try:
2814
							ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed: %s" % result[0])
2814
							ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed: %s" % result[0])
2815
						except (ldap.SERVER_DOWN, SystemExit):
2815
						except (ldap.SERVER_DOWN, ldap.TIMEOUT, SystemExit):
2816
							raise
2816
							raise
2817
						except:  # FIXME: which exception is to be caught?
2817
						except:  # FIXME: which exception is to be caught?
2818
							ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed")
2818
							ud.debug(ud.LDAP, ud.WARN, "delete of subobject failed")
(-)a/services/univention-s4-connector/modules/univention/s4connector/s4/main.py (-6 / +6 lines)
 Lines 166-172   def connect(): Link Here 
166
				baseConfig['%s/s4/listener/dir' % CONFIGBASENAME]
166
				baseConfig['%s/s4/listener/dir' % CONFIGBASENAME]
167
			)
167
			)
168
			s4_init = True
168
			s4_init = True
169
		except ldap.SERVER_DOWN:
169
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
170
			print "Warning: Can't initialize LDAP-Connections, wait..."
170
			print "Warning: Can't initialize LDAP-Connections, wait..."
171
			sys.stdout.flush()
171
			sys.stdout.flush()
172
			time.sleep(poll_sleep)
172
			time.sleep(poll_sleep)
 Lines 179-185   def connect(): Link Here 
179
		try:
179
		try:
180
			s4.initialize_ucs()
180
			s4.initialize_ucs()
181
			ucs_init = True
181
			ucs_init = True
182
		except ldap.SERVER_DOWN:
182
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
183
			print "Can't contact LDAP server during ucs-poll, sync not possible."
183
			print "Can't contact LDAP server during ucs-poll, sync not possible."
184
			sys.stdout.flush()
184
			sys.stdout.flush()
185
			time.sleep(poll_sleep)
185
			time.sleep(poll_sleep)
 Lines 190-196   def connect(): Link Here 
190
		try:
190
		try:
191
			s4.initialize()
191
			s4.initialize()
192
			s4_init = True
192
			s4_init = True
193
		except ldap.SERVER_DOWN:
193
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
194
			print "Can't contact LDAP server during ucs-poll, sync not possible."
194
			print "Can't contact LDAP server during ucs-poll, sync not possible."
195
			sys.stdout.flush()
195
			sys.stdout.flush()
196
			time.sleep(poll_sleep)
196
			time.sleep(poll_sleep)
 Lines 214-220   def connect(): Link Here 
214
					continue
214
					continue
215
				else:
215
				else:
216
					break
216
					break
217
			except ldap.SERVER_DOWN:
217
			except (ldap.SERVER_DOWN, ldap.TIMEOUT):
218
				print "Can't contact LDAP server during ucs-poll, sync not possible."
218
				print "Can't contact LDAP server during ucs-poll, sync not possible."
219
				connected = False
219
				connected = False
220
				sys.stdout.flush()
220
				sys.stdout.flush()
 Lines 230-236   def connect(): Link Here 
230
					continue
230
					continue
231
				else:
231
				else:
232
					break
232
					break
233
			except ldap.SERVER_DOWN:
233
			except (ldap.SERVER_DOWN, ldap.TIMEOUT):
234
				print "Can't contact LDAP server during s4-poll, sync not possible."
234
				print "Can't contact LDAP server during s4-poll, sync not possible."
235
				connected = False
235
				connected = False
236
				sys.stdout.flush()
236
				sys.stdout.flush()
 Lines 243-249   def connect(): Link Here 
243
				retry_rejected = 0
243
				retry_rejected = 0
244
			else:
244
			else:
245
				retry_rejected += 1
245
				retry_rejected += 1
246
		except ldap.SERVER_DOWN:
246
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
247
			print "Can't contact LDAP server during resync rejected, sync not possible."
247
			print "Can't contact LDAP server during resync rejected, sync not possible."
248
			connected = False
248
			connected = False
249
			sys.stdout.flush()
249
			sys.stdout.flush()
(-)a/services/univention-s4-connector/scripts/adjust_obsolete_gpo_and_wmi_rejects (-1 / +1 lines)
 Lines 230-236   def connect(): Link Here 
230
			configRegistry['%s/s4/ldap/certificate' % CONFIGBASENAME],
230
			configRegistry['%s/s4/ldap/certificate' % CONFIGBASENAME],
231
			configRegistry['%s/s4/listener/dir' % CONFIGBASENAME]
231
			configRegistry['%s/s4/listener/dir' % CONFIGBASENAME]
232
		)
232
		)
233
	except ldap.SERVER_DOWN:
233
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
234
		print "ERROR: Can't initialize LDAP-Connections."
234
		print "ERROR: Can't initialize LDAP-Connections."
235
		raise
235
		raise
236
236
(-)a/services/univention-s4-connector/sync_krbtgt (-10 / +10 lines)
 Lines 92-100   class S4: Link Here 
92
		try:
92
		try:
93
			self.lo_s4 = univention.uldap.access(host=ldap_host_s4, port=ldap_port_s4, base=self.ldap_base_s4, binddn=ldap_binddn_s4, bindpw=ldap_bindpw_s4, start_tls=tls_mode, ca_certfile=ldap_certificate_s4, decode_ignorelist=['objectSid', 'objectGUID', 'repsFrom', 'replUpToDateVector', 'ipsecData', 'logonHours', 'userCertificate', 'dNSProperty', 'dnsRecord', 'member', 'unicodePwd'], uri=ldap_uri_s4)
93
			self.lo_s4 = univention.uldap.access(host=ldap_host_s4, port=ldap_port_s4, base=self.ldap_base_s4, binddn=ldap_binddn_s4, bindpw=ldap_bindpw_s4, start_tls=tls_mode, ca_certfile=ldap_certificate_s4, decode_ignorelist=['objectSid', 'objectGUID', 'repsFrom', 'replUpToDateVector', 'ipsecData', 'logonHours', 'userCertificate', 'dNSProperty', 'dnsRecord', 'member', 'unicodePwd'], uri=ldap_uri_s4)
94
			self.lo_s4.lo.set_option(ldap.OPT_REFERRALS, 0)
94
			self.lo_s4.lo.set_option(ldap.OPT_REFERRALS, 0)
95
		except ldap.SERVER_DOWN:
95
		except (ldap.SERVER_DOWN, ldap.TIMEOUT) as exc:
96
			print "Can't initialize Samba4 LDAP connection"
96
			print "Can't initialize Samba4 LDAP connection (%s)" % exc.args[0]
97
			raise ldap.SERVER_DOWN
97
			raise
98
98
99
	def open_ucs(self, binddn, bindpwd):
99
	def open_ucs(self, binddn, bindpwd):
100
		if not binddn:
100
		if not binddn:
 Lines 110-118   class S4: Link Here 
110
110
111
		try:
111
		try:
112
			self.lo = univention.admin.uldap.access(host=self.ucr['ldap/master'], base=self.ucr['ldap/base'], binddn=binddn, bindpw=bindpwd, start_tls=2)
112
			self.lo = univention.admin.uldap.access(host=self.ucr['ldap/master'], base=self.ucr['ldap/base'], binddn=binddn, bindpw=bindpwd, start_tls=2)
113
		except ldap.SERVER_DOWN:
113
        except (ldap.SERVER_DOWN, ldap.TIMEOUT) as exc:
114
			print "Can't initialize UCS LDAP connection"
114
			print "Can't initialize UCS LDAP connection (%s)" % exc.args[0]
115
			raise ldap.SERVER_DOWN
115
			raise
116
116
117
	def _object_mapping(self, key, object, connection):
117
	def _object_mapping(self, key, object, connection):
118
		return key
118
		return key
 Lines 135-143   class S4: Link Here 
135
			ud.debug(ud.LDAP, ud.PROCESS, "The Samba4 user (krbtgt) was not found.")
135
			ud.debug(ud.LDAP, ud.PROCESS, "The Samba4 user (krbtgt) was not found.")
136
			print "The Samba4 user (krbtgt) was not found."
136
			print "The Samba4 user (krbtgt) was not found."
137
			return
137
			return
138
		except ldap.SERVER_DOWN:
138
		except (ldap.SERVER_DOWN, ldap.TIMEOUT) as exc:
139
			print "Can't initialize Samba4 LDAP connection"
139
			print "Can't initialize Samba4 LDAP connection (%s)" % exc.args[0]
140
			raise ldap.SERVER_DOWN
140
			raise
141
		if not res_s4:
141
		if not res_s4:
142
			ud.debug(ud.LDAP, ud.PROCESS, " The Samba4 user (krbtgt) was not found." % username)
142
			ud.debug(ud.LDAP, ud.PROCESS, " The Samba4 user (krbtgt) was not found." % username)
143
			print "\nThe Samba4 user (krbtgt) was not found." % username
143
			print "\nThe Samba4 user (krbtgt) was not found." % username
 Lines 194-200   def main(): Link Here 
194
	try:
194
	try:
195
		s4 = S4(options.ucrbase, options.binddn, options.bindpwd)
195
		s4 = S4(options.ucrbase, options.binddn, options.bindpwd)
196
		s4.sync_password()
196
		s4.sync_password()
197
	except ldap.SERVER_DOWN:
197
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
198
		sys.exit(1)
198
		sys.exit(1)
199
199
200
200
(-)a/services/univention-s4-connector/univention-password_sync_ucs_to_s4 (-10 / +10 lines)
 Lines 92-100   class S4: Link Here 
92
		try:
92
		try:
93
			self.lo_s4 = univention.uldap.access(host=ldap_host_s4, port=ldap_port_s4, base=self.ldap_base_s4, binddn=ldap_binddn_s4, bindpw=ldap_bindpw_s4, start_tls=tls_mode, ca_certfile=ldap_certificate_s4, decode_ignorelist=['objectSid', 'objectGUID', 'repsFrom', 'replUpToDateVector', 'ipsecData', 'logonHours', 'userCertificate', 'dNSProperty', 'dnsRecord', 'member', 'unicodePwd'], uri=ldap_uri_s4)
93
			self.lo_s4 = univention.uldap.access(host=ldap_host_s4, port=ldap_port_s4, base=self.ldap_base_s4, binddn=ldap_binddn_s4, bindpw=ldap_bindpw_s4, start_tls=tls_mode, ca_certfile=ldap_certificate_s4, decode_ignorelist=['objectSid', 'objectGUID', 'repsFrom', 'replUpToDateVector', 'ipsecData', 'logonHours', 'userCertificate', 'dNSProperty', 'dnsRecord', 'member', 'unicodePwd'], uri=ldap_uri_s4)
94
			self.lo_s4.lo.set_option(ldap.OPT_REFERRALS, 0)
94
			self.lo_s4.lo.set_option(ldap.OPT_REFERRALS, 0)
95
		except ldap.SERVER_DOWN:
95
        except (ldap.SERVER_DOWN, ldap.TIMEOUT) as exc:
96
			print "Can't initialize Samba4 LDAP connection"
96
			print "Can't initialize Samba4 LDAP connection (%s)" % exc.args[0]
97
			raise ldap.SERVER_DOWN
97
			raise
98
98
99
	def open_ucs(self, binddn, bindpwd):
99
	def open_ucs(self, binddn, bindpwd):
100
		if not binddn:
100
		if not binddn:
 Lines 110-118   class S4: Link Here 
110
110
111
		try:
111
		try:
112
			self.lo = univention.admin.uldap.access(host=self.ucr['ldap/master'], base=self.ucr['ldap/base'], binddn=binddn, bindpw=bindpwd, start_tls=2)
112
			self.lo = univention.admin.uldap.access(host=self.ucr['ldap/master'], base=self.ucr['ldap/base'], binddn=binddn, bindpw=bindpwd, start_tls=2)
113
		except ldap.SERVER_DOWN:
113
		except (ldap.SERVER_DOWN, ldap.TIMEOUT) as exc:
114
			print "Can't initialize UCS LDAP connection"
114
			print "Can't initialize UCS LDAP connection (%s)" % exc.args[0]
115
			raise ldap.SERVER_DOWN
115
			raise
116
116
117
	def _object_mapping(self, key, object, connection):
117
	def _object_mapping(self, key, object, connection):
118
		return key
118
		return key
 Lines 137-145   class S4: Link Here 
137
			ud.debug(ud.LDAP, ud.PROCESS, "password_ucs_to_s4: The Samba4 user (%s) was not found." % username)
137
			ud.debug(ud.LDAP, ud.PROCESS, "password_ucs_to_s4: The Samba4 user (%s) was not found." % username)
138
			print "password_ucs_to_s4: The Samba4 user (%s) was not found." % username
138
			print "password_ucs_to_s4: The Samba4 user (%s) was not found." % username
139
			return
139
			return
140
		except ldap.SERVER_DOWN:
140
        except (ldap.SERVER_DOWN, ldap.TIMEOUT) as exc:
141
			print "Can't initialize Samba4 LDAP connection"
141
			print "Can't initialize Samba4 LDAP connection (%s)" % exc.args[0]
142
			raise ldap.SERVER_DOWN
142
			raise
143
		if not res:
143
		if not res:
144
			ud.debug(ud.LDAP, ud.PROCESS, "password_ucs_to_s4: The Samba4 user (%s) was not found." % username)
144
			ud.debug(ud.LDAP, ud.PROCESS, "password_ucs_to_s4: The Samba4 user (%s) was not found." % username)
145
			print "\npassword_ucs_to_s4: The Samba4 user (%s) was not found." % username
145
			print "\npassword_ucs_to_s4: The Samba4 user (%s) was not found." % username
 Lines 167-173   def main(): Link Here 
167
	try:
167
	try:
168
		s4 = S4(options.ucrbase, options.binddn, options.bindpwd)
168
		s4 = S4(options.ucrbase, options.binddn, options.bindpwd)
169
		s4.sync_password(args[0])
169
		s4.sync_password(args[0])
170
	except ldap.SERVER_DOWN:
170
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
171
		sys.exit(1)
171
		sys.exit(1)
172
172
173
173
(-)a/test/ucs-test/tests/10_ldap/25reconnect_uldap (-2 / +2 lines)
 Lines 113-119   try: Link Here 
113
	try:
113
	try:
114
		lo = _get_connection()
114
		lo = _get_connection()
115
		_search(lo)
115
		_search(lo)
116
	except ldap.SERVER_DOWN:
116
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
117
		pass
117
		pass
118
	else:
118
	else:
119
		fail('Search was successful')
119
		fail('Search was successful')
 Lines 126-132   try: Link Here 
126
	_start_delyed(delay=11)
126
	_start_delyed(delay=11)
127
	try:
127
	try:
128
		_search(lo)
128
		_search(lo)
129
	except ldap.SERVER_DOWN:
129
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
130
		pass
130
		pass
131
	else:
131
	else:
132
		fail('Search was successful')
132
		fail('Search was successful')
(-)a/test/ucs-test/tests/10_ldap/ldap_extension_utils.py (-1 / +1 lines)
 Lines 107-113   def __fetch_schema_from_uri(ldap_uri): Link Here 
107
	while i < attempts:
107
	while i < attempts:
108
		try:
108
		try:
109
			return ldap.schema.subentry.urlfetch(ldap_uri)
109
			return ldap.schema.subentry.urlfetch(ldap_uri)
110
		except ldap.SERVER_DOWN:
110
		except (ldap.SERVER_DOWN, ldap.TIMEOUT):
111
			if i >= (attempts - 1):
111
			if i >= (attempts - 1):
112
				raise
112
				raise
113
			time.sleep(1)
113
			time.sleep(1)
(-)a/test/ucs-test/tests/52_s4connector/402check_mapping_for_single_value_samba4_attributes (-1 / +1 lines)
 Lines 86-92   def connect(): Link Here 
86
			s4_ldap_bindpw,
86
			s4_ldap_bindpw,
87
			configRegistry['%s/s4/ldap/certificate' % CONFIGBASENAME],
87
			configRegistry['%s/s4/ldap/certificate' % CONFIGBASENAME],
88
			configRegistry['%s/s4/listener/dir' % CONFIGBASENAME])
88
			configRegistry['%s/s4/listener/dir' % CONFIGBASENAME])
89
	except ldap.SERVER_DOWN:
89
	except (ldap.SERVER_DOWN, ldap.TIMEOUT):
90
		print "ERROR: Can't initialize LDAP-Connections."
90
		print "ERROR: Can't initialize LDAP-Connections."
91
		raise
91
		raise
92
92
(-)a/test/ucs-test/univention/testing/utils.py (-2 / +2 lines)
 Lines 130-138   def get_ldap_connection(pwdfile=False, start_tls=2, decode_ignorelist=None, admi Link Here 
130
            if admin_uldap:
130
            if admin_uldap:
131
                lo = access(lo=lo)
131
                lo = access(lo=lo)
132
            return lo
132
            return lo
133
        except ldap.SERVER_DOWN():
133
        except ldap.SERVER_DOWN:
134
            pass
134
            pass
135
    raise ldap.SERVER_DOWN()
135
    raise ldap.SERVER_DOWN
136
136
137
137
138
def verify_ldap_object(baseDn, expected_attr=None, strict=True, should_exist=True):
138
def verify_ldap_object(baseDn, expected_attr=None, strict=True, should_exist=True):
(-)a/virtualization/univention-virtual-machine-manager-daemon/src/univention/uvmm/uvmm_ldap.py (-3 / +3 lines)
 Lines 39-45   except ImportError: Link Here 
39
	import pickle
39
	import pickle
40
import univention.config_registry as ucr
40
import univention.config_registry as ucr
41
import univention.uldap
41
import univention.uldap
42
from ldap import LDAPError, SERVER_DOWN
42
from ldap import LDAPError, SERVER_DOWN, TIMEOUT
43
import univention.admin.uldap
43
import univention.admin.uldap
44
import univention.admin.modules
44
import univention.admin.modules
45
import univention.admin.handlers.uvmm.info as uvmm_info
45
import univention.admin.handlers.uvmm.info as uvmm_info
 Lines 171-177   def ldap_annotation(uuid): Link Here 
171
	try:
171
	try:
172
		lo, position = univention.admin.uldap.getMachineConnection(ldap_master=False)
172
		lo, position = univention.admin.uldap.getMachineConnection(ldap_master=False)
173
		base = "%s,%s" % (LDAP_INFO_RDN, position.getDn())
173
		base = "%s,%s" % (LDAP_INFO_RDN, position.getDn())
174
	except (SERVER_DOWN, IOError):
174
	except (SERVER_DOWN, TIMEOUT, IOError):
175
		raise LdapConnectionError(_('Could not open LDAP-Machine connection'))
175
		raise LdapConnectionError(_('Could not open LDAP-Machine connection'))
176
	co = None
176
	co = None
177
	dn = "%s=%s,%s" % (uvmm_info.mapping.mapName('uuid'), uuid, base)
177
	dn = "%s=%s,%s" % (uvmm_info.mapping.mapName('uuid'), uuid, base)
 Lines 190-196   def ldap_modify(uuid): Link Here 
190
	try:
190
	try:
191
		lo, position = univention.admin.uldap.getMachineConnection(ldap_master=True)
191
		lo, position = univention.admin.uldap.getMachineConnection(ldap_master=True)
192
		base = "%s,%s" % (LDAP_INFO_RDN, position.getDn())
192
		base = "%s,%s" % (LDAP_INFO_RDN, position.getDn())
193
	except (SERVER_DOWN, IOError):
193
	except (SERVER_DOWN, TIMEOUT, IOError):
194
		raise LdapConnectionError(_('Could not open LDAP-Admin connection'))
194
		raise LdapConnectionError(_('Could not open LDAP-Admin connection'))
195
	co = None
195
	co = None
196
	dn = "%s=%s,%s" % (uvmm_info.mapping.mapName('uuid'), uuid, base)
196
	dn = "%s=%s,%s" % (uvmm_info.mapping.mapName('uuid'), uuid, base)

Return to bug 47389