2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00
Commit Graph

27285 Commits

Author SHA1 Message Date
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
Michał Kępień
a0571d3851 Rework libidn2 detection
Clean up the parts of configure.in responsible for handling libidn2
detection and adjust other pieces of the build system to match these
cleanups:

  - use pkg-config when --with-libidn2 is used without an explicit path,

  - look for idn2_to_ascii_lz() rather than idn2_to_ascii_8z() as the
    former is used in BIND while the latter is not,

  - do not look for idn2_to_unicode_8zlz() as it is present in all
    libidn2 versions which have idn2_to_ascii_lz(),

  - check whether the <idn2.h> header is usable,

  - set LDFLAGS in the Makefile for dig so that, if specified, the
    requested libidn2 path is used when linking with libidn2,

  - override CPPFLAGS when looking for libidn2 components so that the
    configure script does not produce warnings when libidn2 is not
    installed system-wide,

  - merge the AS_CASE() call into the AS_IF() call below it to simplify
    code,

  - indicate the default value of --with-libidn2 in "./configure --help"
    output,

  - use $with_libidn2 rather than $use_libidn2 to better match the name
    of the configure script argument,

  - stop differentiating between IDN "in" and "out" support, i.e. make
    dig either support libidn2 or not; remove WITH_* Autoconf macros and
    use a new one, HAVE_LIBIDN2, to determine whether libidn2 support
    should be enabled.
2018-07-10 14:34:35 +02:00
Witold Krecicki
f02e3c4bab Merge branch 'fix-synth-from-dnssec-dname-handling' into 'master'
Don't synthesize NXDOMAIN from NSEC for records under a DNAME.

Closes #386

See merge request isc-projects/bind9!481
2018-07-10 03:28:26 -04:00
Mark Andrews
8ef23f9fb0 the presence of a DNAME record proves that the name does not exist in the zone but as we don't want to use that for NXDMOMAIN return DNS_R_DNAME from dns_nsec_noexistnodata 2018-07-10 03:20:21 -04:00
Witold Kręcicki
7f60bb39df Don't synthesize NXDOMAIN from NSEC for records under a DNAME 2018-07-10 03:20:21 -04:00
Mark Andrews
cd0e7df6fc Merge branch '402-memory-leak-found-in-file-fuzz-c-in-bind-9-12-1-p2' into 'master'
Resolve "Memory Leak found in file 'fuzz.c' in BIND-9.12.1-P2"

Closes #402

See merge request isc-projects/bind9!488
2018-07-10 00:32:32 -04:00
Mark Andrews
ecb2f20324 free rbuf 2018-07-10 14:24:06 +10:00
Evan Hunt
4f6ef2f3e5 Merge branch 'prep-release-v9_13_2' into 'master'
prep 9.13.2

See merge request isc-projects/bind9!473
v9.13.2
2018-07-03 03:51:40 -04:00
Tinderbox User
b65d19f9fd prep 9.13.2 2018-07-03 07:40:29 +00:00
Michał Kępień
fffc671219 Merge branch 'clarify-mirror' into 'master'
clarify documentation of the 'mirror' option

See merge request isc-projects/bind9!469
2018-07-03 03:23:50 -04:00
Evan Hunt
3245eb98f4 clarify documentation of the 'mirror' option 2018-07-03 09:10:11 +02:00
Michał Kępień
51161526a4 Merge branch '371-remove-dns_rdataslab_tordataset' into 'master'
Remove dns_rdataslab_tordataset() and its related dns_rdatasetmethods_t callbacks

Closes #371

