Commit graph

11003 commits

Author SHA1 Message Date
Evan Hunt
debb94462f fix chaosnet address comparison
(cherry picked from commit b4dca44ad2)
2018-09-28 09:01:06 -07:00
Mark Andrews
e4fd1abccf only emit a single space between mac length and the orginal id if the mac length is zero
(cherry picked from commit ac1c3aaa27)
2018-09-27 14:28:59 -07:00
Zhaolong Zhang
f889f48f61 Fix crash caused by race condition in timer creation
The race condition is the timer elapses before isc__timer_create()
returns the pointer to the caller.  Assigning the return pointer before
enabling the timer will fix it.

(cherry picked from commit 21966423cd)
2018-09-27 13:00:05 -07:00
Michał Kępień
74cd632f18 Prevent a race after zone load
Zone loading happens in a different task (zone->loadtask) than other
zone actions (zone->task).  Thus, when zone_postload() is called in the
context of zone->loadtask, it may cause zone maintenance to be queued in
zone->task and another thread can then execute zone_maintenance() before
zone_postload() gets a chance to finish its work in the first thread.
This would not be a problem if zone_maintenance() accounted for this
possibility by locking the zone before checking the state of its
DNS_ZONEFLG_LOADPENDING flag.  However, the zone is currently not locked
before the state of that flag is checked, which may prevent zone
maintenance from happening despite zone_postload() scheduling it.  Fix
by locking the zone in zone_maintenance() before checking the state of
the zone's DNS_ZONEFLG_LOADPENDING flag.

(cherry picked from commit 56003e9f9f)
2018-09-26 19:46:21 -07:00
Mark Andrews
b2ffe56fc5 add krb5-selfsub and ms-selfsub
(cherry picked from commit fbeefd4990)
2018-09-10 17:40:19 +10:00
Mark Andrews
6ff17d94bf check that name field is not a valid type
(cherry picked from commit 5fb75a3d75)
2018-09-10 17:25:07 +10:00
Mark Andrews
dbaf32a667 fix dns_ssumatchtype_subdomainms dns_ssumatchtype_subdomainkrb5 as they don't require the name field to be '.'
(cherry picked from commit 156d86e673)
2018-09-10 17:25:07 +10:00
Mark Andrews
ced589e379 avoid macro name collision with system defined macro
(cherry picked from commit 81b133d963)
2018-09-10 09:30:59 +10:00
Ondřej Surý
d20fd7b109 Remove excessive inclusion of isc/refcount.h from various header files 2018-09-07 16:55:22 +02:00
Ondřej Surý
b92a1791b3 Use isc/stdatomic.h to switch to __atomic builtins when compiling in C++ mode 2018-09-07 16:55:22 +02:00
Witold Kręcicki
3da95ab2ed Align CMSG buffers to a void* boundary, fixes crash on architectures with strict alignment
CHANGES entry

