Commit graph

11025 commits

Author SHA1 Message Date
Mark Andrews
072069f1d5 use sizeof(CK_SLOT_ID)
(cherry picked from commit 2c1d8b2e99)
2018-08-24 11:32:11 +10:00
Mark Andrews
59ce0f2620 unlink before unlock
(cherry picked from commit 4742f4ecba)
2018-08-24 10:58:20 +10:00
Mark Andrews
68138381b4 when filter-aaaa and dns64 are both configured a assertion failure could occur
(cherry picked from commit 1056376d10)
2018-08-24 09:47:17 +10:00
Michał Kępień
7680c7d1cf Fix reloading inline-signed zones
While "rndc reload" causes dns_zone_asyncload() to be called for the
signed version of an inline-signed zone, the subsequent zone_load() call
causes the raw version to be reloaded from storage.  This means that
DNS_ZONEFLG_LOADPENDING gets set for the signed version of the zone by
dns_zone_asyncload() before the reload is attempted, but zone_postload()
is only called for the raw version and thus DNS_ZONEFLG_LOADPENDING is
cleared for the raw version, but not for the signed version.  This in
turn prevents zone maintenance from happening for the signed version of
the zone.

Until commit 7c64547d95, this problem
remained dormant because DNS_ZONEFLG_LOADPENDING was previously
immediately, unconditionally cleared after zone loading was started
(whereas it should only be cleared when zone loading is finished or an
error occurs).  This behavior caused other issues [1] and thus had to be
changed.

Fix reloading inline-signed zones by clearing DNS_ZONEFLG_LOADPENDING
for the signed version of the zone once the raw version reload
completes.  Take care not to clear it prematurely during initial zone
load.  Also make sure that DNS_ZONEFLG_LOADPENDING gets cleared when
zone_postload() encounters an error or returns early, to prevent other
scenarios from resulting in the same problem.  Add comments aiming to
help explain code flow.

[1] see RT #47076

(cherry picked from commit 5431583971)
2018-08-22 11:45:24 +02:00
Michał Kępień
8d468a4f60 Set DNS_JOURNALOPT_RESIGN when loading the secure journal for an inline-signed zone
When an inline-signed zone is loaded, the master file for its signed
version is loaded and then a rollforward of the journal for the signed
version of the zone is performed.  If DNS_JOURNALOPT_RESIGN is not set
during the latter phase, signatures loaded from the journal for the
signed version of the zone will not be scheduled for refresh.  Fix the
conditional expression determining which flags should be used for the
dns_journal_rollforward() call so that DNS_JOURNALOPT_RESIGN is set when
zone_postload() is called for the signed version of an inline-signed
zone.

Extend bin/tests/system/stop.pl so that it can use "rndc halt" instead
of "rndc stop" as the former allows master file flushing upon shutdown
to be suppressed.

(cherry picked from commit 8db550c42f)
2018-08-22 10:51:42 +02:00
Michał Kępień
367b973835 Do not treat a referral with a non-empty ANSWER section as an error
As part of resquery_response() refactoring [1], a goto statement was
replaced [2] with a call to a new function - originally called
rctx_delegation(), now folded into rctx_answer_none() - extracted from
existing code.  However, one call site of that refactored function does
not reset the "result" variable, causing a referral with a non-empty
ANSWER section to be inadvertently treated as an error, which prevents
resolution of names reliant on servers sending such responses.  Fix by
resetting the "result" variable to ISC_R_SUCCESS when a response
containing a non-empty ANSWER section can be treated as a delegation.

[1] see RT #45362

[2] see commit e1380a16741a3b4a57e54d7a9ce09dd12691522f

(cherry picked from commit 24b9ec555a)
2018-08-22 10:16:08 +02:00
Ondřej Surý
e66fdc5738 We want to install compatibility shim isc/int.h and isc/boolean.h headers 2018-08-22 09:22:35 +02:00
Mark Andrews
2dd18e9f60 fix lock order reversal
(cherry picked from commit 2bb4392bb3)
2018-08-21 13:30:47 +10:00
Ondřej Surý
e897ec66e6 Don't install removed int.h and boolean.h headers 2018-08-14 20:10:14 -04:00
Mark Andrews
75a39614cc add missing ATF_REQUIRE
(cherry picked from commit 0ce82e9d5f)
2018-08-14 09:15:52 -07:00
Mark Andrews
cbccec86f7 mempool didn't work for sizes less than sizeof(void*)
(cherry picked from commit 5dd1beec8e)
2018-08-14 09:00:05 -07:00
Michał Kępień
36436268b5 Do not remove errors from the OpenSSL error queue in toresult()
dst__openssl_toresult3() first calls toresult() and subsequently uses
ERR_get_error_line_data() in a loop.  Given this, it is a mistake to use
ERR_get_error() in toresult() because it causes the retrieved error to
be removed from the OpenSSL error queue, thus preventing it from being
retrieved by the subsequent ERR_get_error_line_data() calls.  Fix by
using ERR_peek_error() instead of ERR_get_error() in toresult().

