Commit graph

8632 commits

Author SHA1 Message Date
Ondřej Surý
64fe6bbaf2 Replace ISC_PRINT_QUADFORMAT with inttypes.h format constants 2018-08-08 09:36:44 +02:00
Michał Kępień
b6c77202cb Restore zone database and zone node if cache search results are to be ignored
When query processing hits a delegation from a locally configured zone,
an attempt may be made to look for a better answer in the cache.  In
such a case, the zone-sourced delegation data is set aside and the
lookup is retried using the cache database.  When that lookup is
completed, a decision is made whether the answer found in the cache is
better than the answer found in the zone.

Currently, if the zone-sourced answer turns out to be better than the
one found in the cache:

  - qctx->zdb is not restored into qctx->db,
  - qctx->node, holding the zone database node found, is not even saved.

Thus, in such a case both qctx->db and qctx->node will point at cache
data.  This is not an issue for BIND versions which do not support
mirror zones because in these versions non-recursive queries always
cause the zone-sourced delegation to be returned and thus the
non-recursive part of query_delegation() is never reached if the
delegation is coming from a zone.  With mirror zones, however,
non-recursive queries may cause cache lookups even after a zone
delegation is found.  Leaving qctx->db assigned to the cache database
when query_delegation() determines that the zone-sourced delegation is
the best answer to the client's query prevents DS records from being
added to delegations coming from mirror zones.  Fix this issue by
keeping the zone database and zone node in qctx while the cache is
searched for an answer and then restoring them into qctx->db and
qctx->node, respectively, if the zone-sourced delegation turns out to be
the best answer.  Since this change means that qctx->zdb cannot be used
as the glue database any more as it will be reset to NULL by RESTORE(),
ensure that qctx->db is not a cache database before attaching it to
qctx->client->query.gluedb.

Furthermore, current code contains a conditional statement which
prevents a mirror zone from being used as a source of glue records.
Said statement was added to prevent assertion failures caused by
attempting to use a zone database's glue cache for finding glue for an
NS RRset coming from a cache database.  However, that check is overly
strict since it completely prevents glue from being added to delegations
coming from mirror zones.  With the changes described above in place,
the scenario this check was preventing can no longer happen, so remove
the aforementioned check.

