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

(-)debian/univention-s4-connector.univention-config-registry-variables (+6 lines)
 Lines 124-129    Link Here 
124
Type=str
124
Type=str
125
Categories=service-adcon
125
Categories=service-adcon
126
126
127
[con.*/s4/mapping/dns/srv_record/.*/location]
128
Description[de]=Eine statische Liste von SRV Einträgen, die immer an dem angegebenen SRV Record in Samba 4 gesetzt gesetzt werden soll, unabhängig von den SRV Einträgen in UCS, beispielsweise connector/s4/mapping/dns/srv/_ldap._tcp.test.local/location='100 0 389 foobar.test.local. 100 0 389 foobar2.test.local.'
129
Description[en]=A static list of SRV locations, which should always be set at the specified SRV record in Samba 4 independent from the SRV locations in UCS, for example connector/s4/mapping/dns/srv/_ldap._tcp.test.local/location='100 0 389 foobar.test.local. 100 0 389 foobar2.test.local.'
130
Type=str
131
Categories=service-adcon
132
127
[con.*/ldap/server]
133
[con.*/ldap/server]
128
Description[de]=Der Fully Qualified Domain Name des UCS LDAP Servers. Wenn der Wert nicht gesetzt ist, wird der DC Master verwendet. Dieser Wert sollte nur im write Modus angepasst werden.
134
Description[de]=Der Fully Qualified Domain Name des UCS LDAP Servers. Wenn der Wert nicht gesetzt ist, wird der DC Master verwendet. Dieser Wert sollte nur im write Modus angepasst werden.
129
Description[en]=The fully qualified domain name of the UCS LDAP server. If the value is not set, the DC master will be used. This value should only changed in write mode.
135
Description[en]=The fully qualified domain name of the UCS LDAP server. If the value is not set, the DC master will be used. This value should only changed in write mode.
(-)modules/univention/s4connector/s4/dns.py (-10 / +45 lines)
 Lines 619-639    Link Here 
619
	# unpack the host record
619
	# unpack the host record
620
	srv=__unpack_sRVrecord(object)
620
	srv=__unpack_sRVrecord(object)
621
621
622
	# ucr set connector/s4/mapping/dns/srv/_ldap._tcp.test.local/location='100 0 389 foobar.test.local. 100 0 389 foobar2.test.local.'
623
	ucr_locations = s4connector.configRegistry.get('connector/s4/mapping/dns/srv_record/%s.%s/location' % (relativeDomainName[0],zoneName[0]))
624
	ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: ucr_locations for connector/s4/mapping/dns/srv_record/%s.%s/location: %s' % (relativeDomainName,zoneName,ucr_locations))
625
622
	# Does a host record for this zone already exist?
626
	# Does a host record for this zone already exist?
623
	searchResult=s4connector.lo.search(filter='(&(relativeDomainName=%s)(zoneName=%s))' % (relativeDomainName, zoneName), unique=1)
627
	searchResult=s4connector.lo.search(filter='(&(relativeDomainName=%s)(zoneName=%s))' % (relativeDomainName, zoneName), unique=1)
624
	if len(searchResult) > 0:
628
	if len(searchResult) > 0:
625
		superordinate=s4connector_get_superordinate('dns/srv_record', s4connector.lo, searchResult[0][0])
629
		superordinate=s4connector_get_superordinate('dns/srv_record', s4connector.lo, searchResult[0][0])
626
		newRecord= univention.admin.handlers.dns.srv_record.object(None, s4connector.lo, position=None, dn=searchResult[0][0], superordinate=superordinate, attributes=[], update_zone=False)
630
		newRecord= univention.admin.handlers.dns.srv_record.object(None, s4connector.lo, position=None, dn=searchResult[0][0], superordinate=superordinate, attributes=[], update_zone=False)
627
		newRecord.open()
631
		newRecord.open()
628
		ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: location: %s' % newRecord['location'])
632
		if ucr_locations:
629
		ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: srv     : %s' % srv)
