Univention Bugzilla – Bug 54339
UDM dns/ptr_record list --filter ip=xx.xx.xx.xx do not work
Last modified: 2022-01-14 15:07:08 CET
Created attachment 10903 [details] patch (https://git.knut.univention.de/univention/ucs/-/merge_requests/242) (In reply to Dirk Schnick from comment #0) > A customer complained that the udm dns/ptr_record filter is not working if > ip is used. A filter on address works: > > root@dc0:~ # udm dns/ptr_record list --filter address=173 > address=173 > DN: > relativeDomainName=173,zoneName=59.200.10.in-addr.arpa,cn=dns, > dc=intranet > address: 173 > ip: 10.200.59.173 > ptr_record: xxx.intranet. > > root@dc0:~ # udm dns/ptr_record list --filter ip=10.200.59.173 > ip=10.200.59.173 The property "ip" of a dns/ptr_record is not part of the mapping and therefore not evaluated in a filter. Therefor the filter needs to be manually rewritten in the UDM module. This is not quite easy as the IP address is not part of the dns/ptr_records LDAP attributes - only the address (relativeDomainName) and the subnet reverse address (zoneName). The IP is constructed virtually. So we have to search for the host parts of the given IP address only in the reverse zones matching the subnet. But we don't know the subnet - the IP address in your filter doesn't contain a subnet mask. And in real life there could be more subnet masks as the common /8 and /16 and /24 and 32. We could search for every possible combination - but this would be a large LDAP filter. A search filter for the subnet might be constructed like: # univention-ldapsearch -LLL '(&(relativeDomainName=42)(zoneName=8.9.11.in-addr.arpa))' dn dn: relativeDomainName=42,zoneName=8.9.11.in-addr.arpa,cn=dns,l=school,l=dev Attached is a patch which works for IPv4 with 8, 16, and 24-er netmask.