If qctx->zdb is not NULL, qctx->zfname will also not be NULL;
qctx->zsigrdataset may be NULL in such a case, but query_putrdataset()
handles pointers to NULL pointers gracefully.  Remove redundant
conditional expressions to make the cleanup code in query_freedata()
match the corresponding sequences of SAVE() / RESTORE() macros more
closely.
2018-08-08 08:07:46 +02:00
Ondřej Surý
afddc2781e Modify the rrsetorder test to cope with the rrset order randomization (only four orders are now possible) 2018-08-06 11:24:14 +02:00
Mark Andrews
a94db46631 only check the bit map 2018-08-03 08:21:48 +10:00
Ondřej Surý
69380eb033 Revert "Merge branch 'modified-manual-install-oot' into 'master'"
This reverts commit d9929b1b0a, reversing
changes made to 8abf2f23d0.
2018-08-02 10:23:30 -04:00
Ondřej Surý
10e6bfc864 Preserve ${LDFLAGS} contents in bin/dig/ 2018-08-02 08:33:03 -04:00
Mark Andrews
cfccd8d246 turn off ixfr-from-differences on signed instance of in-line zone 2018-08-02 00:00:13 -04:00
Mark Andrews
3ea9861e7a rename zone to mayberaw 2018-08-02 00:00:13 -04:00
Mark Andrews
abe41ba011 use guard values for testing unixtime serial 2018-08-02 10:25:56 +10:00
Mark Andrews
6b30bc73c0 save SOA values 2018-08-01 20:04:09 -04:00
Mark Andrews
2e688488f7 test mdig '+ednsopt=:' handling 2018-08-02 08:55:01 +10:00
Mark Andrews
d2943440a0 fix handling of '+ednsopt=:'; support 100 ednsopts per query rather than 100 total 2018-08-02 08:55:01 +10:00
Petr Menšík
88f913ac81 Use make automatic variables to install updated manuals
Make will choose modified manual from build directory or original from source
directory automagically. Take advantage of install tool feature.
Install all files in single command instead of iterating on each of them.
2018-08-01 01:56:16 -04:00
Mark Andrews
c8b07932e4 named_server_servestale could leave the server in exclusive mode if a error occurs. 2018-07-26 22:54:15 -07:00
Ondřej Surý
71877806e8 Fix ax_check_openssl to accept yes and improve it to modern autotools standard 2018-07-23 22:10:52 +02:00
Ondřej Surý
b105ccee68 Remove isc_safe_memcompare, it's not needed anywhere and can't be replaced with CRYPTO_memcmp() 2018-07-20 10:06:14 -04:00
Ondřej Surý
83cde08522 Introduce USE_OPENSSL define to Windows build, remove CRYPTO and AES conditions. 2018-07-19 16:54:53 -04:00
Ondřej Surý
fc496b2b5d Fix DH and ECDSA algorithms in PKCS#11 build 2018-07-19 14:00:40 -04:00
Ondřej Surý
c40425d0f6 RSA and ECDSA cryptography is now mandatory; remove the checks for those 2018-07-19 12:47:03 -04:00
Ondřej Surý
c3b8130fe8 Make OpenSSL mandatory 2018-07-19 12:47:03 -04:00
Michał Kępień
8666f8d28f Fix handling of TAT sending failures
dns_view_zonecut() may associate the dns_rdataset_t structure passed to
it even if it returns a result different then ISC_R_SUCCESS.  Not
handling this properly may cause a reference leak.  Fix by ensuring
'nameservers' is cleaned up in all relevant failure modes.
2018-07-20 01:55:50 +10:00
Michał Kępień
e10e6756c9 [squash] Make resolver tests even more civilized (ans8.pl)
Set AA=1 even for truncated responses.  Put glue record in responses to
no-questions/NS queries.  Add comments, simplify code.
2018-07-17 13:01:42 +02:00
Michał Kępień
82082ecd56 [squash] Make resolver tests even more civilized (ans2.pl and ans3.pl)
Prevent ans2.pl from responding authoritatively for any name at or below
example.net.

Make ans3.pl properly answer example.net/NS queries.  Use string
comparisons instead of regular expressions where possible.
2018-07-17 13:00:34 +02:00
Michał Kępień
122a1a00be [squash] Put Perl code extracting a tree from a cache dump in a separate function 2018-07-17 11:31:09 +02:00
Witold Kręcicki
c96ca40023 cacheclean test: take into account that we can have multiple RRs at one name 2018-07-17 11:31:09 +02:00
Witold Kręcicki
c8b36ea6b9 Make resolver tests more civilized 2018-07-17 11:31:09 +02:00
Michał Kępień
618921902a Do not replace lo0 address on Solaris
lo0 and lo0:0 are the same interface on Solaris.  Make sure
bin/tests/system/ifconfig.sh does not touch lo0:0 in order to prevent it
from changing the address of the loopback interface on Solaris.
2018-07-16 08:55:22 +02:00
Michał Kępień
2be97feb46 Do not spam console if "git status --ignored" fails during tests
The "git status" command in Git versions before 1.7.2 does not support
the "--ignored" option.  Prevent spamming the console when running
system tests from a Git repository on a host with an ancient Git version
installed.
2018-07-13 08:22:12 +02:00
Michał Kępień
fd30a03f2b Remove IDN subtest from the "digdelv" system test
The output of certain "dig +idnout" invocations may be locale-dependent.
Remove the "dig +idnout" subtest from the "digdelv" system test as IDN
support is already thoroughly tested by the "idna" system test.
2018-07-13 08:22:12 +02:00
Michał Kępień
cc0e8cda71 Include conf.sh from all prereq.sh scripts
Every prereq.sh script must include bin/tests/system/conf.sh, otherwise
if some prerequisite is not met, errors about echo_i not being found
will be printed instead of actual error messages.
2018-07-13 08:22:12 +02:00
Mark Andrews
ad86878d61 add test for bad dig option '+ednsopt=:' being handled gracefully 2018-07-11 11:22:26 -07:00
Bill Parker
408bcf9c07 check code is non NULL 2018-07-11 11:22:26 -07:00
Mukund Sivaraman
a7e6a584ea Add system tests for "tcp-self" update-policy 2018-07-11 10:55:24 -07:00
Mark Andrews
9bd14e2d1f add required whitespace 2018-07-11 09:30:10 +02:00
Michał Kępień
a7657dc150 Send upstream TAT queries for locally served zones
Trying to resolve a trust anchor telemetry query for a locally served
zone does not cause upstream queries to be sent as the response is
determined just by consulting local data.  Work around this issue by
calling dns_view_findzonecut() first in order to determine the NS RRset
for a given domain name and then passing the zone cut found to
dns_resolver_createfetch().

