Bump dnspython from 2.2.0 to 2.2.1 (#1679)

* Bump dnspython from 2.2.0 to 2.2.1

Bumps [dnspython](https://github.com/rthalley/dnspython) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/rthalley/dnspython/releases)
- [Changelog](https://github.com/rthalley/dnspython/blob/master/doc/whatsnew.rst)
- [Commits](https://github.com/rthalley/dnspython/compare/v2.2.0...v2.2.1)

---
updated-dependencies:
- dependency-name: dnspython
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update dnspython==2.2.1

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

[skip ci]
This commit is contained in:
dependabot[bot] 2022-05-16 20:33:29 -07:00 committed by GitHub
parent 54c9214b03
commit aa0c58ef0e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 88 additions and 30 deletions

View file

@ -49,7 +49,7 @@ def _immutable_init(f):
f(*args, **kwargs) f(*args, **kwargs)
finally: finally:
if not previous: if not previous:
# If we started the initialzation, establish immutability # If we started the initialization, establish immutability
# by removing the attribute that allows mutation # by removing the attribute that allows mutation
object.__delattr__(args[0], '_immutable_init') object.__delattr__(args[0], '_immutable_init')
nf.__signature__ = inspect.signature(f) nf.__signature__ = inspect.signature(f)

View file

@ -19,7 +19,7 @@ async def udp(q : message.Message, where : str,
one_rr_per_rrset : Optional[bool] = False, one_rr_per_rrset : Optional[bool] = False,
ignore_trailing : Optional[bool] = False, ignore_trailing : Optional[bool] = False,
sock : Optional[asyncbackend.DatagramSocket] = None, sock : Optional[asyncbackend.DatagramSocket] = None,
backend : Optional[asyncbackend.Backend]) -> message.Message: backend : Optional[asyncbackend.Backend] = None) -> message.Message:
pass pass
async def tcp(q : message.Message, where : str, timeout : float = None, port=53, async def tcp(q : message.Message, where : str, timeout : float = None, port=53,
@ -28,7 +28,7 @@ async def tcp(q : message.Message, where : str, timeout : float = None, port=53,
one_rr_per_rrset : Optional[bool] = False, one_rr_per_rrset : Optional[bool] = False,
ignore_trailing : Optional[bool] = False, ignore_trailing : Optional[bool] = False,
sock : Optional[asyncbackend.StreamSocket] = None, sock : Optional[asyncbackend.StreamSocket] = None,
backend : Optional[asyncbackend.Backend]) -> message.Message: backend : Optional[asyncbackend.Backend] = None) -> message.Message:
pass pass
async def tls(q : message.Message, where : str, async def tls(q : message.Message, where : str,
@ -37,7 +37,7 @@ async def tls(q : message.Message, where : str,
one_rr_per_rrset : Optional[bool] = False, one_rr_per_rrset : Optional[bool] = False,
ignore_trailing : Optional[bool] = False, ignore_trailing : Optional[bool] = False,
sock : Optional[asyncbackend.StreamSocket] = None, sock : Optional[asyncbackend.StreamSocket] = None,
backend : Optional[asyncbackend.Backend], backend : Optional[asyncbackend.Backend] = None,
ssl_context: Optional[ssl.SSLContext] = None, ssl_context: Optional[ssl.SSLContext] = None,
server_hostname: Optional[str] = None) -> message.Message: server_hostname: Optional[str] = None) -> message.Message:
pass pass

View file

@ -108,7 +108,7 @@ def key_id(key):
return total & 0xffff return total & 0xffff
class DSDigest(dns.enum.IntEnum): class DSDigest(dns.enum.IntEnum):
"""DNSSEC Delgation Signer Digest Algorithm""" """DNSSEC Delegation Signer Digest Algorithm"""
SHA1 = 1 SHA1 = 1
SHA256 = 2 SHA256 = 2

View file

@ -125,7 +125,7 @@ class TooBig(DNSException):
class Timeout(DNSException): class Timeout(DNSException):
"""The DNS operation timed out.""" """The DNS operation timed out."""
supp_kwargs = {'timeout'} supp_kwargs = {'timeout'}
fmt = "The DNS operation timed out after {timeout} seconds" fmt = "The DNS operation timed out after {timeout:.3f} seconds"
class ExceptionWrapper: class ExceptionWrapper:

View file

@ -8,3 +8,5 @@ class DNSException(Exception):
class SyntaxError(DNSException): ... class SyntaxError(DNSException): ...
class FormError(DNSException): ... class FormError(DNSException): ...
class Timeout(DNSException): ... class Timeout(DNSException): ...
class TooBig(DNSException): ...
class UnexpectedEnd(SyntaxError): ...

View file

@ -509,7 +509,7 @@ class Message:
expected to return a key. expected to return a key.
*keyname*, a ``dns.name.Name``, ``str`` or ``None``, the name of *keyname*, a ``dns.name.Name``, ``str`` or ``None``, the name of
thes TSIG key to use; defaults to ``None``. If *keyring* is a this TSIG key to use; defaults to ``None``. If *keyring* is a
``dict``, the key must be defined in it. If *keyring* is a ``dict``, the key must be defined in it. If *keyring* is a
``dns.tsig.Key``, this is ignored. ``dns.tsig.Key``, this is ignored.

View file

@ -1085,10 +1085,10 @@ def inbound_xfr(where, txn_manager, query=None,
*udp_mode*, a ``dns.query.UDPMode``, determines how UDP is used *udp_mode*, a ``dns.query.UDPMode``, determines how UDP is used
for IXFRs. The default is ``dns.UDPMode.NEVER``, i.e. only use for IXFRs. The default is ``dns.UDPMode.NEVER``, i.e. only use
TCP. Other possibilites are ``dns.UDPMode.TRY_FIRST``, which TCP. Other possibilities are ``dns.UDPMode.TRY_FIRST``, which
means "try UDP but fallback to TCP if needed", and means "try UDP but fallback to TCP if needed", and
``dns.UDPMode.ONLY``, which means "try UDP and raise ``dns.UDPMode.ONLY``, which means "try UDP and raise
``dns.xfr.UseTCP`` if it does not succeeed. ``dns.xfr.UseTCP`` if it does not succeed.
Raises on errors. Raises on errors.
""" """

View file

@ -557,7 +557,7 @@ class GenericRdata(Rdata):
raise dns.exception.SyntaxError( raise dns.exception.SyntaxError(
r'generic rdata does not start with \#') r'generic rdata does not start with \#')
length = tok.get_int() length = tok.get_int()
hex = tok.concatenate_remaining_identifiers().encode() hex = tok.concatenate_remaining_identifiers(True).encode()
data = binascii.unhexlify(hex) data = binascii.unhexlify(hex)
if len(data) != length: if len(data) != length:
raise dns.exception.SyntaxError( raise dns.exception.SyntaxError(

View file

@ -312,7 +312,7 @@ class Rdataset(dns.set.Set):
def processing_order(self): def processing_order(self):
"""Return rdatas in a valid processing order according to the type's """Return rdatas in a valid processing order according to the type's
specification. For example, MX records are in preference order from specification. For example, MX records are in preference order from
lowest to highest preferences, with items of the same perference lowest to highest preferences, with items of the same preference
shuffled. shuffled.
For types that do not define a processing order, the rdatas are For types that do not define a processing order, the rdatas are

View file

@ -63,7 +63,7 @@ class TKEY(dns.rdata.Rdata):
error = tok.get_uint16() error = tok.get_uint16()
key_b64 = tok.get_string().encode() key_b64 = tok.get_string().encode()
key = base64.b64decode(key_b64) key = base64.b64decode(key_b64)
other_b64 = tok.concatenate_remaining_identifiers().encode() other_b64 = tok.concatenate_remaining_identifiers(True).encode()
other = base64.b64decode(other_b64) other = base64.b64decode(other_b64)
return cls(rdclass, rdtype, algorithm, inception, expiration, mode, return cls(rdclass, rdtype, algorithm, inception, expiration, mode,

View file

@ -37,8 +37,12 @@ __all__ = [
'HINFO', 'HINFO',
'HIP', 'HIP',
'ISDN', 'ISDN',
'L32',
'L64',
'LOC', 'LOC',
'LP',
'MX', 'MX',
'NID',
'NINFO', 'NINFO',
'NS', 'NS',
'NSEC', 'NSEC',

View file

@ -435,7 +435,7 @@ class SVCBBase(dns.rdata.Rdata):
if not isinstance(v, Param) and v is not None: if not isinstance(v, Param) and v is not None:
raise ValueError("not a Param") raise ValueError("not a Param")
self.params = dns.immutable.Dict(params) self.params = dns.immutable.Dict(params)
# Make sure any paramater listed as mandatory is present in the # Make sure any parameter listed as mandatory is present in the
# record. # record.
mandatory = params.get(ParamKey.MANDATORY) mandatory = params.get(ParamKey.MANDATORY)
if mandatory: if mandatory:

View file

@ -1,6 +1,12 @@
import typing
from .. import rdata from .. import rdata
class TXTBase(rdata.Rdata): class TXTBase(rdata.Rdata):
strings: typing.Tuple[bytes, ...]
def __init__(self, rdclass: int, rdtype: int, strings: typing.Iterable[bytes]) -> None:
...
def to_text(self, origin: typing.Any, relativize: bool, **kw: typing.Any) -> str:
... ...
class TXT(TXTBase): class TXT(TXTBase):
... ...

View file

@ -49,8 +49,8 @@ class Renderer:
r.add_rrset(dns.renderer.ANSWER, rrset_2) r.add_rrset(dns.renderer.ANSWER, rrset_2)
r.add_rrset(dns.renderer.AUTHORITY, ns_rrset) r.add_rrset(dns.renderer.AUTHORITY, ns_rrset)
r.add_edns(0, 0, 4096) r.add_edns(0, 0, 4096)
r.add_rrset(dns.renderer.ADDTIONAL, ad_rrset_1) r.add_rrset(dns.renderer.ADDITIONAL, ad_rrset_1)
r.add_rrset(dns.renderer.ADDTIONAL, ad_rrset_2) r.add_rrset(dns.renderer.ADDITIONAL, ad_rrset_2)
r.write_header() r.write_header()
r.add_tsig(keyname, secret, 300, 1, 0, '', request_mac) r.add_tsig(keyname, secret, 300, 1, 0, '', request_mac)
wire = r.get_wire() wire = r.get_wire()

View file

@ -145,7 +145,7 @@ class LifetimeTimeout(dns.exception.Timeout):
"""The resolution lifetime expired.""" """The resolution lifetime expired."""
msg = "The resolution lifetime expired." msg = "The resolution lifetime expired."
fmt = "%s after {timeout} seconds: {errors}" % msg[:-1] fmt = "%s after {timeout:.3f} seconds: {errors}" % msg[:-1]
supp_kwargs = {'timeout', 'errors'} supp_kwargs = {'timeout', 'errors'}
def _fmt_kwargs(self, **kwargs): def _fmt_kwargs(self, **kwargs):
@ -1101,7 +1101,7 @@ class Resolver(BaseResolver):
"""Query nameservers to find the answer to the question. """Query nameservers to find the answer to the question.
This method calls resolve() with ``search=True``, and is This method calls resolve() with ``search=True``, and is
provided for backwards compatbility with prior versions of provided for backwards compatibility with prior versions of
dnspython. See the documentation for the resolve() method for dnspython. See the documentation for the resolve() method for
further details. further details.
""" """
@ -1200,7 +1200,7 @@ def query(qname, rdtype=dns.rdatatype.A, rdclass=dns.rdataclass.IN,
"""Query nameservers to find the answer to the question. """Query nameservers to find the answer to the question.
This method calls resolve() with ``search=True``, and is This method calls resolve() with ``search=True``, and is
provided for backwards compatbility with prior versions of provided for backwards compatibility with prior versions of
dnspython. See the documentation for the resolve() method for dnspython. See the documentation for the resolve() method for
further details. further details.
""" """
@ -1253,7 +1253,7 @@ def zone_for_name(name, rdclass=dns.rdataclass.IN, tcp=False, resolver=None,
root servers in your network and they are misconfigured.) root servers in your network and they are misconfigured.)
Raises ``dns.resolver.LifetimeTimeout`` if the answer could not be Raises ``dns.resolver.LifetimeTimeout`` if the answer could not be
found in the alotted lifetime. found in the allotted lifetime.
Returns a ``dns.name.Name``. Returns a ``dns.name.Name``.
""" """

View file

@ -25,7 +25,7 @@ def query(qname : str, rdtype : Union[int,str] = 0,
tcp=False, source=None, raise_on_no_answer=True, tcp=False, source=None, raise_on_no_answer=True,
source_port=0, lifetime : Optional[float]=None): source_port=0, lifetime : Optional[float]=None):
... ...
def resolve_address(self, ipaddr: str, *args: Any, **kwargs: Optional[Dict]): def resolve_address(ipaddr: str, *args: Any, **kwargs: Optional[Dict]):
... ...
class LRUCache: class LRUCache:
def __init__(self, max_size=1000): def __init__(self, max_size=1000):
@ -59,3 +59,8 @@ class Resolver:
raise_on_no_answer=True, source_port : int = 0, raise_on_no_answer=True, source_port : int = 0,
lifetime : Optional[float]=None): lifetime : Optional[float]=None):
... ...
default_resolver: typing.Optional[Resolver]
def reset_default_resolver() -> None:
...
def get_default_resolver() -> Resolver:
...

View file

@ -600,9 +600,12 @@ class Tokenizer:
break break
return tokens return tokens
def concatenate_remaining_identifiers(self): def concatenate_remaining_identifiers(self, allow_empty=False):
"""Read the remaining tokens on the line, which should be identifiers. """Read the remaining tokens on the line, which should be identifiers.
Raises dns.exception.SyntaxError if there are no remaining tokens,
unless `allow_empty=True` is given.
Raises dns.exception.SyntaxError if a token is seen that is not an Raises dns.exception.SyntaxError if a token is seen that is not an
identifier. identifier.
@ -618,6 +621,8 @@ class Tokenizer:
if not token.is_identifier(): if not token.is_identifier():
raise dns.exception.SyntaxError raise dns.exception.SyntaxError
s += token.value s += token.value
if not (allow_empty or s):
raise dns.exception.SyntaxError('expecting another identifier')
return s return s
def as_name(self, token, origin=None, relativize=False, relativize_to=None): def as_name(self, token, origin=None, relativize=False, relativize_to=None):

View file

@ -389,7 +389,7 @@ class Transaction:
if rdataset.rdclass != self.manager.get_class(): if rdataset.rdclass != self.manager.get_class():
raise ValueError(f'{method} has objects of wrong RdataClass') raise ValueError(f'{method} has objects of wrong RdataClass')
if rdataset.rdtype == dns.rdatatype.SOA: if rdataset.rdtype == dns.rdatatype.SOA:
(_, _, origin) = self.manager.origin_information() (_, _, origin) = self._origin_information()
if name != origin: if name != origin:
raise ValueError(f'{method} has non-origin SOA') raise ValueError(f'{method} has non-origin SOA')
self._raise_if_not_empty(method, args) self._raise_if_not_empty(method, args)
@ -560,7 +560,7 @@ class Transaction:
*commit*, a bool. If ``True``, commit the transaction, otherwise *commit*, a bool. If ``True``, commit the transaction, otherwise
roll it back. roll it back.
If committing adn the commit fails, then roll back and raise an If committing and the commit fails, then roll back and raise an
exception. exception.
""" """
raise NotImplementedError # pragma: no cover raise NotImplementedError # pragma: no cover
@ -585,3 +585,12 @@ class Transaction:
Returns a node or ``None``. Returns a node or ``None``.
""" """
raise NotImplementedError # pragma: no cover raise NotImplementedError # pragma: no cover
#
# Low-level API with a default implementation, in case a subclass needs
# to override.
#
def _origin_information(self):
# This is only used by _add()
return self.manager.origin_information()

View file

@ -20,6 +20,7 @@
import base64 import base64
import dns.name import dns.name
import dns.tsig
def from_text(textring): def from_text(textring):

View file

@ -22,7 +22,7 @@ MAJOR = 2
#: MINOR #: MINOR
MINOR = 2 MINOR = 2
#: MICRO #: MICRO
MICRO = 0 MICRO = 1
#: RELEASELEVEL #: RELEASELEVEL
RELEASELEVEL = 0x0f RELEASELEVEL = 0x0f
#: SERIAL #: SERIAL

View file

@ -131,7 +131,7 @@ class Zone(dns.zone.Zone):
# #
# We only wake one sleeper at a time, so it's important # We only wake one sleeper at a time, so it's important
# that no event waiter can exit this method (e.g. via # that no event waiter can exit this method (e.g. via
# cancelation) without returning a transaction or waking # cancellation) without returning a transaction or waking
# someone else up. # someone else up.
# #
# This is not a problem with Threading module threads as # This is not a problem with Threading module threads as

View file

@ -183,6 +183,11 @@ class Zone(dns.transaction.TransactionManager):
"name parameter must be a subdomain of the zone origin") "name parameter must be a subdomain of the zone origin")
if self.relativize: if self.relativize:
name = name.relativize(self.origin) name = name.relativize(self.origin)
elif not self.relativize:
# We have a relative name in a non-relative zone, so derelativize.
if self.origin is None:
raise KeyError('no zone origin is defined')
name = name.derelativize(self.origin)
return name return name
def __getitem__(self, key): def __getitem__(self, key):
@ -870,11 +875,20 @@ class Version:
def _validate_name(self, name): def _validate_name(self, name):
if name.is_absolute(): if name.is_absolute():
if not name.is_subdomain(self.zone.origin): if self.origin is None:
# This should probably never happen as other code (e.g.
# _rr_line) will notice the lack of an origin before us, but
# we check just in case!
raise KeyError('no zone origin is defined')
if not name.is_subdomain(self.origin):
raise KeyError("name is not a subdomain of the zone origin") raise KeyError("name is not a subdomain of the zone origin")
if self.zone.relativize: if self.zone.relativize:
# XXXRTH should it be an error if self.origin is still None?
name = name.relativize(self.origin) name = name.relativize(self.origin)
elif not self.zone.relativize:
# We have a relative name in a non-relative zone, so derelativize.
if self.origin is None:
raise KeyError('no zone origin is defined')
name = name.derelativize(self.origin)
return name return name
def get_node(self, name): def get_node(self, name):
@ -1030,6 +1044,18 @@ class Transaction(dns.transaction.Transaction):
def _get_node(self, name): def _get_node(self, name):
return self.version.get_node(name) return self.version.get_node(name)
def _origin_information(self):
(absolute, relativize, effective) = self.manager.origin_information()
if absolute is None and self.version.origin is not None:
# No origin has been committed yet, but we've learned one as part of
# this txn. Use it.
absolute = self.version.origin
if relativize:
effective = dns.name.empty
else:
effective = absolute
return (absolute, relativize, effective)
def from_text(text, origin=None, rdclass=dns.rdataclass.IN, def from_text(text, origin=None, rdclass=dns.rdataclass.IN,
relativize=True, zone_factory=Zone, filename=None, relativize=True, zone_factory=Zone, filename=None,

View file

@ -11,7 +11,7 @@ cheroot==8.6.0
cherrypy==18.6.1 cherrypy==18.6.1
cloudinary==1.29.0 cloudinary==1.29.0
distro==1.7.0 distro==1.7.0
dnspython==2.2.0 dnspython==2.2.1
facebook-sdk==3.1.0 facebook-sdk==3.1.0
future==0.18.2 future==0.18.2
gntp==1.0.3 gntp==1.0.3