633
			ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: do not write SRV record back from S4 to UCS because location of SRV record have been overwritten by UCR')
630
		srv.sort()
631
		newRecord['location'].sort()
632
		if srv != newRecord['location']:
633
			newRecord['location']=srv
634
			newRecord.modify()
635
		else:
634
		else:
636
			ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: do not modify host record')
635
			ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: location: %s' % newRecord['location'])
636
			ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: srv     : %s' % srv)
637
			srv.sort()
638
			newRecord['location'].sort()
639
			if srv != newRecord['location']:
640
				newRecord['location']=srv
641
				newRecord.modify()
642
			else:
643
				ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: do not modify host record')
637
	else:
644
	else:
638
		zoneDN='zoneName=%s,%s' % (zoneName, s4connector.property['dns'].ucs_default_dn)
645
		zoneDN='zoneName=%s,%s' % (zoneName, s4connector.property['dns'].ucs_default_dn)
639
646
 Lines 653-659    Link Here 
653
			protocol=protocol[1:] 
660
			protocol=protocol[1:] 
654
		ud.debug(ud.LDAP, ud.INFO, 'SRV create: service="%s" protocol="%s"' % (service, protocol))
661
		ud.debug(ud.LDAP, ud.INFO, 'SRV create: service="%s" protocol="%s"' % (service, protocol))
655
		newRecord['name']=[service, protocol]
662
		newRecord['name']=[service, protocol]
656
		newRecord['location']=srv
663
		if ucr_locations:
664
			ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: do not write SRV record back from S4 to UCS because location of SRV record have been overwritten by UCR')
665
		else:
666
			newRecord['location']=srv
657
		newRecord.create()
667
		newRecord.create()
658
	
668
	
659
669
 Lines 680-687    Link Here 
680
690
681
	dnsRecords=[]
691
	dnsRecords=[]
682
692
683
	__pack_sRVrecord(object, dnsRecords)
693
	zoneDn, zoneName=__create_default_s4_zone_dn(s4connector, object)
684
694
695
	relativeDomainName=object['attributes'].get('relativeDomainName')
696
	relativeDomainName=univention.s4connector.s4.compatible_list(relativeDomainName)
697
698
	# ucr set connector/s4/mapping/dns/srv/_ldap._tcp.test.local/location='100 0 389 foobar.test.local.'
699
	# ucr set connector/s4/mapping/dns/srv/_ldap._tcp.test.local/location='100 0 389 foobar.test.local. 100 0 389 foobar2.test.local.'
700
	ucr_locations = s4connector.configRegistry.get('connector/s4/mapping/dns/srv_record/%s.%s/location' % (relativeDomainName[0],zoneName[0]))
701
	ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: ucr_locations for connector/s4/mapping/dns/srv_record/%s.%s/location: %s' % (relativeDomainName[0],zoneName[0],ucr_locations))
702
	if ucr_locations:
703
		# Convert ucr variable
704
		priority=None; weight=None; port=None; target=None
705
		for v in ucr_locations.split(' '):
706
			# Check explicit for None, because the int values may be 0
707
			if priority == None: priority=int(v)
708
			elif weight == None: weight=int(v)
709
			elif port == None: port=int(v)
710
			elif not target: target=__remove_dot(v)
711
			if priority != None and weight != None and port != None and target:
712
				ud.debug(ud.LDAP, ud.INFO, 'priority=%d weight=%d port=%d target=%s' % (priority,weight,port,target))
713
				s=SRVRecord(target, port, priority, weight)
714
				dnsRecords.append(ndr_pack(s))
715
				priority=None; weight=None; port=None; target=None
716
717
	else:
718
		__pack_sRVrecord(object, dnsRecords)
719
685
	dnsNodeDn=s4_dns_node_base_create(s4connector, object, dnsRecords)
720
	dnsNodeDn=s4_dns_node_base_create(s4connector, object, dnsRecords)
686
721
687
	
722
	

Return to bug 27395