Note that this change only applies to TAT queries generated by the
resolver itself, not to ones received from downstream resolvers.
2018-07-11 08:27:10 +02:00
Michał Kępień
127810e512 Extract TAT QNAME preparation to a separate function
Extract the part of dotat() reponsible for preparing the QNAME for a TAT
query to a separate function in order to limit the number of local
variables used by each function and improve code readability.

Rename 'name' to 'origin' to better convey the purpose of that variable.
Also mark it with the const qualifier.
2018-07-11 08:27:10 +02:00
Ondřej Surý
96907d636d Add .gitignore for PKCS#11 test files 2018-07-11 07:56:48 +02:00
Michał Kępień
dbfd19c668 Do not reuse zones whose "mirror" setting was changed
Update named_zone_reusable() so that it does not consider a zone to be
eligible for reuse if its old value of the "mirror" option differs from
the new one.  This causes "rndc reconfig" to create a new zone structure
whenever the value of the "mirror" option is changed, which ensures that
the previous zone database is not reused and that flags are properly set
in responses sourced from zones whose "mirror" setting was changed at
runtime.
2018-07-10 17:36:22 -07:00
Bill Parker
8ac0152651 check param_template[i].pValue is non NULL 2018-07-10 14:24:07 -07:00
Michał Kępień
c4209418a5 Do not use Net::DNS::Nameserver in the "serve-stale" system test
Net::DNS versions older than 0.67 respond to queries sent to a
Net::DNS::Nameserver even if its ReplyHandler returns undef.  This makes
the "serve-stale" system test fail as it takes advantage of the newer
behavior.  Since the latest Net::DNS version available with stock
RHEL/CentOS 6 packages is 0.65 and we officially support that operating
system, bin/tests/system/serve-stale/ans2/ans.pl should behave
consistently for various Net::DNS versions.  Ensure that by reworking it
so that it does not use Net::DNS::Nameserver.
2018-07-10 15:04:14 +02:00
Michał Kępień
6c3c6aea37 Fix a Net::DNS version quirk in the "resolver" system test
Net::DNS versions older than 0.68 insert a ./ANY RR into the QUESTION
section if the latter is empty.  Since the latest Net::DNS version
available with stock RHEL/CentOS 6 packages is 0.65 and we officially
support that operating system, bin/tests/system/resolver/ans8/ans.pl
should behave consistently for various Net::DNS versions.  Ensure that
by making handleUDP() return the query ID and flags generated by
Net::DNS with 8 zero bytes appended.
2018-07-10 14:53:29 +02:00
Michał Kępień
bf6efbc9a9 Do not set IDN2_NFC_INPUT explicitly
IDN2_NFC_INPUT is always set implicitly by idn2_to_ascii_lz(), so there
is no need to set it explicitly.
2018-07-10 14:34:35 +02:00
Michał Kępień
b896fc4972 Improve error handling in idn_ace_to_locale()
While idn2_to_unicode_8zlz() takes a 'flags' argument, it is ignored and
thus cannot be used to perform IDN checks on the output string.

