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

(-)a/management/univention-management-console-module-udm/umc/python/udm/__init__.py (-2 / +3 lines)
 Lines 267-273   def license_info(self, request, ldap_connection=None, ldap_position=None): Link Here 
267
267
268
		self.finished(request.id, license_data)
268
		self.finished(request.id, license_data)
269
269
270
	def license_import(self, request):
270
	@LDAP_Connection
271
	def license_import(self, request, ldap_connection=None, ldap_position=None):
271
		filename = None
272
		filename = None
272
		if isinstance(request.options, (list, tuple)) and request.options:
273
		if isinstance(request.options, (list, tuple)) and request.options:
273
			# file upload
274
			# file upload
 Lines 298-304   def _error(msg=None): Link Here 
298
				# check license and write it to LDAP
299
				# check license and write it to LDAP
299
				importer = LicenseImport(fd)
300
				importer = LicenseImport(fd)
300
				importer.check(ucr.get('ldap/base', ''))
301
				importer.check(ucr.get('ldap/base', ''))
301
				importer.write(self._user_dn, self._password)
302
				importer.write(ldap_connection)
302
		except (ValueError, AttributeError, LDAPError) as exc:
303
		except (ValueError, AttributeError, LDAPError) as exc:
303
			MODULE.error('License import failed (malformed LDIF): %r' % (exc, ))
304
			MODULE.error('License import failed (malformed LDIF): %r' % (exc, ))
304
			# AttributeError: missing univentionLicenseBaseDN
305
			# AttributeError: missing univentionLicenseBaseDN
(-)a/management/univention-management-console-module-udm/umc/python/udm/tools.py (-4 / +2 lines)
 Lines 103-117   def handle(self, dn, entry): Link Here 
103
		# for atr in entry:
103
		# for atr in entry:
104
		# 	self.mod_list.insert( 0, ( ldap.MOD_REPLACE, atr, entry[ atr ] ) )
104
		# 	self.mod_list.insert( 0, ( ldap.MOD_REPLACE, atr, entry[ atr ] ) )
105
105
106
	def write(self, user_dn, passwd):
106
	def write(self, ldap_connection):
107
		ldap_con = ldap.open("localhost", port=int(ucr.get('ldap/server/port', 7389)))
107
		ldap_con = ldap_connection.lo.lo
108
		ldap_con.simple_bind_s(user_dn, passwd)
109
		try:
108
		try:
110
			ldap_con.add_s(self.dn, self.addlist)
109
			ldap_con.add_s(self.dn, self.addlist)
111
		except ldap.ALREADY_EXISTS:
110
		except ldap.ALREADY_EXISTS:
112
			ldap_con.delete_s(self.dn)
111
			ldap_con.delete_s(self.dn)
113
			ldap_con.add_s(self.dn, self.addlist)
112
			ldap_con.add_s(self.dn, self.addlist)
114
		ldap_con.unbind_s()
115
113
116
114
117
def check_license(ldap_connection, ignore_core_edition=False):
115
def check_license(ldap_connection, ignore_core_edition=False):

Return to bug 39675