DNS Resolver: support both dnspython before and after 2.0.0
commit183d5d63f4b40accda3b3ffc980fea391612f964
authorAlexander Bokovoy <ab@samba.org>
Sat, 24 Oct 2020 09:17:44 +0000 (24 12:17 +0300)
committerJeremy Allison <jra@samba.org>
Mon, 26 Oct 2020 18:33:40 +0000 (26 18:33 +0000)
tree1181b9f2f8bcfe25e45e87476c62f2163bdfe49d
parentbbc065da6eaf17ace3beb6715aef6105fc2c36bc
DNS Resolver: support both dnspython before and after 2.0.0

`dnspython` 2.0.0 has many changes and several deprecations like:

```
> dns.resolver.resolve() has been added, allowing control of whether
search lists are used. dns.resolver.query() is retained for backwards
compatibility, but deprecated. The default for search list behavior can
be set at in the resolver object with the use_search_by_default
parameter. The default is False.

> dns.resolver.resolve_address() has been added, allowing easy
address-to-name lookups.
```

The new class `DNSResolver`:
- provides the compatibility layer
- defaults the previous behavior (the search list configured in the
  system's resolver configuration is used for relative names)
- defaults lifetime to 15sec (determines the number of seconds
  to spend trying to get an answer to the question)

The compatibility shim was developed by Stanislav Levin for FreeIPA and
adopted for Samba by Alexander Bokovoy.

Signed-off-by: Stanislav Levin <slev@altlinux.org>
Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
python/samba/dnsresolver.py [new file with mode: 0644]
source4/scripting/bin/samba_dnsupdate