The bug in libidn2 versions before 2.0.5 was not that a call to
idn2_to_unicode_8zlz() with certain flags set did not cause IDN checks
to be performed.  The bug was that idn2_to_unicode_8zlz() did not check
whether a conversion can be performed between UTF-8 and the current
locale's character encoding.  In other words, with libidn2 version
2.0.5+, if the current locale's character encoding is ASCII, then
idn2_to_unicode_8zlz() will fail when it is passed any Punycode string
which decodes to a non-ASCII string, even if it is a valid IDNA2008
name.

Rework idn_ace_to_locale() so that invalid IDNA2008 names are properly
and consistently detected for all libidn2 versions and locales.

Update the "idna" system test accordingly.  Add checks for processing a
server response containing Punycode which decodes to an invalid IDNA2008
name.  Fix invalid subtest description.
2018-07-10 14:34:35 +02:00
Michał Kępień
e5ef038134 Remove redundant dns_name_totextfilter_t argument
Since idn_output_filter() no longer uses its 'absolute' argument and no
other callback is used with dns_name_settotextfilter(), remove the
'absolute' argument from the dns_name_totextfilter_t prototype.
2018-07-10 14:34:35 +02:00
Michał Kępień
19c42d46e8 Simplify and rename output_filter()
output_filter() does not need to dot-terminate its input name because
libidn2 properly handles both dot-terminated and non-dot-terminated
names.  libidn2 also does not implicitly dot-terminate names passed to
it, so parts of output_filter() handling dot termination can simply be
removed.

Fix a logical condition to make sure 'src' can fit the terminating NULL
byte.  Replace the MAXDLEN macro with the MXNAME macro used in the rest
of dig source code.  Tweak comments and variable names.

Rename output_filter() to idn_output_filter() so that it can be easily
associated with IDN and other idn_*() functions.
2018-07-10 14:34:35 +02:00
Michał Kępień
5106a18e9e Simplify idn_ace_to_locale()
idn_ace_to_locale() may return a string longer than MAXDLEN because it
is using the current locale's character encoding.  Rather then imposing
an arbitrary limit on the length of the string that function can return,
make it pass the string prepared by libidn2 back to the caller verbatim,
making the latter responsible for freeing that string.  In conjunction
with the fact that libidn2 errors are considered fatal, this makes
returning an isc_result_t from idn_ace_to_locale() unnecessary.

Do not process success cases in conditional branches for improved
consistency with the rest of BIND source code.  Add a comment explaining
the purpose of idn_ace_to_locale().  Rename that function's parameters
to match common BIND naming pattern.
2018-07-10 14:34:35 +02:00
Michał Kępień
bcf4d20603 Simplify idn_locale_to_ace()
idn_locale_to_ace() is a static function which is always used with a
buffer of size MXNAME, i.e. one that can fit any valid domain name.
Since libidn2 detects invalid domain names and libidn2 errors are
considered fatal, remove size checks from idn_locale_to_ace().  This
makes returning an isc_result_t from it unnecessary.

Do not process success cases in conditional branches for improved
consistency with the rest of BIND source code.  Add a comment explaining
the purpose of idn_locale_to_ace().  Rename that function's parameters
to match common BIND naming pattern.
2018-07-10 14:34:35 +02:00
Michał Kępień
59cdaef4f7 Remove IDNA2003 fallback from dig
Certain characters, like symbols, are allowed by IDNA2003, but not by
IDNA2008.  Make dig reject such symbols when IDN input processing is
enabled to ensure BIND only supports IDNA2008.  Update the "idna" system
test so that it uses one of such symbols rather than one which is
disallowed by both IDNA2003 and IDNA2008.
2018-07-10 14:34:35 +02:00
Michał Kępień
9a25368c8c Remove redundant dns_name_settotextfilter() call
There is no need to call dns_name_settotextfilter() in setup_system()
because setup_lookup() determines whether IDN output processing should
be enabled for a specific lookup (taking the global setting into
consideration) and calls dns_name_settotextfilter() anyway if it is.
Remove the dns_name_settotextfilter() call from setup_system().
2018-07-10 14:34:35 +02:00
Michał Kępień
fafc7c7b8a Remove empty idn_initialize() function 2018-07-10 14:34:35 +02:00