(cherry picked from commit fe20f8fe25)
2018-08-14 12:53:18 +02:00
Michał Kępień
1a341e15e8 Prevent rare rbt_insert_and_remove unit test failures
When two or more absolute, two-label names are added to a completely
empty RBT, an extra, empty node for the root name will be created due to
node splitting.  check_tree() expects that, but the extra node will not
be created when just one name is added to a completely empty RBT.  This
problem could be handled inside check_tree(), but that would introduce
unnecessary complexity into it since adding a single name will result in
a different node count for a completely empty RBT (node count will be 1)
and an RBT containing only an empty node for the root name, created due
to prior node splitting (node count will be 2).  Thus, first explicitly
create a node for the root name to prevent rare check_tree() failures
caused by a single name being added in the first iteration of the
insert/remove loop.

(cherry picked from commit 13fe763798)
2018-08-14 10:44:49 +02:00
Michał Kępień
cb5f86d99e Queue "rndc signing -nsec3param ..." requests if needed
If "rndc signing -nsec3param ..." is ran for a zone which has not yet
been loaded or transferred (i.e. its "db" field is NULL), it will be
silently ignored by named despite rndc logging an "nsec3param request
queued" message, which is misleading.  Prevent this by keeping a
per-zone queue of NSEC3PARAM change requests which arrive before a zone
is loaded or transferred and processing that queue once the raw version
of an inline-signed zone becomes available.

(cherry picked from commit cb40c5229a)
2018-08-14 09:26:38 +02:00
Ondřej Surý
cee556c4dd Make ENOBUFS a soft error
(cherry picked from commit ebf3083e08)
2018-08-13 19:22:56 +02:00
Ondřej Surý
08a962545d Fix various build failures on Windows (Courtesy of rockerinthelocker) 2018-08-11 05:57:42 -04:00
Ondřej Surý
d87c1a120d Fix missing config.h in win32/socket.c and replace config.h with <config.h> 2018-08-11 04:45:37 -04:00
Ondřej Surý
3f5db28568 Fix !!validate typo to -> !validate
(cherry picked from commit bdc9860262)
2018-08-11 10:28:27 +02:00
Evan Hunt
e8e7c597f8 mismatch between defined log modules and ns_modules[] in lib/ns/log.c
(cherry picked from commit b865fb77de)
2018-08-10 12:22:04 -07:00
Ondřej Surý
0dad73aafa Add compatibility isc/boolean.h and isc/int.h headers 2018-08-10 11:17:51 +02:00
Ondřej Surý
2844f6529d Remove duplicate config.h
(cherry picked from commit 7351c505a0)
2018-08-10 11:17:51 +02:00
Ondřej Surý
884929400c Replace custom isc_boolean_t with C standard bool type
(cherry picked from commit 994e656977)
2018-08-10 11:17:51 +02:00
Ondřej Surý
d61e6a3111 Replace custom isc_u?intNN_t types with C99 u?intNN_t types
(cherry picked from commit cb6a185c69)
2018-08-09 18:30:20 +02:00
Ondřej Surý
3523850065 Get rid of extra UINT64_MAX definition in lib/isc/win32/time.c
(cherry picked from commit 055278c936)
2018-08-09 18:30:20 +02:00
Ondřej Surý
c863a076ae Replace ISC_PRINT_QUADFORMAT with inttypes.h format constants
(cherry picked from commit 64fe6bbaf2)
2018-08-09 18:30:20 +02:00
Evan Hunt
d97001a37c caclulate nlabels and set *chainingp correctly 2018-08-08 14:24:15 -07:00
Tinderbox User
a7213875ff prep 9.12.2-P1 2018-08-08 14:24:15 -07:00
Evan Hunt
45da24f272 explicit DNAME query could trigger a crash if deny-answer-aliases was set
(cherry picked from commit a21c3810d3453548cc05ae19995125dabea9ca9c)
2018-08-08 14:23:26 -07:00
Evan Hunt
2f611cf600 Silence a compiler warning on openbsd and fix windows build
(cherry picked from commit b55338e447)
2018-08-08 09:36:02 +02:00
Michał Kępień
fe526c3e57 Extract code preparing a delegation response to a separate function
Changes introduced by the previous two commits make the parts of
query_delegation() and query_zone_delegation() which prepare a
delegation response functionally equivalent.  Extract this code into a
separate function, query_prepare_delegation_response(), and then call
the latter from both query_delegation() and query_zone_delegation() in
order to reduce code duplication.  Add a comment describing the purpose
of the extracted code.  Fix coding style issues.