(cherry picked from commit 17212cf996)
2018-09-07 10:30:12 +02:00
Ondřej Surý
94a1c85366 Add C++ declarations to dns/fixedname.h 2018-09-05 18:00:32 -04:00
Ondřej Surý
302cae89f3 Bail-out early in the for install loops instead of continuing because for masks the error in the middle
(cherry picked from commit 25248eb097)
(cherry picked from commit 3fbceba0a8)
2018-09-03 13:49:35 +02:00
Witold Krecicki
eec06494aa Silence some warnings and errors
(cherry picked from commit 0f0dfc7f86)
2018-08-31 17:54:54 -07:00
Mark Andrews
10fdd1aa23 increase jitter to cover the entire potential steady state expire range when initially signing the zone
(cherry picked from commit 050fca2139)
2018-08-31 13:09:40 +10:00
Mark Andrews
20c79090bd fclose origfile and zonefile
(cherry picked from commit 455bb23236)
2018-08-31 12:25:01 +10:00
Evan Hunt
d3add15848 silence "missing print.h" warning
(cherry picked from commit 3c18b7d3fd)
2018-08-28 16:22:15 -07:00
Witold Kręcicki
80a025d1a7 rndc reconfig should not stat on existing zones, just load new ones. 2018-08-28 16:53:43 +02:00
Mark Andrews
c2c7020057 use sizeof(CK_SLOT_ID)
(cherry picked from commit 2c1d8b2e99)
2018-08-24 11:33:12 +10:00
Mark Andrews
58e33fcdb4 unlink before unlock
(cherry picked from commit 4742f4ecba)
2018-08-24 10:58:30 +10:00
Michał Kępień
cf7557dce0 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 749b3cacfc, 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:46:08 +02:00
Michał Kępień
de6b8ded56 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:56:42 +02:00
Ondřej Surý
32a0d602ea We want to install compatibility shim isc/int.h and isc/boolean.h headers 2018-08-22 09:07:39 +02:00
Ondřej Surý
e37e27c560 Update lwres to use stdint types to finish transition to using stdint types 2018-08-22 09:04:02 +02:00
Mark Andrews
d5cef9cd55 fix lock order reversal
(cherry picked from commit 2bb4392bb3)
2018-08-21 13:33:37 +10:00
Ondřej Surý
a2ffc37ad3 Don't install removed int.h and boolean.h headers 2018-08-14 20:14:05 -04:00
Mark Andrews
49b7ac4d44 add missing ATF_REQUIRE
(cherry picked from commit 0ce82e9d5f)
2018-08-14 19:59:06 -04:00
Mark Andrews
a21b1b86dc mempool didn't work for sizes less than sizeof(void*)
(cherry picked from commit 5dd1beec8e)
2018-08-14 09:12:41 -07:00
Michał Kępień
0d174c46ff 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 36436268b5)
2018-08-14 12:53:44 +02:00
Michał Kępień
c6d1239d90 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:59 +02:00
Michał Kępień
cbd85e0137 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:29:54 +02:00
Ondřej Surý
af6fe731fb Make ENOBUFS a soft error
(cherry picked from commit ebf3083e08)
2018-08-13 19:23:21 +02:00
Ondřej Surý
8ad12f613e Fix extra closing parenthesis in DNSTAP code 2018-08-12 16:12:14 +02:00
Ondřej Surý
71059dac02 Fix various build failures on Windows (Courtesy of rockerinthelocker) 2018-08-11 05:57:52 -04:00
Ondřej Surý
bfd31e282a Fix missing config.h in win32/socket.c and replace config.h with <config.h>
(cherry picked from commit d87c1a120d)
2018-08-11 11:00:50 +02:00
Ondřej Surý
0a10dfa524 Add compatibility isc/boolean.h and isc/int.h headers
(cherry picked from commit 0dad73aafa)
2018-08-10 15:20:58 +02:00
Ondřej Surý
eb745a2125 Remove duplicate config.h
(cherry picked from commit 7351c505a0)
(cherry picked from commit 2844f6529d)
2018-08-10 15:20:58 +02:00
Ondřej Surý
1084b40b44 Replace custom isc_boolean_t with C standard bool type
(cherry picked from commit 994e656977)
(cherry picked from commit 884929400c)
2018-08-10 15:20:57 +02:00
Ondřej Surý
aaa76dc654 Replace custom isc_u?intNN_t types with C99 u?intNN_t types
(cherry picked from commit cb6a185c69)
(cherry picked from commit d61e6a3111)
2018-08-10 15:20:57 +02:00
Ondřej Surý
07970c501d Get rid of extra UINT64_MAX definition in lib/isc/win32/time.c
(cherry picked from commit 055278c936)
(cherry picked from commit 3523850065)
2018-08-10 15:20:57 +02:00
Ondřej Surý
bfc6a25f2d Replace ISC_PRINT_QUADFORMAT with inttypes.h format constants
(cherry picked from commit 64fe6bbaf2)
(cherry picked from commit c863a076ae)
2018-08-10 15:20:57 +02:00
Evan Hunt
ba162bd0d4 caclulate nlabels and set *chainingp correctly
(cherry picked from commit e78e55f435)
2018-08-08 14:27:44 -07:00
Tinderbox User
4b0b459e5b prep 9.11.4-P1 2018-08-08 14:27:44 -07:00
Evan Hunt
98b2377de3 explicit DNAME query could trigger a crash if deny-answer-aliases was set
(cherry picked from commit a21c3810d3453548cc05ae19995125dabea9ca9c)
(cherry picked from commit 6e187b8656)
2018-08-08 14:27:17 -07:00
Mark Andrews
4130859964 remove dead code
(cherry picked from commit 83a1e87dd2)
2018-08-03 09:50:45 +10:00
Mark Andrews
c4089d38cd treat the signed instance of a inline zone as dynamic
(cherry picked from commit 9130f055f4)
2018-08-02 14:27:41 +10:00
Mark Andrews
a65c8e27b1 handle dns_aclelementtype_geoip
(cherry picked from commit 57eadf4d4f)
2018-08-02 09:59:58 +10:00
Mark Andrews
c47f3abead test dns_acl_isinsecure with geoip element
(cherry picked from commit fb8bb4e306)
2018-08-02 09:59:58 +10:00
Mark Andrews
d024898f35 use tlsa and smime structs to set common values
(cherry picked from commit 63c9ec367f)
2018-08-02 08:52:30 +10:00
Mark Andrews
0a9f953a2f refcount errors on error paths
(cherry picked from commit 4093efc900)
2018-07-31 18:43:18 +10:00
Mark Andrews
43c6f0d801 remove re-initalisation of common structure
(cherry picked from commit 6e06d3e7c6)
2018-07-12 09:49:01 +10:00
Mark Andrews
f1f2c0c493 remove redundant test
(cherry picked from commit 6eec7fe092)
2018-07-10 19:05:12 -07:00
Mark Andrews
078962a616 fix spelling of 'telemetry'
(cherry picked from commit 4f18b6a09a)
2018-07-10 18:30:45 -07:00
Tinderbox User
3bbd725a2c prep 9.11.4rc2 2018-06-28 05:07:42 +00:00
Evan Hunt
65bf99c85a use ISC_INT32_MAX as maximum 2018-06-27 18:40:24 -07:00
Witold Kręcicki
e92d5421c3 Fallback to normal procedure if creating of ixfr-from-differences fails
(cherry picked from commit b1254430df)
2018-06-27 18:33:33 -07:00
Witold Kręcicki
1919f5c937 Fix some issues with large journal entries
(cherry picked from commit 0db7130f2b)
2018-06-27 18:33:32 -07:00
Mark Andrews
6a52c54af6 cfg_parse_boolean's REQUIRE test for ret was incomplete.
(cherry picked from commit f1ee5e4a16)
2018-06-27 17:37:17 +10:00
Ondřej Surý
a6887424ca Un-deprecate the answer-cookie option 2018-06-26 15:18:36 -07:00
Witold Kręcicki
5e375f8b52 Use completely static-sized buffers
(cherry picked from commit 49f90025a0)
(cherry picked from commit 4007a9d020)
2018-06-26 15:23:28 -04:00
Witold Kręcicki
cd7bf90a54 Fix socket cmsg buffer usage
(cherry picked from commit d79be7dd5e)
(cherry picked from commit da63e95612)
2018-06-26 15:23:28 -04:00
Mark Andrews
316eebb699 construct a symtab of valid in-view targets then check that the target exists
(cherry picked from commit e01a4bcb20)
2018-06-26 10:53:59 -07:00
Mark Andrews
236ab4c453 fix casecompare return type for ninfo, tkey, txt
(cherry picked from commit 3ba1d1e43b)
2018-06-25 13:10:06 +10:00
Evan Hunt
a1690b24bc prepare 9.11.4rc1 2018-06-21 18:54:43 +02:00
Mark Andrews
09776e3e54 Declare the 'rdata' argument for dns_rdata_tostruct() to be const
(cherry picked from commit abb2fd1027)
2018-06-15 08:52:41 +02:00
Michał Kępień
2c09f7a06c Reimplement all zone logging functions using dns_zone_logv()
In order to decrease code duplication, express the logic contained in
all zone logging functions using dns_zone_logv() calls.

