| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
| |
(cut-and-paste issue)
|
| |
|
|
|
|
|
| |
Classes inherit from object by default; there's no need to explicitly
include this.
Replace super(Foo, self) with super().
|
| |
|
|
|
|
|
| |
These methods (which convert a str/int into an enum/int) shouldn't be
commonly used by external code, so don't need to exist at the module
level. The make() method on the enum class (renamed from to_enum()) can
still be used, and the internal callers have been updated to use it.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
Simplify code using try/finally to use context managers.
In some cases, contextlib.ExitStack() is used; this could probably be
further simplified to use contextlib.nullcontext() once Python 3.7+ is a
requirement.
|
| | |
|
| |
|
|
| |
None of these are needed anymore.
|
| |\
| |
| | |
zone.to_text() should return a string.
|
| | |
| |
| |
| |
| |
| | |
As part of the Python 3 conversion, the result of dns.zone.to_text()
changed from str to bytes. This was likely unintentional, as a method
with text in its name should be returning text.
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When calling from_text, the zone code needs to apply the current origin
(which may or may not be the zone origin, if sub-zone $ORIGIN statements
are present), and may also want to relativize the contents to the zone
origin.
Previously, this was done by explicitly reading records as absolute, and
then relativizing them laster. With this change, the work is moved to
the tokenizer.
This gets rid of the remaining internal uses of
dns.rdata.choose_relativity(), which prevents rdata from being
immutable.
|
| |
|
|
|
|
|
|
|
|
| |
The comment states that relativize must be consistent between
dns.query.xfr() and dns.zone.from_xfr(), and the code fails if they're
not (if check_origin is True, at least). This means that the rdata is
already correctly relativized (or not).
This also adds a test of creating zones from xfrs, both relativized and
not.
|
| | |
|
| |
|
| |
Check for self.last_ttl_known before setting ttl = self.last_ttl so it will remain None instead of 0 if value is not known.
|
| |
|
| |
Need to also check that last TTL is known before using it as a fallback, otherwise ttl is never None in the last check, setting it incorrectly to 0 instead.
|
| |
|
| |
Instead of moving the entire TTL parsing past the rdata handling (causing the RR to be parsed on the wrong way), returned the parsing to its original location, and only moved the final failure code past the rdata handling.
|
| |
|
| |
By doing the TTL validity check after parsing the record data allows the TTL to be set properly from SOA RDATA even when the SOA record itself does not have TTL set.
|
| |
|
|
|
| |
using the index field (0) as the padding width, instead of the correct value
3.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |\
| |
| | |
Improve TTL detection when reading master zone files.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This introduces the same behaviour that BIND has when it encounters implicit TTL
values, namely:
* The $TTL directive is preferred to set the default TTL [RFC2308].
* If no $TTL directive is seen prior to the SOA RR, the default TTL is set
to the minimum TTL field of the SOA RR [RFC1033, RFC1035, RFC1912].
* If neither $TTL nor an SOA are present, use the last seen explicit TTL on an
RR or raise a SyntaxError if no explicit TTLs have been seen.
Previously, when neither $TTL nor SOA were present, the TTL for an RR without
an explicit TTL would be set to 0 which is known to be a somewhat dangerous
value and shouldn't be encouraged as a default.
One test seems to rely on this default TTL=0 behaviour whilst testing something
seemingly unrelated (RR starting with whitespace), so that test has been
updated to match this new expectation.
Fixes #254.
|
| | | |
|
| | |
| |
| |
| | |
[Issue #252]
|
| | | |
|
| |/
|
|
|
|
| |
dns._compat module contains constants PY2 and PY3 which should be used
for detection of python version, to have only one method and avoid
duplications
|
| |\
| |
| | |
Pylint
|
| | |
| |
| |
| | |
Bare excepts should not be used, because they may hide system exceptions such as KeyboardInterupts or SystemExits.
|
| |/
|
|
|
| |
From the code it looks like the only 'wb' mode is supported after migration to py3.
I fixed py3 with 'wb'. Both textual and binary modes should be supported now.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
Zone object.
[issue #153]
|
| | |
|
| |
|
|
| |
Signed-off-by: Arthur Gautier <baloo@gandi.net>
|
| | |
|
| |
|
|
| |
printing.
|
| |
|
|
| |
Thanks to Brandon Whaley <redkrieg@gmail.com> for the patch.
|
| |
|
|
|
|
|
| |
When reading from a masterfile, if the first content line started
with leading whitespace, we raised an ugly exception instead of
doing the right thing, namely using the zone origin as the name.
[#73]
|
| | |
|