(cherry picked from commit 8e3fc5725f)
2018-08-08 08:09:30 +02:00
Michał Kępień
252b154371 Remove unused NS_QUERYATTR_CACHEGLUEOK query attribute
The NS_QUERYATTR_CACHEGLUEOK query attribute has no influence on query
processing.  Remove it.

(cherry picked from commit 7db4dedf6b)
2018-08-08 08:09:30 +02:00
Michał Kępień
7c58cbd31a 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.

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.

(cherry picked from commit b6c77202cb)
2018-08-08 08:09:25 +02:00
Ondřej Surý
c9094cd8e8 Define and use new DNS_RDATASET_COUNT_UNDEFINED equals ISC_UINT32_MAX to make the code more readable
(cherry picked from commit e80c26b22e)
2018-08-06 13:03:28 +02:00
Ondřej Surý
f74ee45e5e Refactor code around random/cyclic/fixed to reduce code duplication
(cherry picked from commit 41a68425ea)
2018-08-06 13:03:28 +02:00
Mark Andrews
bf7db87d52 Only get one random number per response when order == random
(cherry picked from commit f7986c8d1a)
2018-08-06 13:03:28 +02:00
Mark Andrews
70d39a86ed remove dead code
(cherry picked from commit 83a1e87dd2)
2018-08-03 09:50:25 +10:00
Mark Andrews
6382cc61ed treat the signed instance of a inline zone as dynamic
(cherry picked from commit 9130f055f4)
2018-08-02 14:27:21 +10:00
Mark Andrews
bcbe414861 lower log level to debug(1)
(cherry picked from commit 12d45c5cd1)
2018-08-01 23:25:58 -04:00
Mark Andrews
56e7e43230 handle dns_aclelementtype_geoip
(cherry picked from commit 57eadf4d4f)
2018-08-02 09:55:13 +10:00
Mark Andrews
6ac1507f4f test dns_acl_isinsecure with geoip element
(cherry picked from commit fb8bb4e306)
2018-08-02 09:55:13 +10:00
Mark Andrews
06bfd671b5 use tlsa and smime structs to set common values
(cherry picked from commit 63c9ec367f)
2018-08-02 08:52:17 +10:00
Ondřej Surý
38a6d1d44d Change isc_buffer_reallocate() into a static functions as it is not used outside of isc_buffer_reserve()
(cherry picked from commit 20faf4652a)
2018-08-01 08:41:25 +02:00
Ondřej Surý
56117f9799 Remove illogical condition from isc_buffer_reallocate that would return ISC_R_NOSPACE when requested size is less than available size
(cherry picked from commit 7785f644c3)
2018-08-01 08:41:25 +02:00
Ondřej Surý
7d2c0859d5 Forbid isc_buffer_printf from growing the buffer unless auto reallocation is enabled
(cherry picked from commit 519bfe4c97)
2018-08-01 08:41:25 +02:00
Mark Andrews
3a06cea708 refcount errors on error paths
(cherry picked from commit 4093efc900)
2018-07-31 18:42:38 +10:00
Ondřej Surý
0b93c77024 Replace the last missed usage of USE_ENGINE with OPENSSL_NO_ENGINE 2018-07-12 06:33:54 -04:00
Mark Andrews
26a2ab4152 remove re-initalisation of common structure
(cherry picked from commit 6e06d3e7c6)
2018-07-12 09:48:03 +10:00
Mark Andrews
85d7298387 remove redundant test
(cherry picked from commit 6eec7fe092)
2018-07-10 19:05:01 -07:00
Mark Andrews
d1539d991a fix spelling of 'telemetry'
(cherry picked from commit 4f18b6a09a)
2018-07-10 18:28:51 -07:00
Mark Andrews
0ed6214375 use extracted netaddr rather than client->destaddr
(cherry picked from commit 69fd3f5ba4)
2018-07-10 18:28:50 -07:00