(cherry picked from commit 5c03cd339e)
2018-06-11 12:50:25 +02:00
Michał Kępień
4fab6fec76 Add dns_zone_logv()
Add a new libdns function, dns_zone_logv(), which takes a single va_list
argument rather than a variable number of arguments and can be used as a
base for implementing more specific zone logging functions.

(cherry picked from commit bb2dfb3f49)
2018-06-11 12:50:25 +02:00
Evan Hunt
b75a2b9730 improve readability of radix code
- use RADIX_V4, RADIX_V6, RADIX_V4_ECS, and RADIX_V6_ECS as array
  indices instead of 0 through 3.
- remove some unused macros

(cherry picked from commit f7f20b1202)
2018-06-08 12:11:19 -07:00
Evan Hunt
7a00ce2e77 ensure we try to validate glue records so RRSIG TTLs will be capped 2018-06-08 11:41:48 -07:00
Mark Andrews
d1f9dcca00 add cfg_parse_buffer4
(cherry picked from commit b313084af2)
2018-06-08 17:40:32 +10:00
Mukund Sivaraman
441de7dbe3 Add a answer-cookie named config option
(cherry picked from commit 2930507357)
2018-06-08 17:29:28 +10:00
Mark Andrews
34bfd20348 Add support for marking a option as deprecated.
(cherry picked from commit befff9452c)
2018-06-08 15:56:01 +10:00
Witold Kręcicki
9b17be187f Don't fetch DNSKEY when fuzzing resolver
(cherry picked from commit cb3208aa43)
2018-06-06 15:27:27 +02:00
Mark Andrews
dd05287a31 add support -T sigvalinsecs
(cherry picked from commit 87a3dc8ab9)
(cherry picked from commit 69340b5ac5)
2018-06-06 17:17:48 +10:00
Mark Andrews
298372d8d2 only sign with other keys when deleting a key if there are not already existing signature for the deleted algorithm
(cherry picked from commit 0667bf7ae7)
(cherry picked from commit c1e342cedb)
2018-06-06 17:10:01 +10:00
Mark Andrews
9a5f308287 add named.conf option root-key-sentinel
(cherry picked from commit 68e9315c7d)
(cherry picked from commit ee763ef281)
2018-06-04 17:41:22 -04:00
Mark Andrews
f9d19cab7f 4699. [func] Multiple cookie-secret clauses can now be specified.
The first one specified is used to generate new
                        server cookies.  [RT #45672]
2018-06-04 13:16:28 -07:00
Mukund Sivaraman
2bbea4513f Add NSEC3 fromtext/totext unittests
(cherry picked from commit b0d9198e03)
2018-06-04 13:02:44 +10:00
Mukund Sivaraman
0aa9c410d7 Don't insert 2nd space between NSEC3 nexthash and typemap fields
(cherry picked from commit d4ea1edd2c)
2018-06-04 13:02:44 +10:00
Mark Andrews
e568d66db3 work around cppcheck false positive
(cherry picked from commit cb5802e854)
2018-05-29 09:45:23 +10:00
Evan Hunt
884e8df7ca copyrights 2018-05-23 09:55:41 -07:00
Mark Andrews
fed871b720 ISC_SOCKEVENTATTR_TRUNC was not be set
(cherry picked from commit 6bff1768cf)
2018-05-18 16:00:36 +10:00
Mark Andrews
4868351c45 look for '\0'
(cherry picked from commit d03a81c265)
2018-05-18 12:45:14 +10:00
Mark Andrews
0256a07b96 add some %f format tests
(cherry picked from commit f5233ba5de)
2018-05-18 12:45:14 +10:00
Michał Kępień
803537b991 isc_buffer_*(): if source can be NULL, only call memmove() when length is non-zero
Certain isc_buffer_*() functions might call memmove() with the second
argument (source) set to NULL and the third argument (length) set to 0.
While harmless, it triggers an ubsan warning:

    runtime error: null pointer passed as argument 2, which is declared to never be null

Modify all memmove() call sites in lib/isc/include/isc/buffer.h and
lib/isc/buffer.c which may potentially use NULL as the second argument
(source) so that memmove() is only called if the third argument (length)
is non-zero.

(cherry picked from commit 6ddbca6f2b)
2018-05-15 09:32:19 +02:00
Michał Kępień
b7b1de0a39 dns_rdataslab_merge(): use dns_rdata_compare() instead of compare_rdata()
compare_rdata() was meant to be used as a qsort() callback.  Meanwhile,
dns_rdataslab_merge() calls compare_rdata() for a pair of dns_rdata_t
structures rather than a pair of struct xrdata structures, which is
harmless, but triggers an ubsan warning:

    rdataslab.c:84:33: runtime error: member access within address <address> with insufficient space for an object of type 'const struct xrdata'

Use dns_rdata_compare() instead of compare_rdata() to prevent the
warning from being triggered.

(cherry picked from commit 9bc6ba0be9)
2018-05-15 09:32:19 +02:00
Michał Kępień
bdc9f829c8 Extend the list of headers included by lib/dns/tests/sigs_test.c
(cherry picked from commit f98e145c5b)
2018-05-14 09:32:07 +02:00
Mark Andrews
c8f13be0dd return untested if not built with OPENSSL or PKCS11CRYPTO
(cherry picked from commit 2420320b96)
2018-05-14 09:32:07 +02:00
Ondřej Surý
188526f41c Remove $Id markers, Principal Author and Reviewed tags from the full source tree
(cherry picked from commit 55a10b7acd)
2018-05-11 14:25:15 +02:00
Michał Kępień
b4f07af8df Address GCC 8 -Wformat-truncation warnings
(cherry picked from commit 172d0c401e)
2018-05-10 10:54:38 +02:00
Evan Hunt
3123862be9 Merge branch '135-add-basic-unit-tests-for-update_sigs-v9_11' into 'v9_11'
Add basic unit tests for update_sigs()

Closes #135

See merge request isc-projects/bind9!112
2018-05-10 00:07:28 -07:00
Michał Kępień
505267f320 Define basic test cases for dns__zone_updatesigs()
Add some basic test cases ensuring dns__zone_updatesigs() behaves as
expected.

(cherry picked from commit 8b9d2c27b4)
(cherry picked from commit 3e93e4bb62)
2018-05-10 00:04:57 -07:00
Michał Kępień
e787e54ea1 Add a framework for dns__zone_updatesigs() unit tests
Add a new ATF test, sigs_test, containing everything required to start
defining test cases for dns__zone_updatesigs().  The framework is
written in a way which ensures that changes to zone database applied by
any dns__zone_updatesigs() invocation are preserved between subsequent
checks.

(cherry picked from commit 1f10186476)
(cherry picked from commit 3dde7c42db)
2018-05-10 00:04:55 -07:00
Michał Kępień
a6be59ce08 Move find_zone_keys() to lib/dns/zone_p.h
Rename find_zone_keys() to dns__zone_findkeys() and move it to
lib/dns/zone_p.h, so that it can be used in unit tests.  Add a comment
describing the purpose of this function.

(cherry picked from commit d7143986b1)
(cherry picked from commit fc0e99c7d7)
2018-05-10 00:04:14 -07:00
Michał Kępień
5c71a025c6 Move update_sigs() to lib/dns/zone_p.h
Rename update_sigs() to dns__zone_updatesigs() and move it to
lib/dns/zone_p.h, so that it can be unit tested.  Add a comment
describing the purpose of this function.

(cherry picked from commit b1947cee82)
(cherry picked from commit 4d06f50ba8)
2018-05-10 00:04:12 -07:00
Michał Kępień
5712d9528f Move zonediff_t to lib/dns/zone_p.h
Rename zonediff_t to dns__zonediff_t and move it to lib/dns/zone_p.h, so
that unit tests can be written for functions taking pointers to
structures of this type as arguments.

(cherry picked from commit ace465a9f9)
(cherry picked from commit ea15c54d8a)
2018-05-10 00:03:16 -07:00
Michał Kępień
536d6dc0c5 Add lib/dns/zone_p.h
Add a new private header file, lib/dns/zone_p.h, which will hold type
definitions and function prototypes not meant to be exported by libdns,
but required by zone-related unit tests.

(cherry picked from commit c1bc3be806)
(cherry picked from commit 2b0add6d1a)
2018-05-10 00:03:16 -07:00
Michał Kępień
1f454b8d91 Add a helper function to facilitate preparing dns_diff_t structures
Implement dns_test_difffromchanges(), a function which enables preparing
a dns_diff_t structure from a mostly-textual representation of zone
database changes to be applied.  This will improve readability of test
case definitions by allowing contents of a dns_diff_t structure, passed
e.g. to update_sigs(), to be represented in a human-friendly manner.

(cherry picked from commit 3c22af0d35)
(cherry picked from commit d4c603eb8a)
2018-05-10 00:03:16 -07:00
Michał Kępień
5097723d1b Rename dns_test_rdata_fromstring() to dns_test_rdatafromstring()
Remove the underscore from "rdata_fromstring" so that all helper
functions for libdns tests use a common naming covention.

(cherry picked from commit 2980cbd55f)
(cherry picked from commit 107102d333)
2018-05-10 00:03:15 -07:00
Michał Kępień
d45ee39bae Rework dns_test_makezone()
The dns_test_makezone() helper function always assigns the created zone
to some view, which is not always necessary and complicates cleanup of
non-managed zones as they are required not to be assigned to any view.

Rework dns_test_makezone() in order to make it easier to use in unit
tests operating on non-managed zones.  Use dns_name_fromstring() instead
of dns_name_fromtext() to simplify code.  Do not use the CHECK() macro
and add comments to make code flow simpler to follow.  Use
dns_test_makeview() instead of dns_view_create().

Adjust existing unit tests using this function so that they still pass.

(cherry picked from commit bfbeef3609)
(cherry picked from commit f70c02d2c2)
2018-05-10 00:03:15 -07:00
Ondřej Surý
9ad51fd177 Use standard OPENSSL_NO_ENGINE instead of custom USE_ENGINE define
(cherry picked from commit 8d648e7a8a)
(cherry picked from commit 311fbf3f5b)
2018-05-03 21:48:44 +02:00
Ondřej Surý
17314bc5da Use BN_hex2bn instead of custom BN_fromhex function
(cherry picked from commit 8bf192b4d1)
(cherry picked from commit 5af60f69fd)
2018-05-03 21:44:36 +02:00
Mark Andrews
dc9b77a852 simplify mask construction
(cherry picked from commit 22fab3199f)
2018-05-03 17:15:32 +02:00
Ondřej Surý
358ef09a6e Also test the higher part of the confidence interval
(cherry picked from commit 8d3220643c)
2018-05-03 15:05:20 +02:00
Ondřej Surý
c74decdf53 Workaround LibreSSL 2.7.0-2.7.2 quirk in DH_set0_key
(cherry picked from commit 6b9e3b7b06)
2018-05-03 14:27:33 +02:00
Ondřej Surý
f3414c74ec Add support for LibreSSL 2.7
(cherry picked from commit 29ff62a149)
2018-05-03 14:27:33 +02:00
Michał Kępień
911836509e Apply raw zone deltas to yet unsigned secure zones
When inline signing is enabled for a zone without creating signing keys
for it, changes subsequently applied to the raw zone will not be
reflected in the secure zone due to the dns_update_signaturesinc() call
inside receive_secure_serial() failing.  Given that an inline zone will
be served (without any signatures) even with no associated signing keys
being present, keep applying raw zone deltas to the secure zone until
keys become available in an attempt to follow the principle of least
astonishment.

(cherry picked from commit 6acf326969)
(cherry picked from commit 8a58a60772)
2018-04-25 12:09:53 -07:00
Michał Kępień
4ba247818c Only log bumped signed serial after a successful secure zone update
If a raw zone is modified, but the dns_update_signaturesinc() call in
receive_secure_serial() fails, the corresponding secure zone's database
will not be modified, even though by that time a message containing the
bumped signed serial will already have been logged.  This creates
confusion, because a different secure zone version will be served than
the one announced in the logs.  Move the relevant dns_zone_log() call so
that it is only performed if the secure zone's database is modified.

(cherry picked from commit cfbc8e264d)
(cherry picked from commit cdc7ab42b1)
2018-04-25 12:09:53 -07:00
Evan Hunt
f9da5a735e remove unnecessary comparison
(cherry picked from commit 8b1baa10ee)
2018-04-22 12:58:27 -07:00
Evan Hunt
0dcff8f93c silence warnings about unnecessary comparisons
- these are cases where result has been explicitly set, so
  if (result != ISC_R_SUCCESS) is unnecessary

(cherry picked from commit e00eb55cd2)
2018-04-22 12:58:27 -07:00
Evan Hunt
7f61e9d50e add header guards in files that were missing them
(cherry picked from commit 4247477b61)
2018-04-22 12:58:27 -07:00
Evan Hunt
694a1486ca fix shadowed global variables
(cherry picked from commit 9ca3ab1168)
2018-04-22 12:57:58 -07:00
Evan Hunt
b9db91aa64 fix duplicate include guard in dnsconf.h
- IMHO we should consider removing dnsconf.c and deprecating the
  /etc/dns.conf file, though, as I don't think it's likely anyone
  is using it

(cherry picked from commit a08ba418ef)
2018-04-22 12:57:58 -07:00
Mark Andrews
cdce9f752c remove exit calls after FATAL_ERROR
(cherry picked from commit f8d2a46daa)
2018-04-20 18:47:39 -04:00
Mark Andrews
578714e8f1 use %u instead of %d for unsigned int arguments
(cherry picked from commit 49f8e9571c)
2018-04-20 18:47:39 -04:00
Ondřej Surý
cf5598156d Sync isc_file_template functions between unix and win32, so they are same
(cherry picked from commit 8c99d104e3)
2018-04-12 09:00:13 +02:00
Ondřej Surý
6f550b33bf Cherry-pick changes to isc_file_template and associated unit test from v9_12 to v9_11
(cherry picked parts of commit 2dfb992349)
2018-04-12 08:59:35 +02:00
Mukund Sivaraman
63331f010e Fix TSIG dump keyfile name buffer size issues
(cherry picked from commit 44b84cb5a6)
2018-04-11 14:38:10 +02:00
Ondřej Surý
d69d5b96c1 Define PATH_MAX on Windows as _MAX_PATH, so we can use it everywhere
(cherry picked from commit 7467735258)
2018-04-11 14:38:10 +02:00
Evan Hunt
920eb326a5 Merge branch '183-add-dns_fixedname_initname-v9_11' into 'v9_11'
Add and use dns_fixedname_initname()

Closes #183

See merge request isc-projects/bind9!161
2018-04-10 14:08:27 -07:00
Michał Kępień
ecea678dac Use dns_fixedname_initname() where possible
Replace dns_fixedname_init() calls followed by dns_fixedname_name()
calls with calls to dns_fixedname_initname() where it is possible
without affecting current behavior and/or performance.

This patch was mostly prepared using Coccinelle and the following
semantic patch:

    @@
    expression fixedname, name;
    @@
    -	dns_fixedname_init(&fixedname);
    	...
    -	name = dns_fixedname_name(&fixedname);
    +	name = dns_fixedname_initname(&fixedname);

The resulting set of changes was then manually reviewed to exclude false
positives and apply minor tweaks.

It is likely that more occurrences of this pattern can be refactored in
an identical way.  This commit only takes care of the low-hanging fruit.

(cherry picked from commit 4df4a8e731)
(cherry picked from commit 0041aeb751)
2018-04-10 13:26:23 -07:00
Mukund Sivaraman
1dea0795d1 Add a dns_fixedname_initname() helper function
This also turns the dns_fixedname macros into functions.

(cherry picked from commit 0d2a03c290)
(cherry picked from commit cee4fef7c5)
2018-04-10 13:14:25 -07:00
Ondřej Surý
c5d1fedca8 A couple of more cleanups after free in opensslrsa_generate()
(cherry picked from commit d2b3188c61)
2018-04-06 14:23:58 +10:00
Petr Mensik
8baf990392 Do not assign NULL conditionally in OpenSSL < 1.1, make it always explicit.
(cherry picked from commit edaafacf36)
2018-04-06 14:23:58 +10:00
Petr Mensik
f36e13b039 Fix double free on RSA_generate_key_ex failure
(cherry picked from commit 01cc622e7b)
2018-04-06 14:23:57 +10:00
Mukund Sivaraman
4445ee6491 Check return value of isc_mem_get()
(cherry picked from commit de3a4af1bf)
2018-03-20 09:54:55 +11:00
Evan Hunt
09cf48603a update file headers 2018-03-15 18:38:48 -07:00
Evan Hunt
14e22ddf8c add an 'untested' case when none of the atomic operations are available
- this fixes a build failure introduced in change 4913 when
  compiling with ATF and --disable-atomic

(cherry picked from commit 1b3eac926e)
2018-03-15 12:09:38 -07:00
Evan Hunt
8b205089b7 update file headers to remove copyright years 2018-03-14 16:40:20 -07:00
Ondřej Surý
413b7d4b24 Update whitespace 2018-03-14 12:45:03 +01:00
Evan Hunt
e98ec51b96 Fix compiler warnings and test failures when building without threads
(cherry picked from commit 56353aaf42)
2018-03-10 10:37:20 -08:00
Evan Hunt
8da54db729 Merge branch 'clean-bin-tests' into 'v9_11'
clean up bin/tests, convert unit tests to ATF

Closes #115

See merge request isc-projects/bind9!93
2018-03-09 16:47:51 -08:00
Evan Hunt
442c1530a3 final cleanup
- update Kyuafiles to match Atffiles
- copyrights
- CHANGES note

(cherry picked from commit 86e00cbb71)
(cherry picked from commit 80834b5b90)
2018-03-09 16:17:56 -08:00
Evan Hunt
941946cf14 remove lib/tests as nothing uses it anymore
(cherry picked from commit d132f73497)
(cherry picked from commit d35f62434a)
2018-03-09 15:48:32 -08:00
Evan Hunt
64ea21a0e5 shorten ht_test and random_test
(cherry picked from commit 9b753aa154)
(cherry picked from commit 289836a066)
2018-03-09 15:47:21 -08:00
Evan Hunt
57a5820dcc migrate t_dst signature test to lib/dns/tests/dst_test
(cherry picked from commit a4ebe83cdb)
(cherry picked from commit 4439c471d1)
2018-03-09 15:46:53 -08:00
Evan Hunt
d3518e57b1 migrate t_db to lib/dns/tests/db_test
(cherry picked from commit f58ac8ada3)
(cherry picked from commit 56da937399)
2018-03-09 15:42:07 -08:00
Evan Hunt
b2fef3b438 migrate t_names to lib/dns/tests/name_test
(cherry picked from commit 8ecf69ef7b)
(cherry picked from commit aefad99e1e)
2018-03-09 15:40:21 -08:00
Evan Hunt
42fa3932ab migrate t_rbt to lib/dns/tests/rbt_test
(cherry picked from commit 109546cbda)
(cherry picked from commit c505afd183)
2018-03-09 15:39:42 -08:00
Evan Hunt
38f9cddcad migrate t_tasks to lib/isc/tests/task_test
(cherry picked from commit c6c1e99252)
(cherry picked from commit 88bfe56876)
2018-03-09 15:38:53 -08:00
Evan Hunt
5dd25f2285 migrate t_resolver to lib/dns/tests/resolver_test
(cherry picked from commit d80825c40b)
(cherry picked from commit 30e157f6e4)
2018-03-09 15:38:30 -08:00
Evan Hunt
274ee0b425 migrate t_timers to lib/isc/tests/timer_test
(cherry picked from commit e2b8699df9)
(cherry picked from commit efccdad0ea)
2018-03-09 15:37:03 -08:00
Evan Hunt
492e19d6ec migrate t_atomic to lib/isc/tests/atomic_test
(cherry picked from commit 874e2fc70c)
(cherry picked from commit c7fa56e8db)
2018-03-09 15:35:09 -08:00
Evan Hunt
814cd21e22 migrate t_mem to lib/isc/tests/mem_test
(cherry picked from commit 979f054702)
(cherry picked from commit af48544b75)
2018-03-09 15:34:31 -08:00
Evan Hunt
faedafd2b4 migrate t_net to lib/isc/tests
(cherry picked from commit 05b7251d51)
(cherry picked from commit af0c9b2cee)
2018-03-09 15:33:48 -08:00
Evan Hunt
323e2f7152 migrate t_sockaddr to lib/isc/tests
(cherry picked from commit 62f650078a)
(cherry picked from commit fadb93cf43)
2018-03-09 15:33:01 -08:00
Evan Hunt
fb076e0591 allow ATF tests to run in parallel
(cherry picked from commit ef0b4c91bc)
(cherry picked from commit 787c5d1394)
2018-03-09 14:37:46 -08:00
Evan Hunt
3b559cf7f0 Merge branch 'v9_11_3_patch' into v9_11 2018-03-08 14:29:24 -08:00
Mark Andrews
229e9e2215 check for in-view zones colliding with other zone definitions; also check the syntax of the in-view zone name
(cherry picked from commit 3e7e280040)
2018-03-08 12:20:59 +11:00
Michał Kępień
8f07fb476b Remove duplicate irs_resconf_load() unit test
The "sortlist-v4.conf" unit test for irs_resconf_load() is always run
twice due to a duplicate entry in the "tests" table.  Remove one of them
to prevent this.

(cherry picked from commit 6c09f305ae)
2018-03-06 09:24:41 +01:00
Michał Kępień
b4a10e77ea Do not ignore resolv.conf syntax errors
irs_resconf_load() stores the value returned by add_search() into ret
without consulting its current value first.  This causes any previous
errors raised while parsing resolv.conf to be ignored as long as any
"domain" or "search" statement is present in the file.

Prevent this by returning early in case an error is detected while
parsing resolv.conf.  Ensure that "searchlist" and "magic" members of
the created irs_resconf_t structure are always initialized before
isc_resconf_destroy() is called.

(cherry picked from commit 1f400b68a8)
2018-03-06 09:24:41 +01:00
Tinderbox User
c80e152862 prep 9.11.3rc2 2018-03-02 21:53:14 +00:00
Evan Hunt
8d1b3ceb4d temporarily revert change #4859 2018-03-02 12:16:31 -08:00
Evan Hunt
95c01ddde2 temporarily revert change #4859
(cherry picked from commit 84ec07999f)
2018-03-02 12:02:49 -08:00
Evan Hunt
0be726b440 minor cleanup and addressed a sprintf format warning
(cherry picked from commit ab0fe63f07)
2018-02-26 10:45:13 +11:00
Mark Andrews
bf79ae278c update printf format to match type
(cherry picked from commit 48ca11df5f)
2018-02-26 10:40:11 +11:00
Mark Andrews
4d8e501abe improve the conditional declaration and use of variable to silence cppcheck
(cherry picked from commit a04bb76973)
2018-02-26 10:40:11 +11:00
Mark Andrews
ae50b73d78 remove deadcode
(cherry picked from commit b71a1386ed)
2018-02-26 10:40:10 +11:00
Mark Andrews
ded99ca751 silence unread assignment warning by using POST macro
(cherry picked from commit e8249dcd49)
2018-02-26 10:40:10 +11:00
Mark Andrews
2c53a82644 update the sscanf format strings so they match the pointer types
(cherry picked from commit 70d192eb97)
2018-02-26 10:40:10 +11:00
Mark Andrews
77819f7d75 redefine CHECK so cppcheck see the definition
(cherry picked from commit a4186b1867)
2018-02-26 10:40:10 +11:00
Mark Andrews
edbca5937c conditionally typedef fstrmtable
(cherry picked from commit dcd309bea1)
2018-02-26 10:40:09 +11:00
Mark Andrews
82b109bf5d adjust goto target and conditional compilation so that cleanup_spillattimer and cleanup_alglock labels match the element to be cleanup and so that they are always used
(cherry picked from commit 7b27be54ee)
2018-02-26 10:40:09 +11:00
Petr Menšík
6d9b38e9fe unit/unittest.sh is generated by configure. It will always be
generated into builddir. If out-of-tree build is used, make unit
will always fail. Kyuafiles and testdata still have to be copied
manually into the builddir.

(cherry picked from commit 95cde3608a)
2018-02-23 15:50:33 -08:00
Petr Menšík
6876501605 Reuse new function from rt46864 for similar block elsewhere.
(cherry picked from commit e7a93321f0)
(cherry picked from commit cb98ce8e67)
2018-02-23 13:52:43 -08:00
Michał Kępień
5c080dfe73 Do not recheck DNS_ZONEFLG_LOADPENDING in zone_asyncload()
Remove a block of code which dates back to commit 8a2ab2b920, when
dns_zone_asyncload() did not yet check DNS_ZONEFLG_LOADPENDING.
Currently, no race in accessing DNS_ZONEFLG_LOADPENDING is possible any
more, because:

  - dns_zone_asyncload() is still the only function which may queue
    zone_asyncload(),

  - dns_zone_asyncload() accesses DNS_ZONEFLG_LOADPENDING under a lock
    (and potentially queues an event under the same lock),

  - DNS_ZONEFLG_LOADPENDING is not cleared until the load actually
    completes.

Thus, the rechecking code can be safely removed from zone_asyncload().

Note that this also brings zone_asyncload() to a state in which the
completion callback is always invoked.  This is required to prevent
leaking memory in case something goes wrong in zone_asyncload() and a
zone table the zone belongs to is indefinitely left with a positive
reference count.
2018-02-16 08:58:24 +01:00
Michał Kępień
4d391101a4 Asynchronous zone load events have no way of getting canceled
Code handling cancellation of asynchronous zone load events was likely
copied over from other functions when asynchronous zone loading was
first implemented in commit 8a2ab2b920.  However, unlike those other
functions, asynchronous zone loading events currently have no way of
getting canceled once they get posted, which means the aforementioned
code is effectively dead.  Remove it to prevent confusion.
2018-02-16 08:58:24 +01:00
Michał Kępień
749b3cacfc Only clear DNS_ZONEFLG_LOADPENDING in zone_asyncload() if zone loading is completed immediately
zone_load() is not always synchronous, it may only initiate an
asynchronous load and return DNS_R_CONTINUE, which means zone loading
has not yet been completed.  In such a case, zone_asyncload() must not
clear DNS_ZONEFLG_LOADPENDING immediately and leave that up to
zone_postload().
2018-02-16 08:58:24 +01:00
Michał Kępień
e0205aac03 Lock zone before checking whether its asynchronous load is already pending
While this is not an issue in named, which only calls
dns_zone_asyncload() from task-exclusive mode, this function is exported
by libdns and thus may in theory be concurrently called for the same
zone by multiple threads.  It also does not hurt to be consistent
locking-wise with other DNS_ZONEFLG_LOADPENDING accesses.
2018-02-16 08:58:24 +01:00
Mark Andrews
ad5550c029 add POST(len); 2018-02-16 15:08:25 +11:00
Mark Andrews
65cfe7e1ad conditionally declare stacksize 2018-02-16 15:08:24 +11:00
Mark Andrews
027bc5535c add POST(len); 2018-02-16 15:08:24 +11:00
Mark Andrews
bdf5c08fc4 Clarify calculation precedence for '&' and '?' 2018-02-16 15:08:24 +11:00
Mark Andrews
2c85b9afd7 add POST(tl) 2018-02-16 15:08:24 +11:00
Mark Andrews
118203925a conditionally declare strbuf 2018-02-16 15:06:51 +11:00
Mark Andrews
c2e6e799b3 test for == 0 rather than <= as value is unsigned 2018-02-16 15:00:06 +11:00
Mark Andrews
22c6b2308e use %u instead of %d 2018-02-16 14:58:17 +11:00
Mark Andrews
c58169ff1c use %u instead of %d 2018-02-16 14:58:17 +11:00
Mark Andrews
8db1762d68 use %u instead of %d 2018-02-16 14:58:17 +11:00
Mark Andrews
f6dae15117 use %u instead of %d 2018-02-16 14:58:17 +11:00
Mark Andrews
8d9097b0b7 use %u instead of %d 2018-02-16 14:58:17 +11:00
Mark Andrews
54672c31b9 use %u instead of %d 2018-02-16 14:54:36 +11:00
Mark Andrews
262d514345 use %u instead of %d 2018-02-16 14:54:36 +11:00
Mark Andrews
8c51ba3aac use %u instead of %d 2018-02-16 14:54:36 +11:00
Mark Andrews
8dba09602b case to unsigned; reorder expression 2018-02-16 14:52:51 +11:00
Mark Andrews
012ae8afa2 simplify expression 2018-02-16 14:45:20 +11:00
Mark Andrews
0ae4bf22d2 use %u and preserve unsigned property 2018-02-16 14:45:20 +11:00
Mark Andrews
7873680877 cast to unsigned 2018-02-16 14:36:56 +11:00
Mark Andrews
ea6732c354 preserve unsigned property 2018-02-16 14:36:56 +11:00
Mark Andrews
c57610f1cc make both arguments of & unsigned 2018-02-16 14:36:56 +11:00
Mark Andrews
faf0e3ff65 use %u instead of %d 2018-02-16 14:36:56 +11:00
Mark Andrews
ab0805b73e shift unsigned (~0U) rather than signed (~0) contant 2018-02-16 14:35:36 +11:00
Mark Andrews
4b83e4e105 use %u instead of %d 2018-02-16 14:35:36 +11:00
Mark Andrews
351a27ef5b unsigned constants 2018-02-16 14:35:36 +11:00
Mark Andrews
e6cd8a52aa unsigned constants 2018-02-16 14:34:18 +11:00
Mark Andrews
9cc1ea9566 use %u instead of %d 2018-02-16 14:32:24 +11:00
Mark Andrews
2bbdfaaa0a use %u instead of %d 2018-02-16 14:32:24 +11:00
Mark Andrews
95657b047e use %u instead of %d 2018-02-16 14:32:24 +11:00
Mark Andrews
42c12e6b81 INSIST ipnum6 != NULL 2018-02-16 14:29:27 +11:00
Mark Andrews
cd86c23e87 use %u instead of %d 2018-02-16 14:29:27 +11:00