See merge request isc-projects/bind9!456
2018-07-03 02:53:53 -04:00
Michał Kępień
e9ed9b8eec Add CHANGES entry
4987.	[cleanup]	dns_rdataslab_tordataset() and its related
			dns_rdatasetmethods_t callbacks were removed as they
			were not being used by anything in BIND. [GL #371]
2018-07-03 08:44:05 +02:00
Michał Kępień
b2f65ddbf0 Remove dns_rdataslab_tordataset() and its related dns_rdatasetmethods_t callbacks
Since BIND libraries are no longer considered public and
dns_rdataslab_tordataset() is not used anywhere in the tree, remove the
latter and its associated dns_rdatasetmethods_t callbacks from
lib/dns/rdataslab.c.
2018-07-03 08:44:05 +02:00
Evan Hunt
a511c8cc0e Merge branch 'fix-doc' into 'master'
fix doc issues

See merge request isc-projects/bind9!466
2018-07-02 22:11:33 -04:00
Evan Hunt
6993d9131e update new features list; also fix the "mirror" release note 2018-07-02 19:09:32 -07:00
Evan Hunt
5bc0e41008 Merge branch '321-improve-documentation-on-libcap-change' into 'master'
Improve documentation on libcap change in 9.13+

See merge request isc-projects/bind9!461
2018-07-02 12:35:05 -04:00
Ondřej Surý
48bbef71f7 Use m4_normalize to reformat the long lines in the configure output 2018-07-02 08:53:13 +02:00
Ondřej Surý
b5ea00158d Improve documentation and error messages when libcap is not available 2018-07-02 08:47:32 +02:00
Ondřej Surý
cebcd9184e Merge branch '321-remove-linux-capability-support-without-libcap' into 'master'
Remove ability to build without libcap when Linux capabilities are enabled

Closes #321

See merge request isc-projects/bind9!421
2018-06-30 10:59:49 -04:00
Ondřej Surý
7d4cbca5b0 Add CHANGES entry for GL #321. 2018-06-30 16:51:01 +02:00
Michał Kępień
c356413294 libcap ships with <sys/capability.h>, so use an #ifdef associated with that header to determine whether to enable capabilities support 2018-06-30 16:50:22 +02:00
Michał Kępień
e299a870b3 Revert parts of 3dd314590e introducing WANT_LINUX_CAPABILITY 2018-06-30 16:50:22 +02:00
Ondřej Surý
c4a436569a Make libcap mandatory when Linux capabilities are enabled 2018-06-30 16:50:22 +02:00
Evan Hunt
8d9196bed7 Merge branch 'fix-win32' into 'master'
add missing symbols for windows build

See merge request isc-projects/bind9!454
2018-06-28 11:46:51 -04:00
Evan Hunt
b529de9109 add missing symbols 2018-06-28 08:38:22 -07:00
Michał Kępień
8ccd8f4f90 Merge branch '33-implement-mirror-zones' into 'master'
Implement mirror zones

Closes #33

See merge request isc-projects/bind9!329
2018-06-28 07:53:10 -04:00
Michał Kępień
6f719b482b Add CHANGES entry
4985.	[func]		Add a new slave zone option, "mirror", to enable
			serving a non-authoritative copy of a zone that
			is subject to DNSSEC validation before being
			used.  For now, this option is only meant to
			facilitate deployment of an RFC 7706-style local
			copy of the root zone. [GL #33]
2018-06-28 13:38:39 +02:00
Michał Kępień
92ae05e1bc Add a release note 2018-06-28 13:38:39 +02:00
Michał Kępień
dbe6a1a05f Add documentation for mirror zones
Update the ARM and various option lists with information about the
"mirror" option for slave zones.
2018-06-28 13:38:39 +02:00
Michał Kępień
73d64de779 Make "rndc zonestatus" output for mirror zones different than for regular slave zones
Replace "type: slave" with "type: mirror" in "rndc zonestatus" output
for mirror zones in order to enable the user to tell a regular slave
zone and a mirror zone apart.
2018-06-28 13:38:39 +02:00
Michał Kępień
dd30f53edc Disable notifies for mirror zones unless also-notify is used
Since the mirror zone feature is expected to mostly be used for the root
zone, prevent slaves from sending NOTIFY messages for mirror zones by
default.  Retain the possibility to use "also-notify" as it might be
useful in certain cases.
2018-06-28 13:38:39 +02:00
Michał Kępień
3af412c0e0 Disable outgoing mirror zone transfers by default
As mirror zone data should be treated the way validated, cached DNS
responses are, outgoing mirror zone transfers should be disabled unless
they are explicitly enabled by zone configuration.
2018-06-28 13:38:39 +02:00
Michał Kępień
c3f3b824e7 Treat mirror zone data as cache data for access control purposes
As mirror zone data should be treated the way validated, cached DNS
responses are, it should not be used when responding to clients who are
not allowed cache access.  Reuse code responsible for determining cache
database access for evaluating mirror zone access.
2018-06-28 13:38:39 +02:00
Michał Kępień
18ced94241 Rework query_checkcacheaccess()
Modify query_checkcacheaccess() so that it only contains a single return
statement rather than three and so that the "check_acl" variable is no
longer needed.  Tweak and expand comments.  Fix coding style issues.
2018-06-28 13:38:39 +02:00
Michał Kępień
cde16236fb Simplify query_getcachedb()
Modify query_getcachedb() so that it uses a common return path for both
success and failure.  Remove a redundant NULL check since 'db' will
never be NULL after being passed as a target pointer to dns_db_attach().
Fix coding style issues.
2018-06-28 13:38:39 +02:00
Michał Kępień
e9f17da6e9 Extract cache access checks in query_getcachedb() to a separate function
Extract the parts of query_getcachedb() responsible for checking whether
the client is allowed to access the cache to a separate function, so
that it can be reused for determining mirror zone access.
2018-06-28 13:38:39 +02:00
Michał Kępień
8d996fd79c Fall back to normal recursion when mirror zone data is unavailable
If transferring or loading a mirror zone fails, resolution should still
succeed by means of falling back to regular recursive queries.
Currently, though, if a slave zone is present in the zone table and not
loaded, a SERVFAIL response is generated.  Thus, mirror zones need
special handling in this regard.

Add a new dns_zt_find() flag, DNS_ZTFIND_MIRROR, and set it every time a
domain name is looked up rather than a zone itself.  Handle that flag in
dns_zt_find() in such a way that a mirror zone which is expired or not
yet loaded is ignored when looking up domain names, but still possible
to find when the caller wants to know whether the zone is configured.
This causes a fallback to recursion when mirror zone data is unavailable
without making unloaded mirror zones invisible to code checking a zone's
existence.
2018-06-28 13:38:39 +02:00
Michał Kępień
e3160b27f7 Ensure responses sourced from mirror zones have the AD bit set
Zone RRsets are assigned trust level "ultimate" upon load, which causes
the AD bit to not be set in responses coming from slave zones, including
mirror zones.  Make dns_zoneverify_dnssec() update the trust level of
verified RRsets to "secure" so that the AD bit is set in such responses.
No rollback mechanism is implemented as dns_zoneverify_dnssec() fails in
case of any DNSSEC failure, which causes the mirror zone version being
verified to be discarded.
2018-06-28 13:38:39 +02:00
Michał Kępień
ad0ec2ea93 Do not treat mirror zone data as authoritative
Section 4 of RFC 7706 suggests that responses sourced from a local copy
of a zone should not have the AA bit set.  Follow that recommendation by
setting 'qctx->authoritative' to ISC_FALSE when a response to a query is
coming from a mirror zone.
2018-06-28 13:38:39 +02:00
Michał Kępień
179d5faa28 Ensure delegations inside mirror zones are properly handled for non-recursive queries
When a resolver is a regular slave (i.e. not a mirror) for some zone,
non-recursive queries for names below that slaved zone will return a
delegation sourced from it.  This behavior is suboptimal for mirror
zones as their contents should rather be treated as validated, cached
DNS responses.  Modify query_delegation() and query_zone_delegation() to
permit clients allowed cache access to check its contents for a better
answer when responding to non-recursive queries.
2018-06-28 13:38:39 +02:00
Michał Kępień
c9accfde28 Perform basic resolution checks with a mirror zone in use
Make ns3 mirror the "root" zone from ns1 and query the former for a
properly signed record below the root.  Ensure ns1 is not queried during
resolution and that the AD bit is set in the response.
2018-06-28 13:38:39 +02:00
Michał Kępień
edbb256c3a Verify mirror zone journals
As mirror zone files are verified when they are loaded from disk, verify
journal files as well to ensure invalid data is not used.  Reuse the
journals generated during IXFR tests to test this.
2018-06-28 13:38:39 +02:00