freeipa/ipatests/test_ipapython
Thomas Woerner 77803587d6 DNSResolver: Fix use of nameservers with ports
IPA DNS zone and forwardzone commands allow to use nameservers with ports
as "SERVER_IP port PORT_NUMBER". bind is supporting this syntax, but the
Resolver in dnspython that is used to verify the list of forwarders
(nameservers) is only allowing to have IP addresses in this list. With
dnspython version 2.20 there is a new validator in dns.resolver.BaseResolver
that ensures this.

Refs:
- https://bind9.readthedocs.io/en/v9_18_4/reference.html#zone-statement-grammar
- https://github.com/rthalley/dnspython/blob/master/dns/resolver.py#L1094

ipapython/dnsutil.DNSResolver derives from dns.resolver.Resolver. The setter
for nameservers has been overloaded in the DNSResolver class to split out
the port numbers into the nameserver_ports dict { SERVER_IP: PORT_NUMBER }.
After the setter for nameservers succeeded, nameserver_ports is set.
nameserver_ports is used in the resolve() method of dns.resolver.Resolver.

Additional tests have been added to verify that nameservers and also
nameserver_ports are properly set and also valid.

Fixes: https://pagure.io/freeipa/issue/9158

Signed-off-by: Thomas Woerner <twoerner@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
2022-08-16 13:49:40 +02:00
..
__init__.py Make an ipa-tests package 2013-06-17 19:22:50 +02:00
test_certdb.py ipatests: Update NSSDatabase DBM test on non-DBM-capable installs 2021-01-29 18:06:15 +01:00
test_cookie.py handle Y2038 in timestamp to datetime conversions 2020-06-25 09:18:02 +03:00
test_directivesetter.py Add option to remove lines from a file 2019-04-02 19:35:38 +02:00
test_dn.py pylint: Fix useless-suppression 2022-03-11 13:37:08 -05:00
test_dnsutil.py DNSResolver: Fix use of nameservers with ports 2022-08-16 13:49:40 +02:00
test_ipautil.py Add helper for poll/sleep loops with timeout 2020-09-30 09:52:08 +02:00
test_ipavalidate.py pytest: Migrate unittest/nose to Pytest fixtures 2020-02-12 18:08:32 +02:00
test_kerberos.py Sprinkle raw strings across the code base 2018-09-27 10:23:03 +02:00
test_keyring.py ipatests: Skip keyring tests on containerized platforms 2020-08-07 17:49:31 +03:00
test_ldap_cache.py Return a copy of cached entries, only with requested attributes 2021-06-29 14:55:50 +03:00
test_session_storage.py pytest: Migrate xunit-style setups to Pytest fixtures 2020-02-12 18:08:32 +02:00
test_ssh.py ipatests: add test for multiple permitopen entries in SSH keys 2021-03-29 10:06:07 +03:00