--- debian/univention-s4-connector.univention-config-registry-variables (Revision 33661) +++ debian/univention-s4-connector.univention-config-registry-variables (Arbeitskopie) @@ -124,6 +124,12 @@ Type=str Categories=service-adcon +[con.*/s4/mapping/dns/srv_record/.*/location] +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.' +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.' +Type=str +Categories=service-adcon + [con.*/ldap/server] 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. 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 (Revision 33661) +++ modules/univention/s4connector/s4/dns.py (Arbeitskopie) @@ -619,21 +619,28 @@ # unpack the host record srv=__unpack_sRVrecord(object) + # ucr set connector/s4/mapping/dns/srv/_ldap._tcp.test.local/location='100 0 389 foobar.test.local. 100 0 389 foobar2.test.local.' + ucr_locations = s4connector.configRegistry.get('connector/s4/mapping/dns/srv_record/%s.%s/location' % (relativeDomainName[0],zoneName[0])) + 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)) + # Does a host record for this zone already exist? searchResult=s4connector.lo.search(filter='(&(relativeDomainName=%s)(zoneName=%s))' % (relativeDomainName, zoneName), unique=1) if len(searchResult) > 0: superordinate=s4connector_get_superordinate('dns/srv_record', s4connector.lo, searchResult[0][0]) newRecord= univention.admin.handlers.dns.srv_record.object(None, s4connector.lo, position=None, dn=searchResult[0][0], superordinate=superordinate, attributes=[], update_zone=False) newRecord.open() - ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: location: %s' % newRecord['location']) - ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: srv : %s' % srv) - srv.sort() - newRecord['location'].sort() - if srv != newRecord['location']: - newRecord['location']=srv - newRecord.modify() + if ucr_locations: + 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') else: - ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: do not modify host record') + ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: location: %s' % newRecord['location']) + ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: srv : %s' % srv) + srv.sort() + newRecord['location'].sort() + if srv != newRecord['location']: + newRecord['location']=srv + newRecord.modify() + else: + ud.debug(ud.LDAP, ud.INFO, 'ucs_srv_record_create: do not modify host record') else: zoneDN='zoneName=%s,%s' % (zoneName, s4connector.property['dns'].ucs_default_dn) @@ -653,7 +660,10 @@ protocol=protocol[1:] ud.debug(ud.LDAP, ud.INFO, 'SRV create: service="%s" protocol="%s"' % (service, protocol)) newRecord['name']=[service, protocol] - newRecord['location']=srv + if ucr_locations: + 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') + else: + newRecord['location']=srv newRecord.create() @@ -680,8 +690,33 @@ dnsRecords=[] - __pack_sRVrecord(object, dnsRecords) + zoneDn, zoneName=__create_default_s4_zone_dn(s4connector, object) + relativeDomainName=object['attributes'].get('relativeDomainName') + relativeDomainName=univention.s4connector.s4.compatible_list(relativeDomainName) + + # ucr set connector/s4/mapping/dns/srv/_ldap._tcp.test.local/location='100 0 389 foobar.test.local.' + # ucr set connector/s4/mapping/dns/srv/_ldap._tcp.test.local/location='100 0 389 foobar.test.local. 100 0 389 foobar2.test.local.' + ucr_locations = s4connector.configRegistry.get('connector/s4/mapping/dns/srv_record/%s.%s/location' % (relativeDomainName[0],zoneName[0])) + 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)) + if ucr_locations: + # Convert ucr variable + priority=None; weight=None; port=None; target=None + for v in ucr_locations.split(' '): + # Check explicit for None, because the int values may be 0 + if priority == None: priority=int(v) + elif weight == None: weight=int(v) + elif port == None: port=int(v) + elif not target: target=__remove_dot(v) + if priority != None and weight != None and port != None and target: + ud.debug(ud.LDAP, ud.INFO, 'priority=%d weight=%d port=%d target=%s' % (priority,weight,port,target)) + s=SRVRecord(target, port, priority, weight) + dnsRecords.append(ndr_pack(s)) + priority=None; weight=None; port=None; target=None + + else: + __pack_sRVrecord(object, dnsRecords) + dnsNodeDn=s4_dns_node_base_create(s4connector, object, dnsRecords)