View | Details | Raw Unified | Return to bug 47069 | Differences between
and this patch

Collapse All | Expand All

(-)a/services/univention-ad-connector/modules/univention/connector/ad/__init__.py (-12 / +12 lines)
 Lines 773-778   class ad(univention.connector.ucs): Link Here 
773
773
774
			ud.debug(ud.LDAP, ud.PROCESS, 'Internal group membership cache was created')
774
			ud.debug(ud.LDAP, ud.PROCESS, 'Internal group membership cache was created')
775
775
776
		if self.lo_ad.binddn
777
			try:
778
				result = self.lo_ad.search(base=self.lo_ad.binddn, scope='base'):
779
				self.ad_ldap_bind_username = result[0][1]['sAMAccountName'][0]
780
			except Exception, msg:
781
				print "Failed to get SID from AD: %s" % msg
782
				sys.exit(1)
783
		else:
784
			self.ad_ldap_bind_username = self.baseConfig['%s/ad/ldap/binddn' % self.CONFIGBASENAME]
785
776
		try:
786
		try:
777
			result = self.lo_ad.search(filter='(objectclass=domain)',
787
			result = self.lo_ad.search(filter='(objectclass=domain)',
778
				base=ad_ldap_base, scope='base', attr=['objectSid'])
788
				base=ad_ldap_base, scope='base', attr=['objectSid'])
 Lines 803-820   class ad(univention.connector.ucs): Link Here 
803
813
804
	def open_drs_connection(self):
814
	def open_drs_connection(self):
805
815
806
		if self.lo_ad.binddn:
807
			bind_username = explode_unicode_dn(self.lo_ad.binddn, 1)[0]
808
		else:
809
			bind_username = self.baseConfig['%s/ad/ldap/binddn' % self.CONFIGBASENAME]
810
811
		lp = LoadParm()
816
		lp = LoadParm()
812
		net = Net(creds=None, lp=lp)
817
		net = Net(creds=None, lp=lp)
813
818
814
		repl_creds = Credentials()
819
		repl_creds = Credentials()
815
		repl_creds.guess(lp)
820
		repl_creds.guess(lp)
816
		repl_creds.set_kerberos_state(DONT_USE_KERBEROS)
821
		repl_creds.set_kerberos_state(DONT_USE_KERBEROS)
817
		repl_creds.set_username(bind_username)
822
		repl_creds.set_username(self.ad_ldap_bind_username)
818
		repl_creds.set_password(self.lo_ad.bindpw)
823
		repl_creds.set_password(self.lo_ad.bindpw)
819
824
820
		binding_options = "seal,print"
825
		binding_options = "seal,print"
 Lines 845-856   class ad(univention.connector.ucs): Link Here 
845
		creds.guess(lp)
850
		creds.guess(lp)
846
		creds.set_kerberos_state(DONT_USE_KERBEROS)
851
		creds.set_kerberos_state(DONT_USE_KERBEROS)
847
852
848
		if self.lo_ad.binddn:
853
		creds.set_username(self.ad_ldap_bind_username)
849
			bind_username = explode_unicode_dn(self.lo_ad.binddn, 1)[0]
850
		else:
851
			bind_username = self.baseConfig['%s/ad/ldap/binddn' % self.CONFIGBASENAME]
852
853
		creds.set_username(bind_username)
854
		creds.set_password(self.lo_ad.bindpw)
854
		creds.set_password(self.lo_ad.bindpw)
855
855
856
		binding_options = "\pipe\samr"
856
		binding_options = "\pipe\samr"

Return to bug 47069