Compare commits

..
Author SHA1 Message Date
Evan Hunt 3063f34e47 put A and AAAA in additional section when responding to type=ANAME queries 2018-03-18 14:27:22 +00:00
Evan Hunt 8c0f8a7c0c initial implementation of ANAME rrtype, using type code point 65532
- this is only the bare type represetation, with no special processing
2018-03-18 11:40:51 +00:00
1791 changed files with 17482 additions and 8536 deletions
+4 -43
View File
@@ -15,84 +15,72 @@ stages:
tags: tags:
- linux - linux
- docker - docker
- amd64
.debian-jessie-i386: &debian_jessie_i386_image .debian-jessie-i386: &debian_jessie_i386_image
image: "$CI_REGISTRY_IMAGE:debian-jessie-i386" image: "$CI_REGISTRY_IMAGE:debian-jessie-i386"
tags: tags:
- linux - linux
- docker - docker
- i386
.debian-stretch-amd64: &debian_stretch_amd64_image .debian-stretch-amd64: &debian_stretch_amd64_image
image: "$CI_REGISTRY_IMAGE:debian-stretch-amd64" image: "$CI_REGISTRY_IMAGE:debian-stretch-amd64"
tags: tags:
- linux - linux
- docker - docker
- amd64
.debian-stretch-i386:: &debian_stretch_i386_image .debian-stretch-i386:: &debian_stretch_i386_image
image: "$CI_REGISTRY_IMAGE:debian-stretch-i386" image: "$CI_REGISTRY_IMAGE:debian-stretch-i386"
tags: tags:
- linux - linux
- docker - docker
- i386
.debian-buster-amd64: &debian_buster_amd64_image .debian-buster-amd64: &debian_buster_amd64_image
image: "$CI_REGISTRY_IMAGE:debian-buster-amd64" image: "$CI_REGISTRY_IMAGE:debian-buster-amd64"
tags: tags:
- linux - linux
- docker - docker
- amd64
.debian-buster-i386:: &debian_buster_i386_image .debian-buster-i386:: &debian_buster_i386_image
image: "$CI_REGISTRY_IMAGE:debian-buster-i386" image: "$CI_REGISTRY_IMAGE:debian-buster-i386"
tags: tags:
- linux - linux
- docker - docker
- i386
.debian-sid-amd64: &debian_sid_amd64_image .debian-sid-amd64: &debian_sid_amd64_image
image: "$CI_REGISTRY_IMAGE:debian-sid-amd64" image: "$CI_REGISTRY_IMAGE:debian-sid-amd64"
tags: tags:
- linux - linux
- docker - docker
- amd64
.debian-sid-i386: &debian_sid_i386_image .debian-sid-i386: &debian_sid_i386_image
image: "$CI_REGISTRY_IMAGE:debian-sid-i386" image: "$CI_REGISTRY_IMAGE:debian-sid-i386"
tags: tags:
- linux - linux
- docker - docker
- i386
.ubuntu-trusty-amd64: &ubuntu_trusty_amd64_image .ubuntu-trusty-amd64: &ubuntu_trusty_amd64_image
image: "$CI_REGISTRY_IMAGE:ubuntu-trusty-amd64" image: "$CI_REGISTRY_IMAGE:ubuntu-trusty-amd64"
tags: tags:
- linux - linux
- docker - docker
- amd64
.ubuntu-trusty-i386: &ubuntu_trusty_i386_image .ubuntu-trusty-i386: &ubuntu_trusty_i386_image
image: "$CI_REGISTRY_IMAGE:ubuntu-trusty-i386" image: "$CI_REGISTRY_IMAGE:ubuntu-trusty-i386"
tags: tags:
- linux - linux
- docker - docker
- i386
.ubuntu-xenial-amd64: &ubuntu_xenial_amd64_image .ubuntu-xenial-amd64: &ubuntu_xenial_amd64_image
image: "$CI_REGISTRY_IMAGE:ubuntu-xenial-amd64" image: "$CI_REGISTRY_IMAGE:ubuntu-xenial-amd64"
tags: tags:
- linux - linux
- docker - docker
- amd64
.ubuntu-xenial-i386: &ubuntu_xenial_i386_image .ubuntu-xenial-i386: &ubuntu_xenial_i386_image
image: "$CI_REGISTRY_IMAGE:ubuntu-xenial-i386" image: "$CI_REGISTRY_IMAGE:ubuntu-xenial-i386"
tags: tags:
- linux - linux
- docker - docker
- i386
.build: &build_job .build: &build_job
stage: build stage: build
@@ -112,8 +100,7 @@ stages:
- rm -rf .ccache - rm -rf .ccache
- bash -x bin/tests/system/ifconfig.sh up - bash -x bin/tests/system/ifconfig.sh up
script: script:
- ( cd bin/tests && make -j${TEST_PARALLEL_JOBS:-1} -k test V=1 ) - cd bin/tests && make -j${TEST_PARALLEL_JOBS:-1} -k test V=1
- test -s bin/tests/system/systests.output
artifacts: artifacts:
untracked: true untracked: true
expire_in: '1 week' expire_in: '1 week'
@@ -174,31 +161,11 @@ precheck:debian:sid:amd64:
# <<: *ubuntu_xenial_i386_image # <<: *ubuntu_xenial_i386_image
# <<: *build_job # <<: *build_job
build:clang:debian:sid:amd64:
variables:
CC: clang-6.0
CFLAGS: "-Wall -Wextra -Wenum-conversion -O2 -g"
<<: *debian_sid_amd64_image
<<: *build_job
build:debian:sid:amd64: build:debian:sid:amd64:
variables:
CC: gcc
CFLAGS: "-Wall -Wextra -O2 -g"
<<: *debian_sid_amd64_image <<: *debian_sid_amd64_image
<<: *build_job <<: *build_job
build:clang:debian:sid:i386:
variables:
CC: clang-6.0
CFLAGS: "-Wall -Wextra -Wenum-conversion -O2 -g"
<<: *debian_sid_i386_image
<<: *build_job
build:debian:sid:i386: build:debian:sid:i386:
variables:
CC: gcc
CFLAGS: "-Wall -Wextra -O2 -g"
<<: *debian_sid_i386_image <<: *debian_sid_i386_image
<<: *build_job <<: *build_job
@@ -207,13 +174,7 @@ unittest:debian:sid:amd64:
<<: *unit_test_job <<: *unit_test_job
dependencies: dependencies:
- build:debian:sid:amd64 - build:debian:sid:amd64
unittest:clang:debian:sid:amd64:
<<: *debian_sid_amd64_image
<<: *unit_test_job
dependencies:
- build:clang:debian:sid:amd64
unittest:debian:sid:i386: unittest:debian:sid:i386:
<<: *debian_sid_i386_image <<: *debian_sid_i386_image
<<: *unit_test_job <<: *unit_test_job
@@ -225,7 +186,7 @@ systemtest:debian:sid:amd64:
<<: *system_test_job <<: *system_test_job
dependencies: dependencies:
- build:debian:sid:amd64 - build:debian:sid:amd64
systemtest:debian:sid:i386: systemtest:debian:sid:i386:
<<: *debian_sid_i386_image <<: *debian_sid_i386_image
<<: *system_test_job <<: *system_test_job
+2 -122
View File
@@ -1,123 +1,3 @@
4951. [protocol] Add "HOME.ARPA" to list of built in empty zones as
per RFC 8375. [GL #273]
--- 9.13.0 released ---
4950. [bug] ISC_SOCKEVENTATTR_TRUNC was not be set. [GL #238]
4949. [placeholder]
4948. [bug] When request-nsid is turned on, EDNS NSID options
should be logged at level info. Since change 3741
they have been logged at debug(3) by mistake.
[GL !290]
4947. [func] Replace all random functions with isc_random(),
isc_random_buf() and isc_random_uniform() API.
[GL #221]
4946. [bug] Additional glue was not being returned by resolver
for unsigned zones since change 4596. [GL #209]
4945. [func] BIND can no longer be built without DNSSEC support.
A cryptography provder (i.e., OpenSSL or a hardware
service module with PKCS#11 support) must be
available. [GL #244]
4944. [cleanup] Silence cppcheck portability warnings in
lib/isc/tests/buffer_test.c. [GL #239]
4943. [bug] Change 4687 consumed too much memory when running
system tests with --with-tuning=large. Reduced the
hash table size to 512 entries for 'named -m record'
restoring the previous memory footprint. [GL #248]
4942. [cleanup] Consolidate multiple instances of splitting of
batchline in dig into a single function. [GL #196]
4941. [cleanup] Silence clang static analyzer warnings. [GL #196]
4940. [cleanup] Extract the loop in dns__zone_updatesigs() into
separate functions to improve code readability.
[GL #135]
4939. [test] Add basic unit tests for update_sigs(). [GL #135]
4938. [placeholder]
4937. [func] Remove support for OpenSSL < 1.0.0 [GL #191]
4936. [func] Always use OpenSSL or PKCS#11 random data providers,
and remove the --{enable,disable}-crypto-rand configure
options. [GL #165]
4935. [func] Add support for LibreSSL >= 2.7.0 (some OpenSSL 1.1.0
call were added). [GL #191]
4934. [security] The serve-stale feature could cause an assertion failure
in rbtdb.c even when stale-answer-enable was false.
Simultaneous use of stale cache records and NSEC
aggressive negative caching could trigger a recursion
loop. (CVE-2018-5737) [GL #185]
4933. [bug] Not creating signing keys for an inline signed zone
prevented changes applied to the raw zone from being
reflected in the secure zone until signing keys were
made available. [GL #159]
4932. [bug] Bumped signed serial of an inline signed zone was
logged even when an error occurred while updating
signatures. [GL #159]
4931. [func] Removed the "rbtdb64" database implementation.
[GL #217]
4930. [bug] Remove a bogus check in nslookup command line
argument processing. [GL #206]
4929. [func] Add the ability to set RA and TC in queries made by
dig (+[no]raflag, +[no]tcflag). [GL #213]
4928. [func] The "dnskey-sig-validity" option allows
"sig-validity-interval" to be overriden for signatures
covering DNSKEY RRsets. [GL #145]
4927. [placeholder]
4926. [func] Add root key sentinel support. To disable, add
'root-key-sentinel no;' to named.conf. [GL #37]
4925. [func] Several configuration options that define intervals
can now take TTL value suffixes (for example, 2h or 1d)
in addition to integer parameters. These include
max-cache-ttl, max-ncache-ttl, max-policy-ttl,
fstrm-set-reopen-interval, interface-interval, and
min-update-interval. [GL #203]
4924. [cleanup] Clean up the isc_string_* namespace and leave
only strlcpy and strlcat. [GL #178]
4923. [cleanup] Refactor socket and socket event options into
enum types. [GL !135]
4922. [bug] dnstap: Log the destination address of client
packets rather than the interface address.
[GL #197]
4921. [cleanup] Add dns_fixedname_initname() and refactor the caller
code to make usage of the new function, as a part of
refactoring dns_fixedname_*() macros were turned into
functions. [GL #183]
4920. [cleanup] Clean up libdns removing most of the backwards
compatibility wrappers.
4919. [cleanup] Clean up the isc_hash_* namespace and leave only
the FNV-1a hash implementation. [GL #178]
4918. [bug] Fix double free after keygen error in dnssec-keygen
when OpenSSL >= 1.1.0 is used and RSA_generate_key_ex
fails. [GL #109]
4917. [func] Support 64 RPZ policy zones by default. [GL #123] 4917. [func] Support 64 RPZ policy zones by default. [GL #123]
4916. [func] Remove IDNA2003 support and the bundled idnkit-1.0 4916. [func] Remove IDNA2003 support and the bundled idnkit-1.0
@@ -129,10 +9,10 @@
like dig without IDN support. libidn2 version 2.0 like dig without IDN support. libidn2 version 2.0
or higher is needed for +idnout enabled by default. or higher is needed for +idnout enabled by default.
4914. [security] A bug in zone database reference counting could lead to 4914. [bug] A bug in zone database reference counting could lead to
a crash when multiple versions of a slave zone were a crash when multiple versions of a slave zone were
transferred from a master in close succession. transferred from a master in close succession.
(CVE-2018-5736) [GL #134] [GL #134]
4913. [test] Re-implemented older unit tests in bin/tests as ATF, 4913. [test] Re-implemented older unit tests in bin/tests as ATF,
removed the lib/tests unit testing library. [GL #115] removed the lib/tests unit testing library. [GL #115]
+1
View File
@@ -522,3 +522,4 @@ BIND 9.2.0
DNSSEC implementation is still considered experimental. For detailed DNSSEC implementation is still considered experimental. For detailed
information about the state of the DNSSEC implementation, see the file information about the state of the DNSSEC implementation, see the file
doc/misc/dnssec. doc/misc/dnssec.
+1 -1
View File
@@ -74,7 +74,7 @@ tags:
find lib bin -name "*.[ch]" -print | @ETAGS@ - find lib bin -name "*.[ch]" -print | @ETAGS@ -
test check: test check:
@if test -n "`${PERL} ${top_srcdir}/bin/tests/system/testsock.pl 2>/dev/null || echo fail`"; then \ @if test -n "`${PERL} ${top_srcdir}/bin/tests/system/testsock.pl 2>&- || echo fail`"; then \
echo I: NOTE: The tests were not run because they require that; \ echo I: NOTE: The tests were not run because they require that; \
echo I: the IP addresses 10.53.0.1 through 10.53.0.8 are configured; \ echo I: the IP addresses 10.53.0.1 through 10.53.0.8 are configured; \
echo I: as alias addresses on the loopback interface. Please run; \ echo I: as alias addresses on the loopback interface. Please run; \
+1
View File
@@ -24,3 +24,4 @@ Setting Description
may be useful when debugging may be useful when debugging
-DISC_HEAP_CHECK Test heap consistency after every heap -DISC_HEAP_CHECK Test heap consistency after every heap
operation; used when debugging operation; used when debugging
+1 -1
View File
@@ -18,7 +18,7 @@ VERSION=@BIND9_VERSION@
CINCLUDES = ${NS_INCLUDES} ${BIND9_INCLUDES} ${DNS_INCLUDES} ${ISCCFG_INCLUDES} \ CINCLUDES = ${NS_INCLUDES} ${BIND9_INCLUDES} ${DNS_INCLUDES} ${ISCCFG_INCLUDES} \
${ISC_INCLUDES} @DST_OPENSSL_INC@ ${ISC_INCLUDES} @DST_OPENSSL_INC@
CDEFINES = -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\" CDEFINES = @CRYPTO@ -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\"
CWARNINGS = CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
+19 -15
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: check-tool.c,v 1.44 2011/12/22 07:32:39 each Exp $ */
/*! \file */ /*! \file */
@@ -98,17 +99,18 @@ isc_boolean_t docheckmx = ISC_FALSE;
isc_boolean_t dochecksrv = ISC_FALSE; isc_boolean_t dochecksrv = ISC_FALSE;
isc_boolean_t docheckns = ISC_FALSE; isc_boolean_t docheckns = ISC_FALSE;
#endif #endif
dns_zoneopt_t zone_options = DNS_ZONEOPT_CHECKNS | unsigned int zone_options = DNS_ZONEOPT_CHECKNS |
DNS_ZONEOPT_CHECKMX | DNS_ZONEOPT_CHECKMX |
DNS_ZONEOPT_MANYERRORS | DNS_ZONEOPT_MANYERRORS |
DNS_ZONEOPT_CHECKNAMES | DNS_ZONEOPT_CHECKNAMES |
DNS_ZONEOPT_CHECKINTEGRITY | DNS_ZONEOPT_CHECKINTEGRITY |
#if CHECK_SIBLING #if CHECK_SIBLING
DNS_ZONEOPT_CHECKSIBLING | DNS_ZONEOPT_CHECKSIBLING |
#endif #endif
DNS_ZONEOPT_CHECKWILDCARD | DNS_ZONEOPT_CHECKWILDCARD |
DNS_ZONEOPT_WARNMXCNAME | DNS_ZONEOPT_WARNMXCNAME |
DNS_ZONEOPT_WARNSRVCNAME; DNS_ZONEOPT_WARNSRVCNAME;
unsigned int zone_options2 = 0;
/* /*
* This needs to match the list in bin/named/log.c. * This needs to match the list in bin/named/log.c.
@@ -588,7 +590,8 @@ check_ttls(dns_zone_t *zone, dns_ttl_t maxttl) {
dns_rdataset_t rdataset; dns_rdataset_t rdataset;
dns_fixedname_t fname; dns_fixedname_t fname;
dns_name_t *name; dns_name_t *name;
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
dns_rdataset_init(&rdataset); dns_rdataset_init(&rdataset);
CHECK(dns_zone_getdb(zone, &db)); CHECK(dns_zone_getdb(zone, &db));
@@ -683,12 +686,12 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
isc_buffer_constinit(&buffer, zonename, strlen(zonename)); isc_buffer_constinit(&buffer, zonename, strlen(zonename));
isc_buffer_add(&buffer, strlen(zonename)); isc_buffer_add(&buffer, strlen(zonename));
origin = dns_fixedname_initname(&fixorigin); dns_fixedname_init(&fixorigin);
origin = dns_fixedname_name(&fixorigin);
CHECK(dns_name_fromtext(origin, &buffer, dns_rootname, 0, NULL)); CHECK(dns_name_fromtext(origin, &buffer, dns_rootname, 0, NULL));
CHECK(dns_zone_setorigin(zone, origin)); CHECK(dns_zone_setorigin(zone, origin));
CHECK(dns_zone_setdbtype(zone, 1, (const char * const *) dbtype)); CHECK(dns_zone_setdbtype(zone, 1, (const char * const *) dbtype));
CHECK(dns_zone_setfile(zone, filename, fileformat, CHECK(dns_zone_setfile2(zone, filename, fileformat));
&dns_master_style_default));
if (journal != NULL) if (journal != NULL)
CHECK(dns_zone_setjournal(zone, journal)); CHECK(dns_zone_setjournal(zone, journal));
@@ -698,6 +701,7 @@ load_zone(isc_mem_t *mctx, const char *zonename, const char *filename,
dns_zone_setclass(zone, rdclass); dns_zone_setclass(zone, rdclass);
dns_zone_setoption(zone, zone_options, ISC_TRUE); dns_zone_setoption(zone, zone_options, ISC_TRUE);
dns_zone_setoption2(zone, zone_options2, ISC_TRUE);
dns_zone_setoption(zone, DNS_ZONEOPT_NOMERGE, nomerge); dns_zone_setoption(zone, DNS_ZONEOPT_NOMERGE, nomerge);
dns_zone_setmaxttl(zone, maxttl); dns_zone_setmaxttl(zone, maxttl);
@@ -760,8 +764,8 @@ dump_zone(const char *zonename, dns_zone_t *zone, const char *filename,
} }
} }
result = dns_zone_dumptostream(zone, output, fileformat, style, result = dns_zone_dumptostream3(zone, output, fileformat, style,
rawversion); rawversion);
if (output != stdout) if (output != stdout)
(void)isc_stdio_close(output); (void)isc_stdio_close(output);
+3 -2
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: check-tool.h,v 1.18 2011/12/09 23:47:02 tbox Exp $ */
#ifndef CHECK_TOOL_H #ifndef CHECK_TOOL_H
#define CHECK_TOOL_H #define CHECK_TOOL_H
@@ -21,7 +22,6 @@
#include <dns/masterdump.h> #include <dns/masterdump.h>
#include <dns/types.h> #include <dns/types.h>
#include <dns/zone.h>
ISC_LANG_BEGINDECLS ISC_LANG_BEGINDECLS
@@ -49,7 +49,8 @@ extern isc_boolean_t nomerge;
extern isc_boolean_t docheckmx; extern isc_boolean_t docheckmx;
extern isc_boolean_t docheckns; extern isc_boolean_t docheckns;
extern isc_boolean_t dochecksrv; extern isc_boolean_t dochecksrv;
extern dns_zoneopt_t zone_options; extern unsigned int zone_options;
extern unsigned int zone_options2;
ISC_LANG_ENDDECLS ISC_LANG_ENDDECLS
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000-2002, 2004, 2005, 2007, 2009, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -136,5 +136,5 @@ BIND 9 Administrator Reference Manual\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2000-2002, 2004, 2005, 2007, 2009, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
.br .br
+11 -1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: named-checkconf.c,v 1.56 2011/03/12 04:59:46 tbox Exp $ */
/*! \file */ /*! \file */
@@ -20,6 +21,7 @@
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/dir.h> #include <isc/dir.h>
#include <isc/entropy.h>
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/log.h> #include <isc/log.h>
#include <isc/mem.h> #include <isc/mem.h>
@@ -406,7 +408,7 @@ configure_zone(const char *vclass, const char *view,
obj = NULL; obj = NULL;
if (get_maps(maps, "max-zone-ttl", &obj)) { if (get_maps(maps, "max-zone-ttl", &obj)) {
maxttl = cfg_obj_asuint32(obj); maxttl = cfg_obj_asuint32(obj);
zone_options |= DNS_ZONEOPT_CHECKTTL; zone_options2 |= DNS_ZONEOPT2_CHECKTTL;
} }
result = load_zone(mctx, zname, zfile, masterformat, result = load_zone(mctx, zname, zfile, masterformat,
@@ -537,6 +539,7 @@ main(int argc, char **argv) {
isc_mem_t *mctx = NULL; isc_mem_t *mctx = NULL;
isc_result_t result; isc_result_t result;
int exit_status = 0; int exit_status = 0;
isc_entropy_t *ectx = NULL;
isc_boolean_t load_zones = ISC_FALSE; isc_boolean_t load_zones = ISC_FALSE;
isc_boolean_t list_zones = ISC_FALSE; isc_boolean_t list_zones = ISC_FALSE;
isc_boolean_t print = ISC_FALSE; isc_boolean_t print = ISC_FALSE;
@@ -652,6 +655,10 @@ main(int argc, char **argv) {
RUNTIME_CHECK(setup_logging(mctx, stdout, &logc) == ISC_R_SUCCESS); RUNTIME_CHECK(setup_logging(mctx, stdout, &logc) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_entropy_create(mctx, &ectx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)
== ISC_R_SUCCESS);
dns_result_register(); dns_result_register();
RUNTIME_CHECK(cfg_parser_create(mctx, logc, &parser) == ISC_R_SUCCESS); RUNTIME_CHECK(cfg_parser_create(mctx, logc, &parser) == ISC_R_SUCCESS);
@@ -682,6 +689,9 @@ main(int argc, char **argv) {
isc_log_destroy(&logc); isc_log_destroy(&logc);
isc_hash_destroy();
isc_entropy_detach(&ectx);
isc_mem_destroy(&mctx); isc_mem_destroy(&mctx);
#ifdef _WIN32 #ifdef _WIN32
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2000-2002, 2004, 2005, 2007, 2009, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000-2002, 2004, 2005, 2007, 2009, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2000-2002, 2004-2007, 2009-2016, 2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000-2002, 2004-2007, 2009-2016 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -325,5 +325,5 @@ BIND 9 Administrator Reference Manual\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2000-2002, 2004-2007, 2009-2016, 2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2000-2002, 2004-2007, 2009-2016 Internet Systems Consortium, Inc. ("ISC")
.br .br
+9 -1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: named-checkzone.c,v 1.65.32.2 2012/02/07 02:45:21 each Exp $ */
/*! \file */ /*! \file */
@@ -19,6 +20,7 @@
#include <isc/app.h> #include <isc/app.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/dir.h> #include <isc/dir.h>
#include <isc/entropy.h>
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/log.h> #include <isc/log.h>
#include <isc/mem.h> #include <isc/mem.h>
@@ -45,6 +47,7 @@
static int quiet = 0; static int quiet = 0;
static isc_mem_t *mctx = NULL; static isc_mem_t *mctx = NULL;
static isc_entropy_t *ectx = NULL;
dns_zone_t *zone = NULL; dns_zone_t *zone = NULL;
dns_zonetype_t zonetype = dns_zone_master; dns_zonetype_t zonetype = dns_zone_master;
static int dumpzone = 0; static int dumpzone = 0;
@@ -257,7 +260,7 @@ main(int argc, char **argv) {
break; break;
case 'l': case 'l':
zone_options |= DNS_ZONEOPT_CHECKTTL; zone_options2 |= DNS_ZONEOPT2_CHECKTTL;
endp = NULL; endp = NULL;
maxttl = strtol(isc_commandline_argument, &endp, 0); maxttl = strtol(isc_commandline_argument, &endp, 0);
if (*endp != '\0') { if (*endp != '\0') {
@@ -519,6 +522,9 @@ main(int argc, char **argv) {
if (!quiet) if (!quiet)
RUNTIME_CHECK(setup_logging(mctx, errout, &lctx) RUNTIME_CHECK(setup_logging(mctx, errout, &lctx)
== ISC_R_SUCCESS); == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_entropy_create(mctx, &ectx) == ISC_R_SUCCESS);
RUNTIME_CHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)
== ISC_R_SUCCESS);
dns_result_register(); dns_result_register();
@@ -550,6 +556,8 @@ main(int argc, char **argv) {
destroy(); destroy();
if (lctx != NULL) if (lctx != NULL)
isc_log_destroy(&lctx); isc_log_destroy(&lctx);
isc_hash_destroy();
isc_entropy_detach(&ectx);
isc_mem_destroy(&mctx); isc_mem_destroy(&mctx);
#ifdef _WIN32 #ifdef _WIN32
DestroySockets(); DestroySockets();
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2000-2002, 2004-2007, 2009-2016, 2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000-2002, 2004-2007, 2009-2016 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+14 -3
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2009, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2009, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -39,7 +39,7 @@
ddns-confgen \- ddns key generation tool ddns-confgen \- ddns key generation tool
.SH "SYNOPSIS" .SH "SYNOPSIS"
.HP \w'\fBtsig\-keygen\fR\ 'u .HP \w'\fBtsig\-keygen\fR\ 'u
\fBtsig\-keygen\fR [\fB\-a\ \fR\fB\fIalgorithm\fR\fR] [\fB\-h\fR] [name] \fBtsig\-keygen\fR [\fB\-a\ \fR\fB\fIalgorithm\fR\fR] [\fB\-h\fR] [\fB\-r\ \fR\fB\fIrandomfile\fR\fR] [name]
.HP \w'\fBddns\-confgen\fR\ 'u .HP \w'\fBddns\-confgen\fR\ 'u
\fBddns\-confgen\fR [\fB\-a\ \fR\fB\fIalgorithm\fR\fR] [\fB\-h\fR] [\fB\-k\ \fR\fB\fIkeyname\fR\fR] [\fB\-q\fR] [\fB\-r\ \fR\fB\fIrandomfile\fR\fR] [\-s\ \fIname\fR | \-z\ \fIzone\fR] \fBddns\-confgen\fR [\fB\-a\ \fR\fB\fIalgorithm\fR\fR] [\fB\-h\fR] [\fB\-k\ \fR\fB\fIkeyname\fR\fR] [\fB\-q\fR] [\fB\-r\ \fR\fB\fIrandomfile\fR\fR] [\-s\ \fIname\fR | \-z\ \fIzone\fR]
.SH "DESCRIPTION" .SH "DESCRIPTION"
@@ -109,6 +109,17 @@ only\&.) Quiet mode: Print only the key, with no explanatory text or usage examp
\fBtsig\-keygen\fR\&. \fBtsig\-keygen\fR\&.
.RE .RE
.PP .PP
\-r \fIrandomfile\fR
.RS 4
Specifies a source of random data for generating the authorization\&. If the operating system does not provide a
/dev/random
or equivalent device, the default source of randomness is keyboard input\&.
randomdev
specifies the name of a character device or file containing random data to be used instead of the default\&. The special value
keyboard
indicates that keyboard input should be used\&.
.RE
.PP
\-s \fIname\fR \-s \fIname\fR
.RS 4 .RS 4
(\fBddns\-confgen\fR (\fBddns\-confgen\fR
@@ -144,5 +155,5 @@ BIND 9 Administrator Reference Manual\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2009, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2009, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
.br .br
+11 -7
View File
@@ -26,6 +26,7 @@
#include <isc/base64.h> #include <isc/base64.h>
#include <isc/buffer.h> #include <isc/buffer.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/keyboard.h> #include <isc/keyboard.h>
#include <isc/mem.h> #include <isc/mem.h>
@@ -36,7 +37,7 @@
#include <isc/time.h> #include <isc/time.h>
#include <isc/util.h> #include <isc/util.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -66,9 +67,10 @@ usage(int status) {
if (progmode == progmode_confgen) { if (progmode == progmode_confgen) {
fprintf(stderr, "\ fprintf(stderr, "\
Usage:\n\ Usage:\n\
%s [-a alg] [-k keyname] [-q] [-s name | -z zone]\n\ %s [-a alg] [-k keyname] [-r randomfile] [-q] [-s name | -z zone]\n\
-a alg: algorithm (default hmac-sha256)\n\ -a alg: algorithm (default hmac-sha256)\n\
-k keyname: name of the key as it will be used in named.conf\n\ -k keyname: name of the key as it will be used in named.conf\n\
-r randomfile: source of random data (use \"keyboard\" for key timing)\n\
-s name: domain name to be updated using the created key\n\ -s name: domain name to be updated using the created key\n\
-z zone: name of the zone as it will be used in named.conf\n\ -z zone: name of the zone as it will be used in named.conf\n\
-q: quiet mode: print the key, with no explanatory text\n", -q: quiet mode: print the key, with no explanatory text\n",
@@ -76,8 +78,9 @@ Usage:\n\
} else { } else {
fprintf(stderr, "\ fprintf(stderr, "\
Usage:\n\ Usage:\n\
%s [-a alg] [keyname]\n\ %s [-a alg] [-r randomfile] [keyname]\n\
-a alg: algorithm (default hmac-sha256)\n\n", -a alg: algorithm (default hmac-sha256)\n\
-r randomfile: source of random data (use \"keyboard\" for key timing)\n",
progname); progname);
} }
@@ -92,6 +95,7 @@ main(int argc, char **argv) {
isc_buffer_t key_txtbuffer; isc_buffer_t key_txtbuffer;
char key_txtsecret[256]; char key_txtsecret[256];
isc_mem_t *mctx = NULL; isc_mem_t *mctx = NULL;
const char *randomfile = NULL;
const char *keyname = NULL; const char *keyname = NULL;
const char *zone = NULL; const char *zone = NULL;
const char *self_domain = NULL; const char *self_domain = NULL;
@@ -102,7 +106,7 @@ main(int argc, char **argv) {
int len = 0; int len = 0;
int ch; int ch;
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
dns_result_register(); dns_result_register();
@@ -164,7 +168,7 @@ main(int argc, char **argv) {
usage(1); usage(1);
break; break;
case 'r': case 'r':
fatal("The -r option has been deprecated."); randomfile = isc_commandline_argument;
break; break;
case 's': case 's':
if (progmode == progmode_confgen) if (progmode == progmode_confgen)
@@ -231,7 +235,7 @@ main(int argc, char **argv) {
isc_buffer_init(&key_txtbuffer, &key_txtsecret, sizeof(key_txtsecret)); isc_buffer_init(&key_txtbuffer, &key_txtsecret, sizeof(key_txtsecret));
generate_key(mctx, alg, keysize, &key_txtbuffer); generate_key(mctx, randomfile, alg, keysize, &key_txtbuffer);
if (!quiet) if (!quiet)
+18
View File
@@ -46,6 +46,7 @@
<command>tsig-keygen</command> <command>tsig-keygen</command>
<arg choice="opt" rep="norepeat"><option>-a <replaceable class="parameter">algorithm</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-a <replaceable class="parameter">algorithm</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-h</option></arg> <arg choice="opt" rep="norepeat"><option>-h</option></arg>
<arg choice="opt" rep="norepeat"><option>-r <replaceable class="parameter">randomfile</replaceable></option></arg>
<arg choice="opt" rep="norepeat">name</arg> <arg choice="opt" rep="norepeat">name</arg>
</cmdsynopsis> </cmdsynopsis>
<cmdsynopsis sepchar=" "> <cmdsynopsis sepchar=" ">
@@ -156,6 +157,23 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>-r <replaceable class="parameter">randomfile</replaceable></term>
<listitem>
<para>
Specifies a source of random data for generating the
authorization. If the operating system does not provide a
<filename>/dev/random</filename> or equivalent device, the
default source of randomness is keyboard input.
<filename>randomdev</filename> specifies the name of a
character device or file containing random data to be used
instead of the default. The special value
<filename>keyboard</filename> indicates that keyboard input
should be used.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term>-s <replaceable class="parameter">name</replaceable></term> <term>-s <replaceable class="parameter">name</replaceable></term>
<listitem> <listitem>
+16 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2009, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2009, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -35,6 +35,7 @@
<code class="command">tsig-keygen</code> <code class="command">tsig-keygen</code>
[<code class="option">-a <em class="replaceable"><code>algorithm</code></em></code>] [<code class="option">-a <em class="replaceable"><code>algorithm</code></em></code>]
[<code class="option">-h</code>] [<code class="option">-h</code>]
[<code class="option">-r <em class="replaceable"><code>randomfile</code></em></code>]
[name] [name]
</p></div> </p></div>
<div class="cmdsynopsis"><p> <div class="cmdsynopsis"><p>
@@ -135,6 +136,20 @@
This is essentially identical to <span class="command"><strong>tsig-keygen</strong></span>. This is essentially identical to <span class="command"><strong>tsig-keygen</strong></span>.
</p> </p>
</dd> </dd>
<dt><span class="term">-r <em class="replaceable"><code>randomfile</code></em></span></dt>
<dd>
<p>
Specifies a source of random data for generating the
authorization. If the operating system does not provide a
<code class="filename">/dev/random</code> or equivalent device, the
default source of randomness is keyboard input.
<code class="filename">randomdev</code> specifies the name of a
character device or file containing random data to be used
instead of the default. The special value
<code class="filename">keyboard</code> indicates that keyboard input
should be used.
</p>
</dd>
<dt><span class="term">-s <em class="replaceable"><code>name</code></em></span></dt> <dt><span class="term">-s <em class="replaceable"><code>name</code></em></span></dt>
<dd> <dd>
<p> <p>
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: os.h,v 1.3 2009/06/11 23:47:55 tbox Exp $ */
/*! \file */ /*! \file */
+41 -7
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: keygen.c,v 1.4 2009/11/12 14:02:38 marka Exp $ */
/*! \file */ /*! \file */
@@ -19,6 +20,7 @@
#include <isc/base64.h> #include <isc/base64.h>
#include <isc/buffer.h> #include <isc/buffer.h>
#include <isc/entropy.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/keyboard.h> #include <isc/keyboard.h>
#include <isc/mem.h> #include <isc/mem.h>
@@ -112,12 +114,17 @@ alg_bits(dns_secalg_t alg) {
} }
/*% /*%
* Generate a key of size 'keysize' and place it in 'key_txtbuffer' * Generate a key of size 'keysize' using entropy source 'randomfile',
* and place it in 'key_txtbuffer'
*/ */
void void
generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize, generate_key(isc_mem_t *mctx, const char *randomfile, dns_secalg_t alg,
isc_buffer_t *key_txtbuffer) { int keysize, isc_buffer_t *key_txtbuffer) {
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
isc_entropysource_t *entropy_source = NULL;
int open_keyboard = ISC_ENTROPY_KEYBOARDMAYBE;
int entropy_flags = 0;
isc_entropy_t *ectx = NULL;
isc_buffer_t key_rawbuffer; isc_buffer_t key_rawbuffer;
isc_region_t key_rawregion; isc_region_t key_rawregion;
char key_rawsecret[64]; char key_rawsecret[64];
@@ -144,12 +151,31 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
fatal("unsupported algorithm %d\n", alg); fatal("unsupported algorithm %d\n", alg);
} }
DO("initialize dst library", dst_lib_init(mctx, NULL));
DO("create entropy context", isc_entropy_create(mctx, &ectx));
#ifdef ISC_PLATFORM_CRYPTORANDOM
if (randomfile == NULL) {
isc_entropy_usehook(ectx, ISC_TRUE);
}
#endif
if (randomfile != NULL && strcmp(randomfile, "keyboard") == 0) {
randomfile = NULL;
open_keyboard = ISC_ENTROPY_KEYBOARDYES;
}
DO("start entropy source", isc_entropy_usebestsource(ectx,
&entropy_source,
randomfile,
open_keyboard));
entropy_flags = ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY;
DO("initialize dst library", dst_lib_init(mctx, ectx, entropy_flags));
DO("generate key", dst_key_generate(dns_rootname, alg, DO("generate key", dst_key_generate(dns_rootname, alg,
keysize, 0, 0, DNS_KEYPROTO_ANY, keysize, 0, 0,
dns_rdataclass_in, mctx, &key, DNS_KEYPROTO_ANY,
NULL)); dns_rdataclass_in, mctx, &key));
isc_buffer_init(&key_rawbuffer, &key_rawsecret, sizeof(key_rawsecret)); isc_buffer_init(&key_rawbuffer, &key_rawsecret, sizeof(key_rawsecret));
@@ -160,9 +186,17 @@ generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize,
DO("bsse64 encode secret", isc_base64_totext(&key_rawregion, -1, "", DO("bsse64 encode secret", isc_base64_totext(&key_rawregion, -1, "",
key_txtbuffer)); key_txtbuffer));
/*
* Shut down the entropy source now so the "stop typing" message
* does not muck with the output.
*/
if (entropy_source != NULL)
isc_entropy_destroysource(&entropy_source);
if (key != NULL) if (key != NULL)
dst_key_free(&key); dst_key_free(&key);
isc_entropy_detach(&ectx);
dst_lib_destroy(); dst_lib_destroy();
} }
+3 -2
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: keygen.h,v 1.3 2009/06/11 23:47:55 tbox Exp $ */
#ifndef RNDC_KEYGEN_H #ifndef RNDC_KEYGEN_H
#define RNDC_KEYGEN_H 1 #define RNDC_KEYGEN_H 1
@@ -19,8 +20,8 @@
ISC_LANG_BEGINDECLS ISC_LANG_BEGINDECLS
void generate_key(isc_mem_t *mctx, dns_secalg_t alg, int keysize, void generate_key(isc_mem_t *mctx, const char *randomfile, dns_secalg_t alg,
isc_buffer_t *key_txtbuffer); int keysize, isc_buffer_t *key_txtbuffer);
void write_key_file(const char *keyfile, const char *user, void write_key_file(const char *keyfile, const char *user,
const char *keyname, isc_buffer_t *secret, const char *keyname, isc_buffer_t *secret,
+14 -3
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2001, 2003-2005, 2007, 2009, 2013-2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2001, 2003-2005, 2007, 2009, 2013-2017 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -39,7 +39,7 @@
rndc-confgen \- rndc key generation tool rndc-confgen \- rndc key generation tool
.SH "SYNOPSIS" .SH "SYNOPSIS"
.HP \w'\fBrndc\-confgen\fR\ 'u .HP \w'\fBrndc\-confgen\fR\ 'u
\fBrndc\-confgen\fR [\fB\-a\fR] [\fB\-A\ \fR\fB\fIalgorithm\fR\fR] [\fB\-b\ \fR\fB\fIkeysize\fR\fR] [\fB\-c\ \fR\fB\fIkeyfile\fR\fR] [\fB\-h\fR] [\fB\-k\ \fR\fB\fIkeyname\fR\fR] [\fB\-p\ \fR\fB\fIport\fR\fR] [\fB\-s\ \fR\fB\fIaddress\fR\fR] [\fB\-t\ \fR\fB\fIchrootdir\fR\fR] [\fB\-u\ \fR\fB\fIuser\fR\fR] \fBrndc\-confgen\fR [\fB\-a\fR] [\fB\-A\ \fR\fB\fIalgorithm\fR\fR] [\fB\-b\ \fR\fB\fIkeysize\fR\fR] [\fB\-c\ \fR\fB\fIkeyfile\fR\fR] [\fB\-h\fR] [\fB\-k\ \fR\fB\fIkeyname\fR\fR] [\fB\-p\ \fR\fB\fIport\fR\fR] [\fB\-r\ \fR\fB\fIrandomfile\fR\fR] [\fB\-s\ \fR\fB\fIaddress\fR\fR] [\fB\-t\ \fR\fB\fIchrootdir\fR\fR] [\fB\-u\ \fR\fB\fIuser\fR\fR]
.SH "DESCRIPTION" .SH "DESCRIPTION"
.PP .PP
\fBrndc\-confgen\fR \fBrndc\-confgen\fR
@@ -147,6 +147,17 @@ listens for connections from
\fBrndc\fR\&. The default is 953\&. \fBrndc\fR\&. The default is 953\&.
.RE .RE
.PP .PP
\-r \fIrandomfile\fR
.RS 4
Specifies a source of random data for generating the authorization\&. If the operating system does not provide a
/dev/random
or equivalent device, the default source of randomness is keyboard input\&.
randomdev
specifies the name of a character device or file containing random data to be used instead of the default\&. The special value
keyboard
indicates that keyboard input should be used\&.
.RE
.PP
\-s \fIaddress\fR \-s \fIaddress\fR
.RS 4 .RS 4
Specifies the IP address where Specifies the IP address where
@@ -206,5 +217,5 @@ BIND 9 Administrator Reference Manual\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2001, 2003-2005, 2007, 2009, 2013-2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2001, 2003-2005, 2007, 2009, 2013-2017 Internet Systems Consortium, Inc. ("ISC")
.br .br
+6 -3
View File
@@ -29,6 +29,7 @@
#include <isc/base64.h> #include <isc/base64.h>
#include <isc/buffer.h> #include <isc/buffer.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/keyboard.h> #include <isc/keyboard.h>
#include <isc/mem.h> #include <isc/mem.h>
@@ -69,7 +70,7 @@ usage(int status) {
fprintf(stderr, "\ fprintf(stderr, "\
Usage:\n\ Usage:\n\
%s [-a] [-b bits] [-c keyfile] [-k keyname] [-p port] \ %s [-a] [-b bits] [-c keyfile] [-k keyname] [-p port] [-r randomfile] \
[-s addr] [-t chrootdir] [-u user]\n\ [-s addr] [-t chrootdir] [-u user]\n\
-a: generate just the key clause and write it to keyfile (%s)\n\ -a: generate just the key clause and write it to keyfile (%s)\n\
-A alg: algorithm (default hmac-sha256)\n\ -A alg: algorithm (default hmac-sha256)\n\
@@ -77,6 +78,7 @@ Usage:\n\
-c keyfile: specify an alternate key file (requires -a)\n\ -c keyfile: specify an alternate key file (requires -a)\n\
-k keyname: the name as it will be used in named.conf and rndc.conf\n\ -k keyname: the name as it will be used in named.conf and rndc.conf\n\
-p port: the port named will listen on and rndc will connect to\n\ -p port: the port named will listen on and rndc will connect to\n\
-r randomfile: source of random data (use \"keyboard\" for key timing)\n\
-s addr: the address to which rndc should connect\n\ -s addr: the address to which rndc should connect\n\
-t chrootdir: write a keyfile in chrootdir as well (requires -a)\n\ -t chrootdir: write a keyfile in chrootdir as well (requires -a)\n\
-u user: set the keyfile owner to \"user\" (requires -a)\n", -u user: set the keyfile owner to \"user\" (requires -a)\n",
@@ -93,6 +95,7 @@ main(int argc, char **argv) {
isc_mem_t *mctx = NULL; isc_mem_t *mctx = NULL;
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
const char *keyname = NULL; const char *keyname = NULL;
const char *randomfile = NULL;
const char *serveraddr = NULL; const char *serveraddr = NULL;
dns_secalg_t alg; dns_secalg_t alg;
const char *algname; const char *algname;
@@ -162,7 +165,7 @@ main(int argc, char **argv) {
isc_commandline_argument); isc_commandline_argument);
break; break;
case 'r': case 'r':
fatal("The -r option has been deprecated."); randomfile = isc_commandline_argument;
break; break;
case 's': case 's':
serveraddr = isc_commandline_argument; serveraddr = isc_commandline_argument;
@@ -214,7 +217,7 @@ main(int argc, char **argv) {
DO("create memory context", isc_mem_create(0, 0, &mctx)); DO("create memory context", isc_mem_create(0, 0, &mctx));
isc_buffer_init(&key_txtbuffer, &key_txtsecret, sizeof(key_txtsecret)); isc_buffer_init(&key_txtbuffer, &key_txtsecret, sizeof(key_txtsecret));
generate_key(mctx, alg, keysize, &key_txtbuffer); generate_key(mctx, randomfile, alg, keysize, &key_txtbuffer);
if (keyonly) { if (keyonly) {
write_key_file(keyfile, chrootdir == NULL ? user : NULL, write_key_file(keyfile, chrootdir == NULL ? user : NULL,
+19
View File
@@ -58,6 +58,7 @@
<arg choice="opt" rep="norepeat"><option>-h</option></arg> <arg choice="opt" rep="norepeat"><option>-h</option></arg>
<arg choice="opt" rep="norepeat"><option>-k <replaceable class="parameter">keyname</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-k <replaceable class="parameter">keyname</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-p <replaceable class="parameter">port</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-p <replaceable class="parameter">port</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-r <replaceable class="parameter">randomfile</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">address</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">address</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">chrootdir</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">chrootdir</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-u <replaceable class="parameter">user</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-u <replaceable class="parameter">user</replaceable></option></arg>
@@ -190,6 +191,24 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>-r <replaceable class="parameter">randomfile</replaceable></term>
<listitem>
<para>
Specifies a source of random data for generating the
authorization. If the operating
system does not provide a <filename>/dev/random</filename>
or equivalent device, the default source of randomness
is keyboard input. <filename>randomdev</filename>
specifies
the name of a character device or file containing random
data to be used instead of the default. The special value
<filename>keyboard</filename> indicates that keyboard
input should be used.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term>-s <replaceable class="parameter">address</replaceable></term> <term>-s <replaceable class="parameter">address</replaceable></term>
<listitem> <listitem>
+17 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2001, 2003-2005, 2007, 2009, 2013-2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2001, 2003-2005, 2007, 2009, 2013-2017 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -40,6 +40,7 @@
[<code class="option">-h</code>] [<code class="option">-h</code>]
[<code class="option">-k <em class="replaceable"><code>keyname</code></em></code>] [<code class="option">-k <em class="replaceable"><code>keyname</code></em></code>]
[<code class="option">-p <em class="replaceable"><code>port</code></em></code>] [<code class="option">-p <em class="replaceable"><code>port</code></em></code>]
[<code class="option">-r <em class="replaceable"><code>randomfile</code></em></code>]
[<code class="option">-s <em class="replaceable"><code>address</code></em></code>] [<code class="option">-s <em class="replaceable"><code>address</code></em></code>]
[<code class="option">-t <em class="replaceable"><code>chrootdir</code></em></code>] [<code class="option">-t <em class="replaceable"><code>chrootdir</code></em></code>]
[<code class="option">-u <em class="replaceable"><code>user</code></em></code>] [<code class="option">-u <em class="replaceable"><code>user</code></em></code>]
@@ -153,6 +154,21 @@
The default is 953. The default is 953.
</p> </p>
</dd> </dd>
<dt><span class="term">-r <em class="replaceable"><code>randomfile</code></em></span></dt>
<dd>
<p>
Specifies a source of random data for generating the
authorization. If the operating
system does not provide a <code class="filename">/dev/random</code>
or equivalent device, the default source of randomness
is keyboard input. <code class="filename">randomdev</code>
specifies
the name of a character device or file containing random
data to be used instead of the default. The special value
<code class="filename">keyboard</code> indicates that keyboard
input should be used.
</p>
</dd>
<dt><span class="term">-s <em class="replaceable"><code>address</code></em></span></dt> <dt><span class="term">-s <em class="replaceable"><code>address</code></em></span></dt>
<dd> <dd>
<p> <p>
+2
View File
@@ -7,6 +7,8 @@
# See the COPYRIGHT file distributed with this work for additional # See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership. # information regarding copyright ownership.
# $Id: Makefile.in,v 1.3 2009/06/11 23:47:55 tbox Exp $
srcdir = @srcdir@ srcdir = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: os.c,v 1.3 2009/06/11 23:47:55 tbox Exp $ */
/*! \file */ /*! \file */
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: util.c,v 1.3 2009/06/11 23:47:55 tbox Exp $ */
/*! \file */ /*! \file */
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: util.h,v 1.4 2009/09/29 15:06:05 fdupont Exp $ */
#ifndef RNDC_UTIL_H #ifndef RNDC_UTIL_H
#define RNDC_UTIL_H 1 #define RNDC_UTIL_H 1
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: os.c,v 1.3 2009/06/11 23:47:55 tbox Exp $ */
#include <config.h> #include <config.h>
+1 -1
View File
@@ -18,7 +18,7 @@ VERSION=@BIND9_VERSION@
CINCLUDES = -I${srcdir}/include ${DNS_INCLUDES} ${ISC_INCLUDES} \ CINCLUDES = -I${srcdir}/include ${DNS_INCLUDES} ${ISC_INCLUDES} \
${IRS_INCLUDES} ${ISCCFG_INCLUDES} @DST_OPENSSL_INC@ ${IRS_INCLUDES} ${ISCCFG_INCLUDES} @DST_OPENSSL_INC@
CDEFINES = -DVERSION=\"${VERSION}\" \ CDEFINES = @CRYPTO@ -DVERSION=\"${VERSION}\" \
-DSYSCONFDIR=\"${sysconfdir}\" -DSYSCONFDIR=\"${sysconfdir}\"
CWARNINGS = CWARNINGS =
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -437,5 +437,5 @@ RFC5155\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2014-2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2014-2017 Internet Systems Consortium, Inc. ("ISC")
.br .br
+35 -21
View File
@@ -521,17 +521,17 @@ setup_style(dns_master_style_t **stylep) {
} }
if (multiline || (nottl && noclass)) if (multiline || (nottl && noclass))
result = dns_master_stylecreate(&style, styleflags, result = dns_master_stylecreate2(&style, styleflags,
24, 24, 24, 32, 80, 8, 24, 24, 24, 32, 80, 8,
splitwidth, mctx); splitwidth, mctx);
else if (nottl || noclass) else if (nottl || noclass)
result = dns_master_stylecreate(&style, styleflags, result = dns_master_stylecreate2(&style, styleflags,
24, 24, 32, 40, 80, 8, 24, 24, 32, 40, 80, 8,
splitwidth, mctx); splitwidth, mctx);
else else
result = dns_master_stylecreate(&style, styleflags, result = dns_master_stylecreate2(&style, styleflags,
24, 32, 40, 48, 80, 8, 24, 32, 40, 48, 80, 8,
splitwidth, mctx); splitwidth, mctx);
if (result == ISC_R_SUCCESS) if (result == ISC_R_SUCCESS)
*stylep = style; *stylep = style;
@@ -550,7 +550,8 @@ convert_name(dns_fixedname_t *fn, dns_name_t **name, const char *text) {
isc_buffer_constinit(&b, text, len); isc_buffer_constinit(&b, text, len);
isc_buffer_add(&b, len); isc_buffer_add(&b, len);
n = dns_fixedname_initname(fn); dns_fixedname_init(fn);
n = dns_fixedname_name(fn);
result = dns_name_fromtext(n, &b, dns_rootname, 0, NULL); result = dns_name_fromtext(n, &b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
@@ -943,6 +944,18 @@ cleanup:
return (result); return (result);
} }
static char *
next_token(char **stringp, const char *delim) {
char *res;
do {
res = strsep(stringp, delim);
if (res == NULL)
break;
} while (*res == '\0');
return (res);
}
static isc_result_t static isc_result_t
parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max, parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
const char *desc) { const char *desc) {
@@ -962,23 +975,23 @@ parse_uint(isc_uint32_t *uip, const char *value, isc_uint32_t max,
static void static void
plus_option(char *option) { plus_option(char *option) {
isc_result_t result; isc_result_t result;
char *cmd, *value, *last = NULL; char option_store[256];
char *cmd, *value, *ptr;
isc_boolean_t state = ISC_TRUE; isc_boolean_t state = ISC_TRUE;
INSIST(option != NULL); strlcpy(option_store, option, sizeof(option_store));
ptr = option_store;
cmd = strtok_r(option, "=", &last); cmd = next_token(&ptr,"=");
if (cmd == NULL) { if (cmd == NULL) {
printf(";; Invalid option %s\n", option); printf(";; Invalid option %s\n", option_store);
return; return;
} }
value = ptr;
if (strncasecmp(cmd, "no", 2)==0) { if (strncasecmp(cmd, "no", 2)==0) {
cmd += 2; cmd += 2;
state = ISC_FALSE; state = ISC_FALSE;
} }
value = strtok_r(NULL, "\0", &last);
#define FULLCHECK(A) \ #define FULLCHECK(A) \
do { \ do { \
size_t _l = strlen(cmd); \ size_t _l = strlen(cmd); \
@@ -1525,8 +1538,9 @@ get_reverse(char *reverse, size_t len, char *value, isc_boolean_t strict) {
dns_name_t *name; dns_name_t *name;
unsigned int options = 0; unsigned int options = 0;
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
result = dns_byaddr_createptrname(&addr, options, name); name = dns_fixedname_name(&fname);
result = dns_byaddr_createptrname2(&addr, options, name);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
dns_name_format(name, reverse, (unsigned int)len); dns_name_format(name, reverse, (unsigned int)len);
@@ -1610,8 +1624,8 @@ main(int argc, char *argv[]) {
/* Create client */ /* Create client */
clopt = DNS_CLIENTCREATEOPT_USECACHE; clopt = DNS_CLIENTCREATEOPT_USECACHE;
result = dns_client_createx(mctx, actx, taskmgr, socketmgr, timermgr, result = dns_client_createx2(mctx, actx, taskmgr, socketmgr, timermgr,
clopt, &client, srcaddr4, srcaddr6); clopt, &client, srcaddr4, srcaddr6);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
delv_log(ISC_LOG_ERROR, "dns_client_create: %s", delv_log(ISC_LOG_ERROR, "dns_client_create: %s",
isc_result_totext(result)); isc_result_totext(result));
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2014-2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2014-2017 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+1 -1
View File
@@ -21,7 +21,7 @@ CINCLUDES = -I${srcdir}/include ${DNS_INCLUDES} \
${BIND9_INCLUDES} ${ISC_INCLUDES} \ ${BIND9_INCLUDES} ${ISC_INCLUDES} \
${IRS_INCLUDES} ${ISCCFG_INCLUDES} @LIBIDN2_CFLAGS@ @DST_OPENSSL_INC@ ${IRS_INCLUDES} ${ISCCFG_INCLUDES} @LIBIDN2_CFLAGS@ @DST_OPENSSL_INC@
CDEFINES = -DVERSION=\"${VERSION}\" CDEFINES = -DVERSION=\"${VERSION}\" @CRYPTO@
CWARNINGS = CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
+9 -25
View File
@@ -176,7 +176,7 @@ using the command\-line interface\&.
.PP .PP
\-i \-i
.RS 4 .RS 4
Do reverse IPv6 lookups using the obsolete RFC 1886 IP6\&.INT domain, which is no longer in use\&. Obsolete bit string label queries (RFC 2874) are not attempted\&. Do reverse IPv6 lookups using the obsolete RFC1886 IP6\&.INT domain, which is no longer in use\&. Obsolete bit string label queries (RFC2874) are not attempted\&.
.RE .RE
.PP .PP
\-k \fIkeyfile\fR \-k \fIkeyfile\fR
@@ -210,15 +210,13 @@ from other arguments\&.
.PP .PP
\-t \fItype\fR \-t \fItype\fR
.RS 4 .RS 4
The resource record type to query\&. It can be any valid query type\&. If it is a resource record type supported in BIND 9, it can be given by the type mnemonic (such as "NS" or "AAAA")\&. The default query type is "A", unless the The resource record type to query\&. It can be any valid query type which is supported in BIND 9\&. The default query type is "A", unless the
\fB\-x\fR \fB\-x\fR
option is supplied to indicate a reverse lookup\&. A zone transfer can be requested by specifying a type of AXFR\&. When an incremental zone transfer (IXFR) is required, set the option is supplied to indicate a reverse lookup\&. A zone transfer can be requested by specifying a type of AXFR\&. When an incremental zone transfer (IXFR) is required, set the
\fItype\fR \fItype\fR
to to
ixfr=N\&. The incremental zone transfer will contain the changes made to the zone since the serial number in the zone\*(Aqs SOA record was ixfr=N\&. The incremental zone transfer will contain the changes made to the zone since the serial number in the zone\*(Aqs SOA record was
\fIN\fR\&. \fIN\fR\&.
.sp
All resource record types can be expressed as "TYPEnn", where "nn" is the number of the type\&. If the resource record type is not supported in BIND 9, the result will be displayed as described in RFC 3597\&.
.RE .RE
.PP .PP
\-u \-u
@@ -466,11 +464,6 @@ Show [or do not show] the IP address and port number that supplied the answer wh
option is enabled\&. If short form answers are requested, the default is not to show the source address and port number of the server that provided the answer\&. option is enabled\&. If short form answers are requested, the default is not to show the source address and port number of the server that provided the answer\&.
.RE .RE
.PP .PP
\fB+[no]idnin\fR
.RS 4
Process [do not process] IDN domain names on input\&. This requires IDN SUPPORT to have been enabled at compile time\&. The default is to process IDN input\&.
.RE
.PP
\fB+[no]idnout\fR \fB+[no]idnout\fR
.RS 4 .RS 4
Convert [do not convert] puny code on output\&. This requires IDN SUPPORT to have been enabled at compile time\&. The default is to convert output\&. Convert [do not convert] puny code on output\&. This requires IDN SUPPORT to have been enabled at compile time\&. The default is to convert output\&.
@@ -532,7 +525,7 @@ Include an EDNS name server ID request when sending a query\&.
.RS 4 .RS 4
When this option is set, When this option is set,
\fBdig\fR \fBdig\fR
attempts to find the authoritative name servers for the zone containing the name being looked up and display the SOA record that each name server has for the zone\&. Addresses of servers that that did not respond are also printed\&. attempts to find the authoritative name servers for the zone containing the name being looked up and display the SOA record that each name server has for the zone\&.
.RE .RE
.PP .PP
\fB+[no]onesoa\fR \fB+[no]onesoa\fR
@@ -564,11 +557,6 @@ Print [do not print] the query as it is sent\&. By default, the query is not pri
Print [do not print] the question section of a query when an answer is returned\&. The default is to print the question section as a comment\&. Print [do not print] the question section of a query when an answer is returned\&. The default is to print the question section as a comment\&.
.RE .RE
.PP .PP
\fB+[no]raflag\fR
.RS 4
Set [do not set] the RA (Recursion Available) bit in the query\&. The default is +noraflag\&. This bit should be ignored by the server for QUERY\&.
.RE
.PP
\fB+[no]rdflag\fR \fB+[no]rdflag\fR
.RS 4 .RS 4
A synonym for A synonym for
@@ -658,11 +646,6 @@ for short, sends an EDNS CLIENT\-SUBNET option with an empty address and a sourc
be used when resolving this query\&. be used when resolving this query\&.
.RE .RE
.PP .PP
\fB+[no]tcflag\fR
.RS 4
Set [do not set] the TC (TrunCation) bit in the query\&. The default is +notcflag\&. This bit should be ignored by the server for QUERY\&.
.RE
.PP
\fB+[no]tcp\fR \fB+[no]tcp\fR
.RS 4 .RS 4
Use [do not use] TCP when querying name servers\&. The default behavior is to use UDP unless a type Use [do not use] TCP when querying name servers\&. The default behavior is to use UDP unless a type
@@ -792,10 +775,11 @@ If
\fBdig\fR \fBdig\fR
has been built with IDN (internationalized domain name) support, it can accept and display non\-ASCII domain names\&. has been built with IDN (internationalized domain name) support, it can accept and display non\-ASCII domain names\&.
\fBdig\fR \fBdig\fR
appropriately converts character encoding of domain name before sending a request to DNS server or displaying a reply from the server\&. If you\*(Aqd like to turn off the IDN support for some reason, use parameters appropriately converts character encoding of domain name before sending a request to DNS server or displaying a reply from the server\&. If you\*(Aqd like to turn off the IDN support for some reason, defines the
\fI+noidnin\fR \fBIDN_DISABLE\fR
and environment variable\&. The IDN support is disabled if the variable is set when
\fI+noidnout\fR\&. \fBdig\fR
runs\&.
.SH "FILES" .SH "FILES"
.PP .PP
/etc/resolv\&.conf /etc/resolv\&.conf
@@ -807,7 +791,7 @@ ${HOME}/\&.digrc
\fBhost\fR(1), \fBhost\fR(1),
\fBnamed\fR(8), \fBnamed\fR(8),
\fBdnssec-keygen\fR(8), \fBdnssec-keygen\fR(8),
RFC 1035\&. RFC1035\&.
.SH "BUGS" .SH "BUGS"
.PP .PP
There are probably too many query options\&. There are probably too many query options\&.
+82 -82
View File
@@ -205,7 +205,6 @@ help(void) {
" +padding=### (Set padding block size [0])\n" " +padding=### (Set padding block size [0])\n"
" +[no]qr (Print question before sending)\n" " +[no]qr (Print question before sending)\n"
" +[no]question (Control display of question section)\n" " +[no]question (Control display of question section)\n"
" +[no]raflag (Set RA flag in query (+[no]raflag))\n"
" +[no]rdflag (Recursive mode (+[no]recurse))\n" " +[no]rdflag (Recursive mode (+[no]recurse))\n"
" +[no]recurse (Recursive mode (+[no]rdflag))\n" " +[no]recurse (Recursive mode (+[no]rdflag))\n"
" +retry=### (Set number of UDP retries) [2]\n" " +retry=### (Set number of UDP retries) [2]\n"
@@ -218,7 +217,6 @@ help(void) {
" +[no]split=## (Split hex/base64 fields into chunks)\n" " +[no]split=## (Split hex/base64 fields into chunks)\n"
" +[no]stats (Control display of statistics)\n" " +[no]stats (Control display of statistics)\n"
" +subnet=addr (Set edns-client-subnet option)\n" " +subnet=addr (Set edns-client-subnet option)\n"
" +[no]tcflag (Set TC flag in query (+[no]tcflag))\n"
" +[no]tcp (TCP mode (+[no]vc))\n" " +[no]tcp (TCP mode (+[no]vc))\n"
" +timeout=### (Set query timeout) [5]\n" " +timeout=### (Set query timeout) [5]\n"
" +[no]trace (Trace delegation down from root [+dnssec])\n" " +[no]trace (Trace delegation down from root [+dnssec])\n"
@@ -287,12 +285,12 @@ received(unsigned int bytes, isc_sockaddr_t *from, dig_query_t *query) {
} else { } else {
printf(";; MSG SIZE rcvd: %u\n", bytes); printf(";; MSG SIZE rcvd: %u\n", bytes);
} }
if (tsigkey != NULL) { if (key != NULL) {
if (!validated) if (!validated)
puts(";; WARNING -- Some TSIG could not " puts(";; WARNING -- Some TSIG could not "
"be validated"); "be validated");
} }
if ((tsigkey == NULL) && (keysecret[0] != 0)) { if ((key == NULL) && (keysecret[0] != 0)) {
puts(";; WARNING -- TSIG key was not used."); puts(";; WARNING -- TSIG key was not used.");
} }
puts(""); puts("");
@@ -482,17 +480,17 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
} }
if (query->lookup->multiline || if (query->lookup->multiline ||
(query->lookup->nottl && query->lookup->noclass)) (query->lookup->nottl && query->lookup->noclass))
result = dns_master_stylecreate(&style, styleflags, result = dns_master_stylecreate2(&style, styleflags,
24, 24, 24, 32, 80, 8, 24, 24, 24, 32, 80, 8,
splitwidth, mctx); splitwidth, mctx);
else if (query->lookup->nottl || query->lookup->noclass) else if (query->lookup->nottl || query->lookup->noclass)
result = dns_master_stylecreate(&style, styleflags, result = dns_master_stylecreate2(&style, styleflags,
24, 24, 32, 40, 80, 8, 24, 24, 32, 40, 80, 8,
splitwidth, mctx); splitwidth, mctx);
else else
result = dns_master_stylecreate(&style, styleflags, result = dns_master_stylecreate2(&style, styleflags,
24, 32, 40, 48, 80, 8, 24, 32, 40, 48, 80, 8,
splitwidth, mctx); splitwidth, mctx);
check_result(result, "dns_master_stylecreate"); check_result(result, "dns_master_stylecreate");
if (query->lookup->cmdline[0] != 0) { if (query->lookup->cmdline[0] != 0) {
@@ -731,27 +729,28 @@ printgreeting(int argc, char **argv, dig_lookup_t *lookup) {
*/ */
static void static void
plus_option(char *option, isc_boolean_t is_batchfile, plus_option(const char *option, isc_boolean_t is_batchfile,
dig_lookup_t *lookup) dig_lookup_t *lookup)
{ {
isc_result_t result; isc_result_t result;
char *cmd, *value, *last = NULL, *code, *extra; char option_store[256];
char *cmd, *value, *ptr, *code;
isc_uint32_t num; isc_uint32_t num;
isc_boolean_t state = ISC_TRUE; isc_boolean_t state = ISC_TRUE;
size_t n; size_t n;
INSIST(option != NULL); strlcpy(option_store, option, sizeof(option_store));
ptr = option_store;
if ((cmd = strtok_r(option, "=", &last)) == NULL) { cmd = next_token(&ptr, "=");
printf(";; Invalid option %s\n", option); if (cmd == NULL) {
printf(";; Invalid option %s\n", option_store);
return; return;
} }
value = ptr;
if (strncasecmp(cmd, "no", 2)==0) { if (strncasecmp(cmd, "no", 2)==0) {
cmd += 2; cmd += 2;
state = ISC_FALSE; state = ISC_FALSE;
} }
/* parse the rest of the string */
value = strtok_r(NULL, "", &last);
#define FULLCHECK(A) \ #define FULLCHECK(A) \
do { \ do { \
@@ -1007,9 +1006,8 @@ plus_option(char *option, isc_boolean_t is_batchfile,
"specified"); "specified");
goto exit_or_usage; goto exit_or_usage;
} }
code = strtok_r(value, ":", &last); code = next_token(&value, ":");
extra = strtok_r(NULL, "\0", &last); save_opt(lookup, code, value);
save_opt(lookup, code, extra);
break; break;
default: default:
goto invalid_option; goto invalid_option;
@@ -1053,7 +1051,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
FULLCHECK("idnin"); FULLCHECK("idnin");
#ifndef WITH_IDN_SUPPORT #ifndef WITH_IDN_SUPPORT
fprintf(stderr, ";; IDN input support" fprintf(stderr, ";; IDN input support"
" not enabled\n"); " not enabled\n");
#else #else
lookup->idnin = state; lookup->idnin = state;
#endif #endif
@@ -1062,7 +1060,7 @@ plus_option(char *option, isc_boolean_t is_batchfile,
FULLCHECK("idnout"); FULLCHECK("idnout");
#ifndef WITH_IDN_OUT_SUPPORT #ifndef WITH_IDN_OUT_SUPPORT
fprintf(stderr, ";; IDN output support" fprintf(stderr, ";; IDN output support"
" not enabled\n"); " not enabled\n");
#else #else
lookup->idnout = state; lookup->idnout = state;
#endif #endif
@@ -1244,10 +1242,6 @@ plus_option(char *option, isc_boolean_t is_batchfile,
break; break;
case 'r': case 'r':
switch (cmd[1]) { switch (cmd[1]) {
case 'a': /* raflag */
FULLCHECK("raflag");
lookup->raflag = state;
break;
case 'd': /* rdflag */ case 'd': /* rdflag */
FULLCHECK("rdflag"); FULLCHECK("rdflag");
lookup->recurse = state; lookup->recurse = state;
@@ -1391,20 +1385,10 @@ plus_option(char *option, isc_boolean_t is_batchfile,
case 't': case 't':
switch (cmd[1]) { switch (cmd[1]) {
case 'c': /* tcp */ case 'c': /* tcp */
switch (cmd[2]) { FULLCHECK("tcp");
case 'f': if (!is_batchfile) {
FULLCHECK("tcflag"); lookup->tcp_mode = state;
lookup->tcflag = state; lookup->tcp_mode_set = ISC_TRUE;
break;
case 'p':
FULLCHECK("tcp");
if (!is_batchfile) {
lookup->tcp_mode = state;
lookup->tcp_mode_set = ISC_TRUE;
}
break;
default:
goto invalid_option;
} }
break; break;
case 'i': /* timeout */ case 'i': /* timeout */
@@ -1540,7 +1524,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
isc_boolean_t config_only, int argc, char **argv, isc_boolean_t config_only, int argc, char **argv,
isc_boolean_t *firstarg) isc_boolean_t *firstarg)
{ {
char opt, *value, *ptr, *ptr2, *ptr3, *last; char opt, *value, *ptr, *ptr2, *ptr3;
isc_result_t result; isc_result_t result;
isc_boolean_t value_from_next; isc_boolean_t value_from_next;
isc_textregion_t tr; isc_textregion_t tr;
@@ -1754,13 +1738,15 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
value); value);
return (value_from_next); return (value_from_next);
case 'y': case 'y':
if ((ptr = strtok_r(value, ":", &last)) == NULL) { ptr = next_token(&value, ":"); /* hmac type or name */
if (ptr == NULL) {
usage(); usage();
} }
if ((ptr2 = strtok_r(NULL, ":", &last)) == NULL) { /* name or secret */ ptr2 = next_token(&value, ":"); /* name or secret */
if (ptr2 == NULL)
usage(); usage();
} ptr3 = next_token(&value, ":"); /* secret or NULL */
if ((ptr3 = strtok_r(NULL, ":", &last)) != NULL) { /* secret or NULL */ if (ptr3 != NULL) {
parse_hmac(ptr); parse_hmac(ptr);
ptr = ptr2; ptr = ptr2;
ptr2 = ptr3; ptr2 = ptr3;
@@ -1772,7 +1758,6 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
#endif #endif
digestbits = 0; digestbits = 0;
} }
/* XXXONDREJ: FIXME */
strlcpy(keynametext, ptr, sizeof(keynametext)); strlcpy(keynametext, ptr, sizeof(keynametext));
strlcpy(keysecret, ptr2, sizeof(keysecret)); strlcpy(keysecret, ptr2, sizeof(keysecret));
return (value_from_next); return (value_from_next);
@@ -1856,22 +1841,6 @@ preparse_args(int argc, char **argv) {
} }
} }
static int
split_batchline(char *batchline, char **bargv, int len, const char *msg) {
int bargc;
char *last = NULL;
REQUIRE(batchline != NULL);
for (bargc = 1, bargv[bargc] = strtok_r(batchline, " \t\r\n", &last);
bargc < len && bargv[bargc];
bargv[++bargc] = strtok_r(NULL, " \t\r\n", &last))
{
debug("%s %d: %s", msg, bargc, bargv[bargc]);
}
return (bargc);
}
static void static void
parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
int argc, char **argv) int argc, char **argv)
@@ -1890,8 +1859,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
char **rv; char **rv;
#ifndef NOPOSIX #ifndef NOPOSIX
char *homedir; char *homedir;
char rcfile[PATH_MAX]; char rcfile[256];
#endif #endif
char *input;
int i;
isc_boolean_t need_clone = ISC_TRUE; isc_boolean_t need_clone = ISC_TRUE;
/* /*
@@ -1923,21 +1894,30 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
unsigned int n; unsigned int n;
n = snprintf(rcfile, sizeof(rcfile), "%s/.digrc", n = snprintf(rcfile, sizeof(rcfile), "%s/.digrc",
homedir); homedir);
if (n < sizeof(rcfile)) { if (n < sizeof(rcfile))
batchfp = fopen(rcfile, "r"); batchfp = fopen(rcfile, "r");
}
} }
if (batchfp != NULL) { if (batchfp != NULL) {
while (fgets(batchline, sizeof(batchline), while (fgets(batchline, sizeof(batchline),
batchfp) != 0) batchfp) != 0) {
{
debug("config line %s", batchline); debug("config line %s", batchline);
bargc = split_batchline(batchline, bargv, 62, bargc = 1;
".digrc argv"); input = batchline;
bargv[bargc] = next_token(&input, " \t\r\n");
while ((bargc < 62) && (bargv[bargc] != NULL)) {
bargc++;
bargv[bargc] =
next_token(&input, " \t\r\n");
}
bargv[0] = argv[0]; bargv[0] = argv[0];
argv0 = argv[0]; argv0 = argv[0];
parse_args(ISC_TRUE, ISC_TRUE,
bargc, (char **)bargv); for(i = 0; i < bargc; i++)
debug(".digrc argv %d: %s",
i, bargv[i]);
parse_args(ISC_TRUE, ISC_TRUE, bargc,
(char **)bargv);
} }
fclose(batchfp); fclose(batchfp);
} }
@@ -1948,9 +1928,8 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
/* Processing '-f batchfile'. */ /* Processing '-f batchfile'. */
lookup = clone_lookup(default_lookup, ISC_TRUE); lookup = clone_lookup(default_lookup, ISC_TRUE);
need_clone = ISC_FALSE; need_clone = ISC_FALSE;
} else { } else
lookup = default_lookup; lookup = default_lookup;
}
rc = argc; rc = argc;
rv = argv; rv = argv;
@@ -2117,14 +2096,23 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
/* XXX Remove code dup from shutdown code */ /* XXX Remove code dup from shutdown code */
next_line: next_line:
if (fgets(batchline, sizeof(batchline), batchfp) != 0) { if (fgets(batchline, sizeof(batchline), batchfp) != 0) {
bargc = 1;
debug("batch line %s", batchline); debug("batch line %s", batchline);
if (batchline[0] == '\r' || batchline[0] == '\n' || if (batchline[0] == '\r' || batchline[0] == '\n'
batchline[0] == '#' || batchline[0] == ';') || batchline[0] == '#' || batchline[0] == ';')
goto next_line; goto next_line;
bargc = split_batchline(batchline, bargv, 14, input = batchline;
"batch argv"); bargv[bargc] = next_token(&input, " \t\r\n");
while ((bargc < 14) && (bargv[bargc] != NULL)) {
bargc++;
bargv[bargc] = next_token(&input, " \t\r\n");
}
bargv[0] = argv[0]; bargv[0] = argv[0];
argv0 = argv[0]; argv0 = argv[0];
for(i = 0; i < bargc; i++)
debug("batch argv %d: %s", i, bargv[i]);
parse_args(ISC_TRUE, ISC_FALSE, bargc, (char **)bargv); parse_args(ISC_TRUE, ISC_FALSE, bargc, (char **)bargv);
return; return;
} }
@@ -2163,6 +2151,8 @@ query_finished(void) {
char batchline[MXNAME]; char batchline[MXNAME];
int bargc; int bargc;
char *bargv[16]; char *bargv[16];
char *input;
int i;
if (batchname == NULL) { if (batchname == NULL) {
isc_app_shutdown(); isc_app_shutdown();
@@ -2180,8 +2170,18 @@ query_finished(void) {
if (fgets(batchline, sizeof(batchline), batchfp) != 0) { if (fgets(batchline, sizeof(batchline), batchfp) != 0) {
debug("batch line %s", batchline); debug("batch line %s", batchline);
bargc = split_batchline(batchline, bargv, 14, "batch argv"); bargc = 1;
input = batchline;
bargv[bargc] = next_token(&input, " \t\r\n");
while ((bargc < 14) && (bargv[bargc] != NULL)) {
bargc++;
bargv[bargc] = next_token(&input, " \t\r\n");
}
bargv[0] = argv0; bargv[0] = argv0;
for(i = 0; i < bargc; i++)
debug("batch argv %d: %s", i, bargv[i]);
parse_args(ISC_TRUE, ISC_FALSE, bargc, (char **)bargv); parse_args(ISC_TRUE, ISC_FALSE, bargc, (char **)bargv);
start_lookup(); start_lookup();
} else { } else {
+15 -44
View File
@@ -275,9 +275,9 @@
<term>-i</term> <term>-i</term>
<listitem> <listitem>
<para> <para>
Do reverse IPv6 lookups using the obsolete RFC 1886 IP6.INT Do reverse IPv6 lookups using the obsolete RFC1886 IP6.INT
domain, which is no longer in use. Obsolete bit string domain, which is no longer in use. Obsolete bit string
label queries (RFC 2874) are not attempted. label queries (RFC2874) are not attempted.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -338,12 +338,11 @@
<term>-t <replaceable class="parameter">type</replaceable></term> <term>-t <replaceable class="parameter">type</replaceable></term>
<listitem> <listitem>
<para> <para>
The resource record type to query. It can be any valid query The resource record type to query. It can be any valid query type
type. If it is a resource record type supported in BIND 9, it which is
can be given by the type mnemonic (such as "NS" or "AAAA"). supported in BIND 9. The default query type is "A", unless the
The default query type is "A", unless the <option>-x</option> <option>-x</option> option is supplied to indicate a reverse lookup.
option is supplied to indicate a reverse lookup. A zone A zone transfer can be requested by specifying a type of AXFR. When
transfer can be requested by specifying a type of AXFR. When
an incremental zone transfer (IXFR) is required, set the an incremental zone transfer (IXFR) is required, set the
<parameter>type</parameter> to <literal>ixfr=N</literal>. <parameter>type</parameter> to <literal>ixfr=N</literal>.
The incremental zone transfer will contain the changes The incremental zone transfer will contain the changes
@@ -351,12 +350,6 @@
record was record was
<parameter>N</parameter>. <parameter>N</parameter>.
</para> </para>
<para>
All resource record types can be expressed as "TYPEnn", where
"nn" is the number of the type. If the resource record type is
not supported in BIND 9, the result will be displayed as
described in RFC 3597.
</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -960,17 +953,6 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><option>+[no]raflag</option></term>
<listitem>
<para>
Set [do not set] the RA (Recursion Available) bit in
the query. The default is +noraflag. This bit should
be ignored by the server for QUERY.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>+[no]rdflag</option></term> <term><option>+[no]rdflag</option></term>
<listitem> <listitem>
@@ -1062,7 +1044,7 @@
<listitem> <listitem>
<para> <para>
This feature is now obsolete and has been removed; This feature is now obsolete and has been removed;
use <command>delv</command> instead. use <command>delv</command> instead.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -1114,17 +1096,6 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><option>+[no]tcflag</option></term>
<listitem>
<para>
Set [do not set] the TC (TrunCation) bit in the query.
The default is +notcflag. This bit should be ignored
by the server for QUERY.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><option>+[no]tcp</option></term> <term><option>+[no]tcp</option></term>
<listitem> <listitem>
@@ -1158,8 +1129,8 @@
<listitem> <listitem>
<para> <para>
This feature is related to <command>dig +sigchase</command>, This feature is related to <command>dig +sigchase</command>,
which is obsolete and has been removed. Use which is obsolete and has been removed. Use
<command>delv</command> instead. <command>delv</command> instead.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -1204,9 +1175,9 @@
<listitem> <listitem>
<para> <para>
Formerly specified trusted keys for use with Formerly specified trusted keys for use with
<command>dig +sigchase</command>. This feature is now <command>dig +sigchase</command>. This feature is now
obsolete and has been removed; use obsolete and has been removed; use
<command>delv</command> instead. <command>delv</command> instead.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@@ -1328,7 +1299,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
<command>dig</command> appropriately converts character encoding of <command>dig</command> appropriately converts character encoding of
domain name before sending a request to DNS server or displaying a domain name before sending a request to DNS server or displaying a
reply from the server. reply from the server.
If you'd like to turn off the IDN support for some reason, use If you'd like to turn off the IDN support for some reason, use
parameters <parameter>+noidnin</parameter> and parameters <parameter>+noidnin</parameter> and
<parameter>+noidnout</parameter>. <parameter>+noidnout</parameter>.
</para> </para>
@@ -1356,7 +1327,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
<citerefentry> <citerefentry>
<refentrytitle>dnssec-keygen</refentrytitle><manvolnum>8</manvolnum> <refentrytitle>dnssec-keygen</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>, </citerefentry>,
<citetitle>RFC 1035</citetitle>. <citetitle>RFC1035</citetitle>.
</para> </para>
</refsection> </refsection>
+19 -50
View File
@@ -230,9 +230,9 @@
<dt><span class="term">-i</span></dt> <dt><span class="term">-i</span></dt>
<dd> <dd>
<p> <p>
Do reverse IPv6 lookups using the obsolete RFC 1886 IP6.INT Do reverse IPv6 lookups using the obsolete RFC1886 IP6.INT
domain, which is no longer in use. Obsolete bit string domain, which is no longer in use. Obsolete bit string
label queries (RFC 2874) are not attempted. label queries (RFC2874) are not attempted.
</p> </p>
</dd> </dd>
<dt><span class="term">-k <em class="replaceable"><code>keyfile</code></em></span></dt> <dt><span class="term">-k <em class="replaceable"><code>keyfile</code></em></span></dt>
@@ -277,12 +277,11 @@
<dt><span class="term">-t <em class="replaceable"><code>type</code></em></span></dt> <dt><span class="term">-t <em class="replaceable"><code>type</code></em></span></dt>
<dd> <dd>
<p> <p>
The resource record type to query. It can be any valid query The resource record type to query. It can be any valid query type
type. If it is a resource record type supported in BIND 9, it which is
can be given by the type mnemonic (such as "NS" or "AAAA"). supported in BIND 9. The default query type is "A", unless the
The default query type is "A", unless the <code class="option">-x</code> <code class="option">-x</code> option is supplied to indicate a reverse lookup.
option is supplied to indicate a reverse lookup. A zone A zone transfer can be requested by specifying a type of AXFR. When
transfer can be requested by specifying a type of AXFR. When
an incremental zone transfer (IXFR) is required, set the an incremental zone transfer (IXFR) is required, set the
<em class="parameter"><code>type</code></em> to <code class="literal">ixfr=N</code>. <em class="parameter"><code>type</code></em> to <code class="literal">ixfr=N</code>.
The incremental zone transfer will contain the changes The incremental zone transfer will contain the changes
@@ -290,12 +289,6 @@
record was record was
<em class="parameter"><code>N</code></em>. <em class="parameter"><code>N</code></em>.
</p> </p>
<p>
All resource record types can be expressed as "TYPEnn", where
"nn" is the number of the type. If the resource record type is
not supported in BIND 9, the result will be displayed as
described in RFC 3597.
</p>
</dd> </dd>
<dt><span class="term">-u</span></dt> <dt><span class="term">-u</span></dt>
<dd> <dd>
@@ -626,14 +619,6 @@
server that provided the answer. server that provided the answer.
</p> </p>
</dd> </dd>
<dt><span class="term"><code class="option">+[no]idnin</code></span></dt>
<dd>
<p>
Process [do not process] IDN domain names on input.
This requires IDN SUPPORT to have been enabled at
compile time. The default is to process IDN input.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]idnout</code></span></dt> <dt><span class="term"><code class="option">+[no]idnout</code></span></dt>
<dd> <dd>
<p> <p>
@@ -710,8 +695,7 @@
attempts to find the authoritative name servers for attempts to find the authoritative name servers for
the zone containing the name being looked up and the zone containing the name being looked up and
display the SOA record that each name server has for display the SOA record that each name server has for
the zone. Addresses of servers that that did not the zone.
respond are also printed.
</p> </p>
</dd> </dd>
<dt><span class="term"><code class="option">+[no]onesoa</code></span></dt> <dt><span class="term"><code class="option">+[no]onesoa</code></span></dt>
@@ -758,14 +742,6 @@
the question section as a comment. the question section as a comment.
</p> </p>
</dd> </dd>
<dt><span class="term"><code class="option">+[no]raflag</code></span></dt>
<dd>
<p>
Set [do not set] the RA (Recursion Available) bit in
the query. The default is +noraflag. This bit should
be ignored by the server for QUERY.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]rdflag</code></span></dt> <dt><span class="term"><code class="option">+[no]rdflag</code></span></dt>
<dd> <dd>
<p> <p>
@@ -835,7 +811,7 @@
<dd> <dd>
<p> <p>
This feature is now obsolete and has been removed; This feature is now obsolete and has been removed;
use <span class="command"><strong>delv</strong></span> instead. use <span class="command"><strong>delv</strong></span> instead.
</p> </p>
</dd> </dd>
<dt><span class="term"><code class="option">+split=W</code></span></dt> <dt><span class="term"><code class="option">+split=W</code></span></dt>
@@ -876,14 +852,6 @@
this query. this query.
</p> </p>
</dd> </dd>
<dt><span class="term"><code class="option">+[no]tcflag</code></span></dt>
<dd>
<p>
Set [do not set] the TC (TrunCation) bit in the query.
The default is +notcflag. This bit should be ignored
by the server for QUERY.
</p>
</dd>
<dt><span class="term"><code class="option">+[no]tcp</code></span></dt> <dt><span class="term"><code class="option">+[no]tcp</code></span></dt>
<dd> <dd>
<p> <p>
@@ -910,8 +878,8 @@
<dd> <dd>
<p> <p>
This feature is related to <span class="command"><strong>dig +sigchase</strong></span>, This feature is related to <span class="command"><strong>dig +sigchase</strong></span>,
which is obsolete and has been removed. Use which is obsolete and has been removed. Use
<span class="command"><strong>delv</strong></span> instead. <span class="command"><strong>delv</strong></span> instead.
</p> </p>
</dd> </dd>
<dt><span class="term"><code class="option">+[no]trace</code></span></dt> <dt><span class="term"><code class="option">+[no]trace</code></span></dt>
@@ -947,9 +915,9 @@
<dd> <dd>
<p> <p>
Formerly specified trusted keys for use with Formerly specified trusted keys for use with
<span class="command"><strong>dig +sigchase</strong></span>. This feature is now <span class="command"><strong>dig +sigchase</strong></span>. This feature is now
obsolete and has been removed; use obsolete and has been removed; use
<span class="command"><strong>delv</strong></span> instead. <span class="command"><strong>delv</strong></span> instead.
</p> </p>
</dd> </dd>
<dt><span class="term"><code class="option">+[no]ttlid</code></span></dt> <dt><span class="term"><code class="option">+[no]ttlid</code></span></dt>
@@ -1059,9 +1027,10 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
<span class="command"><strong>dig</strong></span> appropriately converts character encoding of <span class="command"><strong>dig</strong></span> appropriately converts character encoding of
domain name before sending a request to DNS server or displaying a domain name before sending a request to DNS server or displaying a
reply from the server. reply from the server.
If you'd like to turn off the IDN support for some reason, use If you'd like to turn off the IDN support for some reason, defines
parameters <em class="parameter"><code>+noidnin</code></em> and the <code class="envar">IDN_DISABLE</code> environment variable.
<em class="parameter"><code>+noidnout</code></em>. The IDN support is disabled if the variable is set when
<span class="command"><strong>dig</strong></span> runs.
</p> </p>
</div> </div>
@@ -1089,7 +1058,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
<span class="citerefentry"> <span class="citerefentry">
<span class="refentrytitle">dnssec-keygen</span>(8) <span class="refentrytitle">dnssec-keygen</span>(8)
</span>, </span>,
<em class="citetitle">RFC 1035</em>. <em class="citetitle">RFC1035</em>.
</p> </p>
</div> </div>
+68 -67
View File
@@ -57,6 +57,7 @@
#include <isc/app.h> #include <isc/app.h>
#include <isc/base64.h> #include <isc/base64.h>
#include <isc/entropy.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/hex.h> #include <isc/hex.h>
#include <isc/lang.h> #include <isc/lang.h>
@@ -86,7 +87,7 @@
#include <dig/dig.h> #include <dig/dig.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -175,8 +176,9 @@ unsigned char cookie[8];
const dns_name_t *hmacname = NULL; const dns_name_t *hmacname = NULL;
unsigned int digestbits = 0; unsigned int digestbits = 0;
isc_buffer_t *namebuf = NULL; isc_buffer_t *namebuf = NULL;
dns_tsigkey_t *tsigkey = NULL; dns_tsigkey_t *key = NULL;
isc_boolean_t validated = ISC_TRUE; isc_boolean_t validated = ISC_TRUE;
isc_entropy_t *entp = NULL;
isc_mempool_t *commctx = NULL; isc_mempool_t *commctx = NULL;
isc_boolean_t debugging = ISC_FALSE; isc_boolean_t debugging = ISC_FALSE;
isc_boolean_t debugtiming = ISC_FALSE; isc_boolean_t debugtiming = ISC_FALSE;
@@ -240,6 +242,18 @@ check_next_lookup(dig_lookup_t *lookup);
static isc_boolean_t static isc_boolean_t
next_origin(dig_lookup_t *oldlookup); next_origin(dig_lookup_t *oldlookup);
char *
next_token(char **stringp, const char *delim) {
char *res;
do {
res = strsep(stringp, delim);
if (res == NULL)
break;
} while (*res == '\0');
return (res);
}
static int static int
count_dots(char *string) { count_dots(char *string) {
char *s; char *s;
@@ -339,8 +353,9 @@ get_reverse(char *reverse, size_t len, char *value, isc_boolean_t ip6_int,
if (ip6_int) if (ip6_int)
options |= DNS_BYADDROPT_IPV6INT; options |= DNS_BYADDROPT_IPV6INT;
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
result = dns_byaddr_createptrname(&addr, options, name); name = dns_fixedname_name(&fname);
result = dns_byaddr_createptrname2(&addr, options, name);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
dns_name_format(name, reverse, (unsigned int)len); dns_name_format(name, reverse, (unsigned int)len);
@@ -653,8 +668,6 @@ make_empty_lookup(void) {
looknew->aaonly = ISC_FALSE; looknew->aaonly = ISC_FALSE;
looknew->adflag = ISC_FALSE; looknew->adflag = ISC_FALSE;
looknew->cdflag = ISC_FALSE; looknew->cdflag = ISC_FALSE;
looknew->raflag = ISC_FALSE;
looknew->tcflag = ISC_FALSE;
looknew->print_unknown_format = ISC_FALSE; looknew->print_unknown_format = ISC_FALSE;
looknew->zflag = ISC_FALSE; looknew->zflag = ISC_FALSE;
looknew->ns_search_only = ISC_FALSE; looknew->ns_search_only = ISC_FALSE;
@@ -797,8 +810,6 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
looknew->aaonly = lookold->aaonly; looknew->aaonly = lookold->aaonly;
looknew->adflag = lookold->adflag; looknew->adflag = lookold->adflag;
looknew->cdflag = lookold->cdflag; looknew->cdflag = lookold->cdflag;
looknew->raflag = lookold->raflag;
looknew->tcflag = lookold->tcflag;
looknew->print_unknown_format = lookold->print_unknown_format; looknew->print_unknown_format = lookold->print_unknown_format;
looknew->zflag = lookold->zflag; looknew->zflag = lookold->zflag;
looknew->ns_search_only = lookold->ns_search_only; looknew->ns_search_only = lookold->ns_search_only;
@@ -903,13 +914,13 @@ setup_text_key(void) {
result = dns_tsigkey_create(&keyname, hmacname, secretstore, result = dns_tsigkey_create(&keyname, hmacname, secretstore,
(int)secretsize, ISC_FALSE, NULL, 0, 0, (int)secretsize, ISC_FALSE, NULL, 0, 0,
mctx, NULL, &tsigkey); mctx, NULL, &key);
failure: failure:
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
printf(";; Couldn't create key %s: %s\n", printf(";; Couldn't create key %s: %s\n",
keynametext, isc_result_totext(result)); keynametext, isc_result_totext(result));
else else
dst_key_setbits(tsigkey->key, digestbits); dst_key_setbits(key->key, digestbits);
isc_mem_free(mctx, secretstore); isc_mem_free(mctx, secretstore);
dns_name_invalidate(&keyname); dns_name_invalidate(&keyname);
@@ -1196,7 +1207,7 @@ setup_file_key(void) {
} }
result = dns_tsigkey_createfromkey(dst_key_name(dstkey), hmacname, result = dns_tsigkey_createfromkey(dst_key_name(dstkey), hmacname,
dstkey, ISC_FALSE, NULL, 0, 0, dstkey, ISC_FALSE, NULL, 0, 0,
mctx, NULL, &tsigkey); mctx, NULL, &key);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
printf(";; Couldn't create key %s: %s\n", printf(";; Couldn't create key %s: %s\n",
keynametext, isc_result_totext(result)); keynametext, isc_result_totext(result));
@@ -1314,8 +1325,10 @@ setup_system(isc_boolean_t ipv4only, isc_boolean_t ipv6only) {
setup_file_key(); setup_file_key();
else if (keysecret[0] != 0) else if (keysecret[0] != 0)
setup_text_key(); setup_text_key();
result = isc_entropy_getdata(entp, cookie_secret,
isc_random_buf(cookie_secret, sizeof(cookie_secret)); sizeof(cookie_secret), NULL, 0);
if (result != ISC_R_SUCCESS)
fatal("unable to generate cookie secret");
} }
/*% /*%
@@ -1340,7 +1353,7 @@ setup_libs(void) {
debug("setup_libs()"); debug("setup_libs()");
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
dns_result_register(); dns_result_register();
@@ -1384,7 +1397,10 @@ setup_libs(void) {
result = isc_socketmgr_create(mctx, &socketmgr); result = isc_socketmgr_create(mctx, &socketmgr);
check_result(result, "isc_socketmgr_create"); check_result(result, "isc_socketmgr_create");
result = dst_lib_init(mctx, NULL); result = isc_entropy_create(mctx, &entp);
check_result(result, "isc_entropy_create");
result = dst_lib_init(mctx, entp, 0);
check_result(result, "dst_lib_init"); check_result(result, "dst_lib_init");
is_dst_up = ISC_TRUE; is_dst_up = ISC_TRUE;
@@ -1870,7 +1886,7 @@ followup_lookup(dns_message_t *msg, dig_query_t *query, dns_section_t section)
srv != NULL; srv != NULL;
srv = ISC_LIST_HEAD(lookup->my_server_list)) { srv = ISC_LIST_HEAD(lookup->my_server_list)) {
INSIST(i > 0); INSIST(i > 0);
j = isc_random(); isc_random_get(&j);
j %= i; j %= i;
next = ISC_LIST_NEXT(srv, link); next = ISC_LIST_NEXT(srv, link);
while (j-- > 0 && next != NULL) { while (j-- > 0 && next != NULL) {
@@ -1917,7 +1933,8 @@ next_origin(dig_lookup_t *oldlookup) {
/* /*
* Check for a absolute name or ndots being met. * Check for a absolute name or ndots being met.
*/ */
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
result = dns_name_fromstring2(name, oldlookup->textname, NULL, result = dns_name_fromstring2(name, oldlookup->textname, NULL,
0, NULL); 0, NULL);
if (result == ISC_R_SUCCESS && if (result == ISC_R_SUCCESS &&
@@ -2079,7 +2096,8 @@ setup_lookup(dig_lookup_t *lookup) {
textname = lookup->textname; textname = lookup->textname;
#ifdef WITH_IDN_SUPPORT #ifdef WITH_IDN_SUPPORT
if (lookup->idnin) { if (lookup->idnin) {
result = idn_locale_to_ace(textname, idn_textname, sizeof(idn_textname)); result = idn_locale_to_ace(lookup->textname, idn_textname,
sizeof(idn_textname));
check_result(result, "convert textname to IDN encoding"); check_result(result, "convert textname to IDN encoding");
debug("idn_textname: %s", idn_textname); debug("idn_textname: %s", idn_textname);
textname = idn_textname; textname = idn_textname;
@@ -2115,7 +2133,8 @@ setup_lookup(dig_lookup_t *lookup) {
origin = lookup->origin->origin; origin = lookup->origin->origin;
#ifdef WITH_IDN_SUPPORT #ifdef WITH_IDN_SUPPORT
if (lookup->idnin) { if (lookup->idnin) {
result = idn_locale_to_ace(origin, idn_origin, sizeof(idn_origin)); result = idn_locale_to_ace(lookup->origin->origin,
idn_origin, sizeof(idn_origin));
check_result(result, "convert origin to IDN encoding"); check_result(result, "convert origin to IDN encoding");
debug("trying idn origin %s", idn_origin); debug("trying idn origin %s", idn_origin);
origin = idn_origin; origin = idn_origin;
@@ -2141,7 +2160,8 @@ setup_lookup(dig_lookup_t *lookup) {
dns_fixedname_t fixed; dns_fixedname_t fixed;
dns_name_t *name; dns_name_t *name;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
len = (unsigned int) strlen(textname); len = (unsigned int) strlen(textname);
isc_buffer_init(&b, textname, len); isc_buffer_init(&b, textname, len);
isc_buffer_add(&b, len); isc_buffer_add(&b, len);
@@ -2198,7 +2218,7 @@ setup_lookup(dig_lookup_t *lookup) {
dighost_trying(store, lookup); dighost_trying(store, lookup);
INSIST(dns_name_isabsolute(lookup->name)); INSIST(dns_name_isabsolute(lookup->name));
id = isc_random(); isc_random_get(&id);
lookup->sendmsg->id = (unsigned short)id & 0xFFFF; lookup->sendmsg->id = (unsigned short)id & 0xFFFF;
lookup->sendmsg->opcode = lookup->opcode; lookup->sendmsg->opcode = lookup->opcode;
lookup->msgcounter = 0; lookup->msgcounter = 0;
@@ -2232,16 +2252,6 @@ setup_lookup(dig_lookup_t *lookup) {
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_CD; lookup->sendmsg->flags |= DNS_MESSAGEFLAG_CD;
} }
if (lookup->raflag) {
debug("RA query");
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_RA;
}
if (lookup->tcflag) {
debug("TC query");
lookup->sendmsg->flags |= DNS_MESSAGEFLAG_TC;
}
if (lookup->zflag) { if (lookup->zflag) {
debug("Z query"); debug("Z query");
lookup->sendmsg->flags |= 0x0040U; lookup->sendmsg->flags |= 0x0040U;
@@ -2279,9 +2289,9 @@ setup_lookup(dig_lookup_t *lookup) {
/* XXX Insist this? */ /* XXX Insist this? */
lookup->tsigctx = NULL; lookup->tsigctx = NULL;
lookup->querysig = NULL; lookup->querysig = NULL;
if (tsigkey != NULL) { if (key != NULL) {
debug("initializing keys"); debug("initializing keys");
result = dns_message_settsigkey(lookup->sendmsg, tsigkey); result = dns_message_settsigkey(lookup->sendmsg, key);
check_result(result, "dns_message_settsigkey"); check_result(result, "dns_message_settsigkey");
} }
@@ -3646,7 +3656,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &msg); result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &msg);
check_result(result, "dns_message_create"); check_result(result, "dns_message_create");
if (tsigkey != NULL) { if (key != NULL) {
if (l->querysig == NULL) { if (l->querysig == NULL) {
debug("getting initial querysig"); debug("getting initial querysig");
result = dns_message_getquerytsig(l->sendmsg, mctx, result = dns_message_getquerytsig(l->sendmsg, mctx,
@@ -3655,7 +3665,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
} }
result = dns_message_setquerytsig(msg, l->querysig); result = dns_message_setquerytsig(msg, l->querysig);
check_result(result, "dns_message_setquerytsig"); check_result(result, "dns_message_setquerytsig");
result = dns_message_settsigkey(msg, tsigkey); result = dns_message_settsigkey(msg, key);
check_result(result, "dns_message_settsigkey"); check_result(result, "dns_message_settsigkey");
msg->tsigctx = l->tsigctx; msg->tsigctx = l->tsigctx;
l->tsigctx = NULL; l->tsigctx = NULL;
@@ -3831,7 +3841,7 @@ recv_done(isc_task_t *task, isc_event_t *event) {
} }
} }
if (tsigkey != NULL) { if (key != NULL) {
result = dns_tsig_verify(&query->recvbuf, msg, NULL, NULL); result = dns_tsig_verify(&query->recvbuf, msg, NULL, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
printf(";; Couldn't verify signature: %s\n", printf(";; Couldn't verify signature: %s\n",
@@ -4198,9 +4208,9 @@ destroy_libs(void) {
debug("freeing timermgr"); debug("freeing timermgr");
isc_timermgr_destroy(&timermgr); isc_timermgr_destroy(&timermgr);
} }
if (tsigkey != NULL) { if (key != NULL) {
debug("freeing key %p", tsigkey); debug("freeing key %p", key);
dns_tsigkey_detach(&tsigkey); dns_tsigkey_detach(&key);
} }
if (namebuf != NULL) if (namebuf != NULL)
isc_buffer_free(&namebuf); isc_buffer_free(&namebuf);
@@ -4210,6 +4220,10 @@ destroy_libs(void) {
dst_lib_destroy(); dst_lib_destroy();
is_dst_up = ISC_FALSE; is_dst_up = ISC_FALSE;
} }
if (entp != NULL) {
debug("detach from entropy");
isc_entropy_detach(&entp);
}
UNLOCK_LOOKUP; UNLOCK_LOOKUP;
DESTROYLOCK(&lookup_lock); DESTROYLOCK(&lookup_lock);
@@ -4259,19 +4273,21 @@ output_filter(isc_buffer_t *buffer, unsigned int used_org,
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
strlcpy(tmp1, tmp2, MAXDLEN);
/* /*
* Copy the converted contents in 'tmp1' back to 'buffer'. * Copy the converted contents in 'tmp1' back to 'buffer'.
* If we have appended trailing dot, remove it. * If we have appended trailing dot, remove it.
*/ */
tolen = strlen(tmp2); tolen = strlen(tmp1);
if (absolute && !end_with_dot && tmp2[tolen - 1] == '.') if (absolute && !end_with_dot && tmp1[tolen - 1] == '.')
tolen--; tolen--;
if (isc_buffer_length(buffer) < used_org + tolen) if (isc_buffer_length(buffer) < used_org + tolen)
return (ISC_R_NOSPACE); return (ISC_R_NOSPACE);
isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org); isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org);
memmove(isc_buffer_used(buffer), tmp2, tolen); memmove(isc_buffer_used(buffer), tmp1, tolen);
isc_buffer_add(buffer, (unsigned int)tolen); isc_buffer_add(buffer, (unsigned int)tolen);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
@@ -4289,28 +4305,11 @@ idn_locale_to_ace(const char *from, char *to, size_t tolen) {
int res; int res;
char *tmp_str = NULL; char *tmp_str = NULL;
res = idn2_to_ascii_lz(from, &tmp_str, IDN2_NONTRANSITIONAL|IDN2_NFC_INPUT); res = idn2_lookup_ul(from, &tmp_str, IDN2_NONTRANSITIONAL);
if (res == IDN2_DISALLOWED) { if (res == IDN2_DISALLOWED)
res = idn2_to_ascii_lz(from, &tmp_str, IDN2_TRANSITIONAL|IDN2_NFC_INPUT); res = idn2_lookup_ul(from, &tmp_str, IDN2_TRANSITIONAL);
}
if (res == IDN2_OK) { if (res == IDN2_OK) {
/*
* idn2_to_ascii_lz() normalizes all strings to lowerl case,
* but we generally don't want to lowercase all input strings;
* make sure to return the original case if the two strings
* differ only in case
*/
if (!strcasecmp(from, tmp_str)) {
if (strlen(from) >= tolen) {
debug("from string is too long");
idn2_free(tmp_str);
return ISC_R_NOSPACE;
}
idn2_free(tmp_str);
(void) strlcpy(to, from, tolen);
return ISC_R_SUCCESS;
}
/* check the length */ /* check the length */
if (strlen(tmp_str) >= tolen) { if (strlen(tmp_str) >= tolen) {
debug("ACE string is too long"); debug("ACE string is too long");
@@ -4323,7 +4322,7 @@ idn_locale_to_ace(const char *from, char *to, size_t tolen) {
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
} }
fatal("'%s' is not a legal IDN name (%s), use +noidnin", from, idn2_strerror(res)); fatal("idn2_lookup_ul failed: %s", idn2_strerror(res));
return ISC_R_FAILURE; return ISC_R_FAILURE;
} }
@@ -4334,7 +4333,7 @@ idn_ace_to_locale(const char *from, char *to, size_t tolen) {
char *tmp_str = NULL; char *tmp_str = NULL;
res = idn2_to_unicode_8zlz(from, &tmp_str, res = idn2_to_unicode_8zlz(from, &tmp_str,
IDN2_NONTRANSITIONAL|IDN2_NFC_INPUT); IDN2_NONTRANSITIONAL|IDN2_NFC_INPUT);
if (res == IDN2_OK) { if (res == IDN2_OK) {
/* check the length */ /* check the length */
@@ -4344,12 +4343,14 @@ idn_ace_to_locale(const char *from, char *to, size_t tolen) {
return ISC_R_FAILURE; return ISC_R_FAILURE;
} }
(void) strlcpy(to, tmp_str, tolen); (void) strncpy(to, tmp_str, tolen);
idn2_free(tmp_str); free(tmp_str);
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
} else {
debug("idn2_to_unicode_8zlz failed: %s",
idn2_strerror(res));
} }
fatal("'%s' is not a legal IDN name (%s), use +noidnout", from, idn2_strerror(res));
return ISC_R_FAILURE; return ISC_R_FAILURE;
} }
#endif /* WITH_IDN_OUT_SUPPORT */ #endif /* WITH_IDN_OUT_SUPPORT */
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2000-2002, 2004, 2005, 2007-2009, 2014-2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000-2002, 2004, 2005, 2007-2009, 2014-2017 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -274,5 +274,5 @@ runs\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2000-2002, 2004, 2005, 2007-2009, 2014-2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2000-2002, 2004, 2005, 2007-2009, 2014-2017 Internet Systems Consortium, Inc. ("ISC")
.br .br
+2 -1
View File
@@ -452,7 +452,8 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
dns_name_t *name; dns_name_t *name;
/* Add AAAA and MX lookups. */ /* Add AAAA and MX lookups. */
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
dns_name_copy(query->lookup->name, name, NULL); dns_name_copy(query->lookup->name, name, NULL);
chase_cnamechain(msg, name); chase_cnamechain(msg, name);
dns_name_format(name, namestr, sizeof(namestr)); dns_name_format(name, namestr, sizeof(namestr));
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2000-2002, 2004, 2005, 2007-2009, 2014-2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000-2002, 2004, 2005, 2007-2009, 2014-2017 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+4 -3
View File
@@ -94,8 +94,6 @@ struct dig_lookup {
aaonly, aaonly,
adflag, adflag,
cdflag, cdflag,
raflag,
tcflag,
zflag, zflag,
trace, /*% dig +trace */ trace, /*% dig +trace */
trace_root, /*% initial query for either +trace or +nssearch */ trace_root, /*% initial query for either +trace or +nssearch */
@@ -259,7 +257,7 @@ extern char keyfile[MXNAME];
extern char keysecret[MXNAME]; extern char keysecret[MXNAME];
extern const dns_name_t *hmacname; extern const dns_name_t *hmacname;
extern unsigned int digestbits; extern unsigned int digestbits;
extern dns_tsigkey_t *tsigkey; extern dns_tsigkey_t *key;
extern isc_boolean_t validated; extern isc_boolean_t validated;
extern isc_taskmgr_t *taskmgr; extern isc_taskmgr_t *taskmgr;
extern isc_task_t *global_task; extern isc_task_t *global_task;
@@ -371,6 +369,9 @@ destroy_libs(void);
void void
set_search_domain(char *domain); set_search_domain(char *domain);
char *
next_token(char **stringp, const char *delim);
/* /*
* Routines to be defined in dig.c, host.c, and nslookup.c. and * Routines to be defined in dig.c, host.c, and nslookup.c. and
* then assigned to the appropriate function pointer * then assigned to the appropriate function pointer
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2004-2007, 2010, 2013-2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2004-2007, 2010, 2013-2017 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -290,5 +290,5 @@ returns with an exit status of 1 if any query failed, and 0 otherwise\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2004-2007, 2010, 2013-2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2004-2007, 2010, 2013-2017 Internet Systems Consortium, Inc. ("ISC")
.br .br
+17 -16
View File
@@ -475,7 +475,8 @@ printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) {
dns_name_t *name; dns_name_t *name;
/* Add AAAA lookup. */ /* Add AAAA lookup. */
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
dns_name_copy(query->lookup->name, name, NULL); dns_name_copy(query->lookup->name, name, NULL);
chase_cnamechain(msg, name); chase_cnamechain(msg, name);
dns_name_format(name, namestr, sizeof(namestr)); dns_name_format(name, namestr, sizeof(namestr));
@@ -709,31 +710,31 @@ setoption(char *opt) {
usesearch = ISC_TRUE; usesearch = ISC_TRUE;
} else if (CHECKOPT("nodefname", 5)) { } else if (CHECKOPT("nodefname", 5)) {
usesearch = ISC_FALSE; usesearch = ISC_FALSE;
} else if (CHECKOPT("vc", 2)) { } else if (CHECKOPT("vc", 2) == 0) {
tcpmode = ISC_TRUE; tcpmode = ISC_TRUE;
tcpmode_set = ISC_TRUE; tcpmode_set = ISC_TRUE;
} else if (CHECKOPT("novc", 4)) { } else if (CHECKOPT("novc", 4) == 0) {
tcpmode = ISC_FALSE; tcpmode = ISC_FALSE;
tcpmode_set = ISC_TRUE; tcpmode_set = ISC_TRUE;
} else if (CHECKOPT("debug", 3)) { } else if (CHECKOPT("debug", 3) == 0) {
short_form = ISC_FALSE; short_form = ISC_FALSE;
showsearch = ISC_TRUE; showsearch = ISC_TRUE;
} else if (CHECKOPT("nodebug", 5)) { } else if (CHECKOPT("nodebug", 5) == 0) {
short_form = ISC_TRUE; short_form = ISC_TRUE;
showsearch = ISC_FALSE; showsearch = ISC_FALSE;
} else if (CHECKOPT("d2", 2)) { } else if (CHECKOPT("d2", 2) == 0) {
debugging = ISC_TRUE; debugging = ISC_TRUE;
} else if (CHECKOPT("nod2", 4)) { } else if (CHECKOPT("nod2", 4) == 0) {
debugging = ISC_FALSE; debugging = ISC_FALSE;
} else if (CHECKOPT("search", 3)) { } else if (CHECKOPT("search", 3) == 0) {
usesearch = ISC_TRUE; usesearch = ISC_TRUE;
} else if (CHECKOPT("nosearch", 5)) { } else if (CHECKOPT("nosearch", 5) == 0) {
usesearch = ISC_FALSE; usesearch = ISC_FALSE;
} else if (CHECKOPT("sil", 3)) { } else if (CHECKOPT("sil", 3) == 0) {
/* deprecation_msg = ISC_FALSE; */ /* deprecation_msg = ISC_FALSE; */
} else if (CHECKOPT("fail", 3)) { } else if (CHECKOPT("fail", 3) == 0) {
nofail=ISC_FALSE; nofail=ISC_FALSE;
} else if (CHECKOPT("nofail", 5)) { } else if (CHECKOPT("nofail", 5) == 0) {
nofail=ISC_TRUE; nofail=ISC_TRUE;
} else if (strncasecmp(opt, "ndots=", 6) == 0) { } else if (strncasecmp(opt, "ndots=", 6) == 0) {
set_ndots(&opt[6]); set_ndots(&opt[6]);
@@ -813,12 +814,12 @@ addlookup(char *opt) {
static void static void
do_next_command(char *input) { do_next_command(char *input) {
char *ptr, *arg, *last; char *ptr, *arg;
if ((ptr = strtok_r(input, " \t\r\n", &last)) == NULL) { ptr = next_token(&input, " \t\r\n");
if (ptr == NULL)
return; return;
} arg = next_token(&input, " \t\r\n");
arg = strtok_r(NULL, " \t\r\n", &last);
if ((strcasecmp(ptr, "set") == 0) && if ((strcasecmp(ptr, "set") == 0) &&
(arg != NULL)) (arg != NULL))
setoption(arg); setoption(arg);
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2004-2007, 2010, 2013-2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2004-2007, 2010, 2013-2017 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+1 -1
View File
@@ -18,7 +18,7 @@ VERSION=@BIND9_VERSION@
CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@ CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@
CDEFINES = -DVERSION=\"${VERSION}\" @USE_PKCS11@ @PKCS11_ENGINE@ \ CDEFINES = -DVERSION=\"${VERSION}\" @USE_PKCS11@ @PKCS11_ENGINE@ \
-DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\" @CRYPTO@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\"
CWARNINGS = CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
+25 -14
View File
@@ -23,6 +23,7 @@
#include <isc/buffer.h> #include <isc/buffer.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/mem.h> #include <isc/mem.h>
@@ -53,7 +54,7 @@
#include <dst/dst.h> #include <dst/dst.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -71,6 +72,7 @@ int verbose;
*/ */
static isc_log_t *lctx = NULL; static isc_log_t *lctx = NULL;
static isc_mem_t *mctx = NULL; static isc_mem_t *mctx = NULL;
static isc_entropy_t *ectx = NULL;
/* /*
* The domain we are working on * The domain we are working on
@@ -171,7 +173,8 @@ initname(char *setname) {
isc_result_t result; isc_result_t result;
isc_buffer_t buf; isc_buffer_t buf;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
namestr = setname; namestr = setname;
isc_buffer_init(&buf, setname, strlen(setname)); isc_buffer_init(&buf, setname, strlen(setname));
@@ -251,8 +254,8 @@ load_db(const char *filename, dns_db_t **dbp, dns_dbnode_t **nodep) {
rdclass, 0, NULL, dbp); rdclass, 0, NULL, dbp);
check_result(result, "dns_db_create()"); check_result(result, "dns_db_create()");
result = dns_db_load(*dbp, filename, result = dns_db_load3(*dbp, filename,
dns_masterformat_text, DNS_MASTER_HINT); dns_masterformat_text, DNS_MASTER_HINT);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) { if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
fatal("can't load %s: %s", filename, fatal("can't load %s: %s", filename,
isc_result_totext(result)); isc_result_totext(result));
@@ -376,9 +379,9 @@ formatset(dns_rdataset_t *rdataset) {
* which just separates fields with spaces. The huge tab stop width * which just separates fields with spaces. The huge tab stop width
* eliminates any tab characters. * eliminates any tab characters.
*/ */
result = dns_master_stylecreate(&style, styleflags, result = dns_master_stylecreate2(&style, styleflags,
0, 0, 0, 0, 0, 1000000, 0, 0, 0, 0, 0, 0, 1000000, 0,
mctx); mctx);
check_result(result, "dns_master_stylecreate2 failed"); check_result(result, "dns_master_stylecreate2 failed");
result = isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE); result = isc_buffer_allocate(mctx, &buf, MAX_CDS_RDATA_TEXT_SIZE);
@@ -668,11 +671,8 @@ matching_sigs(keyinfo_t *keytbl, dns_rdataset_t *rdataset,
} }
result = dns_dnssec_verify(name, rdataset, ki->dst, result = dns_dnssec_verify(name, rdataset, ki->dst,
ISC_FALSE, 0, mctx, ISC_FALSE, mctx, &sigrdata);
&sigrdata, NULL); if (result != ISC_R_SUCCESS) {
if (result != ISC_R_SUCCESS &&
result != DNS_R_FROMWILDCARD) {
vbprintf(1, "skip RRSIG by key %d:" vbprintf(1, "skip RRSIG by key %d:"
" verification failed: %s\n", " verification failed: %s\n",
sig.keyid, isc_result_totext(result)); sig.keyid, isc_result_totext(result));
@@ -1147,7 +1147,7 @@ main(int argc, char *argv[]) {
fatal("out of memory"); fatal("out of memory");
} }
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
dns_result_register(); dns_result_register();
@@ -1231,11 +1231,20 @@ main(int argc, char *argv[]) {
setup_logging(mctx, &lctx); setup_logging(mctx, &lctx);
result = dst_lib_init(mctx, NULL); if (ectx == NULL) {
setup_entropy(mctx, NULL, &ectx);
}
result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
if (result != ISC_R_SUCCESS) {
fatal("could not initialize hash");
}
result = dst_lib_init(mctx, ectx,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fatal("could not initialize dst: %s", fatal("could not initialize dst: %s",
isc_result_totext(result)); isc_result_totext(result));
} }
isc_entropy_stopcallbacksources(ectx);
if (ds_path == NULL) { if (ds_path == NULL) {
fatal("missing -d DS pathname"); fatal("missing -d DS pathname");
@@ -1385,6 +1394,8 @@ main(int argc, char *argv[]) {
free_all_sets(); free_all_sets();
cleanup_logging(&lctx); cleanup_logging(&lctx);
dst_lib_destroy(); dst_lib_destroy();
isc_hash_destroy();
cleanup_entropy(&ectx);
if (verbose > 10) { if (verbose > 10) {
isc_mem_stats(mctx, stdout); isc_mem_stats(mctx, stdout);
} }
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2008-2012, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2008-2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -178,5 +178,5 @@ RFC 4509\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2008-2012, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2008-2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
.br .br
+19 -6
View File
@@ -17,6 +17,7 @@
#include <isc/buffer.h> #include <isc/buffer.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/print.h> #include <isc/print.h>
@@ -41,7 +42,7 @@
#include <dst/dst.h> #include <dst/dst.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -66,7 +67,8 @@ initname(char *setname) {
isc_result_t result; isc_result_t result;
isc_buffer_t buf; isc_buffer_t buf;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
isc_buffer_init(&buf, setname, strlen(setname)); isc_buffer_init(&buf, setname, strlen(setname));
isc_buffer_add(&buf, strlen(setname)); isc_buffer_add(&buf, strlen(setname));
@@ -112,7 +114,7 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
db_load_from_stream(db, stdin); db_load_from_stream(db, stdin);
filename = "input"; filename = "input";
} else { } else {
result = dns_db_load(db, filename, dns_masterformat_text, 0); result = dns_db_load(db, filename);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
fatal("can't load %s: %s", filename, fatal("can't load %s: %s", filename,
isc_result_totext(result)); isc_result_totext(result));
@@ -204,7 +206,8 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
rdclass = dst_key_class(key); rdclass = dst_key_class(key);
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
result = dns_name_copy(dst_key_name(key), name, NULL); result = dns_name_copy(dst_key_name(key), name, NULL);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("can't copy name"); fatal("can't copy name");
@@ -358,6 +361,7 @@ main(int argc, char **argv) {
isc_boolean_t showall = ISC_FALSE; isc_boolean_t showall = ISC_FALSE;
isc_result_t result; isc_result_t result;
isc_log_t *log = NULL; isc_log_t *log = NULL;
isc_entropy_t *ectx = NULL;
dns_rdataset_t rdataset; dns_rdataset_t rdataset;
dns_rdata_t rdata; dns_rdata_t rdata;
@@ -370,7 +374,7 @@ main(int argc, char **argv) {
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("out of memory"); fatal("out of memory");
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
dns_result_register(); dns_result_register();
@@ -473,10 +477,17 @@ main(int argc, char **argv) {
if (argc > isc_commandline_index + 1) if (argc > isc_commandline_index + 1)
fatal("extraneous arguments"); fatal("extraneous arguments");
result = dst_lib_init(mctx, NULL); if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
result = dst_lib_init(mctx, ectx,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("could not initialize dst: %s", fatal("could not initialize dst: %s",
isc_result_totext(result)); isc_result_totext(result));
result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
if (result != ISC_R_SUCCESS)
fatal("could not initialize hash");
isc_entropy_stopcallbacksources(ectx);
setup_logging(mctx, &log); setup_logging(mctx, &log);
@@ -537,7 +548,9 @@ main(int argc, char **argv) {
if (dns_rdataset_isassociated(&rdataset)) if (dns_rdataset_isassociated(&rdataset))
dns_rdataset_disassociate(&rdataset); dns_rdataset_disassociate(&rdataset);
cleanup_logging(&log); cleanup_logging(&log);
isc_hash_destroy();
dst_lib_destroy(); dst_lib_destroy();
cleanup_entropy(&ectx);
dns_name_destroy(); dns_name_destroy();
if (verbose > 10) if (verbose > 10)
isc_mem_stats(mctx, stdout); isc_mem_stats(mctx, stdout);
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2008-2012, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2008-2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2013-2016, 2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -134,5 +134,5 @@ RFC 5011\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2013-2016, 2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2013-2016 Internet Systems Consortium, Inc. ("ISC")
.br .br
+20 -7
View File
@@ -17,6 +17,7 @@
#include <isc/buffer.h> #include <isc/buffer.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/print.h> #include <isc/print.h>
@@ -41,7 +42,7 @@
#include <dst/dst.h> #include <dst/dst.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -71,7 +72,8 @@ initname(char *setname) {
isc_result_t result; isc_result_t result;
isc_buffer_t buf; isc_buffer_t buf;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
isc_buffer_init(&buf, setname, strlen(setname)); isc_buffer_init(&buf, setname, strlen(setname));
isc_buffer_add(&buf, strlen(setname)); isc_buffer_add(&buf, strlen(setname));
@@ -117,8 +119,8 @@ loadset(const char *filename, dns_rdataset_t *rdataset) {
db_load_from_stream(db, stdin); db_load_from_stream(db, stdin);
filename = "input"; filename = "input";
} else { } else {
result = dns_db_load(db, filename, dns_masterformat_text, result = dns_db_load3(db, filename, dns_masterformat_text,
DNS_MASTER_NOTTL); DNS_MASTER_NOTTL);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
fatal("can't load %s: %s", filename, fatal("can't load %s: %s", filename,
isc_result_totext(result)); isc_result_totext(result));
@@ -179,7 +181,8 @@ loadkey(char *filename, unsigned char *key_buf, unsigned int key_buf_size,
rdclass = dst_key_class(key); rdclass = dst_key_class(key);
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
result = dns_name_copy(dst_key_name(key), name, NULL); result = dns_name_copy(dst_key_name(key), name, NULL);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("can't copy name"); fatal("can't copy name");
@@ -296,6 +299,7 @@ main(int argc, char **argv) {
int ch; int ch;
isc_result_t result; isc_result_t result;
isc_log_t *log = NULL; isc_log_t *log = NULL;
isc_entropy_t *ectx = NULL;
dns_rdataset_t rdataset; dns_rdataset_t rdataset;
dns_rdata_t rdata; dns_rdata_t rdata;
isc_stdtime_t now; isc_stdtime_t now;
@@ -310,7 +314,7 @@ main(int argc, char **argv) {
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("out of memory"); fatal("out of memory");
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
dns_result_register(); dns_result_register();
@@ -402,10 +406,17 @@ main(int argc, char **argv) {
if (argc > isc_commandline_index + 1) if (argc > isc_commandline_index + 1)
fatal("extraneous arguments"); fatal("extraneous arguments");
result = dst_lib_init(mctx, NULL); if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
result = dst_lib_init(mctx, ectx,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("could not initialize dst: %s", fatal("could not initialize dst: %s",
isc_result_totext(result)); isc_result_totext(result));
result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
if (result != ISC_R_SUCCESS)
fatal("could not initialize hash");
isc_entropy_stopcallbacksources(ectx);
setup_logging(mctx, &log); setup_logging(mctx, &log);
@@ -448,7 +459,9 @@ main(int argc, char **argv) {
if (dns_rdataset_isassociated(&rdataset)) if (dns_rdataset_isassociated(&rdataset))
dns_rdataset_disassociate(&rdataset); dns_rdataset_disassociate(&rdataset);
cleanup_logging(&log); cleanup_logging(&log);
isc_hash_destroy();
dst_lib_destroy(); dst_lib_destroy();
cleanup_entropy(&ectx);
dns_name_destroy(); dns_name_destroy();
if (verbose > 10) if (verbose > 10)
isc_mem_stats(mctx, stdout); isc_mem_stats(mctx, stdout);
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2013-2016, 2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2008-2012, 2014-2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2008-2012, 2014-2017 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -307,5 +307,5 @@ The PKCS#11 URI Scheme (draft\-pechanec\-pkcs11uri\-13)\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2008-2012, 2014-2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2008-2012, 2014-2017 Internet Systems Consortium, Inc. ("ISC")
.br .br
+14 -6
View File
@@ -18,6 +18,7 @@
#include <isc/buffer.h> #include <isc/buffer.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/region.h> #include <isc/region.h>
#include <isc/print.h> #include <isc/print.h>
@@ -37,7 +38,7 @@
#include <dst/dst.h> #include <dst/dst.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -69,7 +70,7 @@ usage(void) {
fprintf(stderr, " -3: use NSEC3-capable algorithm\n"); fprintf(stderr, " -3: use NSEC3-capable algorithm\n");
fprintf(stderr, " -c class (default: IN)\n"); fprintf(stderr, " -c class (default: IN)\n");
fprintf(stderr, " -E <engine>:\n"); fprintf(stderr, " -E <engine>:\n");
#if HAVE_PKCS11 #if defined(PKCS11CRYPTO)
fprintf(stderr, " path to PKCS#11 provider library " fprintf(stderr, " path to PKCS#11 provider library "
"(default is %s)\n", PK11_LIB_LOCATION); "(default is %s)\n", PK11_LIB_LOCATION);
#elif defined(USE_PKCS11) #elif defined(USE_PKCS11)
@@ -145,6 +146,7 @@ main(int argc, char **argv) {
char filename[255]; char filename[255];
isc_buffer_t buf; isc_buffer_t buf;
isc_log_t *log = NULL; isc_log_t *log = NULL;
isc_entropy_t *ectx = NULL;
dns_rdataclass_t rdclass; dns_rdataclass_t rdclass;
int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC; int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC;
char *label = NULL; char *label = NULL;
@@ -173,7 +175,7 @@ main(int argc, char **argv) {
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
dns_result_register(); dns_result_register();
@@ -345,7 +347,10 @@ main(int argc, char **argv) {
} }
} }
ret = dst_lib_init(mctx, engine); if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
ret = dst_lib_init2(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (ret != ISC_R_SUCCESS) if (ret != ISC_R_SUCCESS)
fatal("could not initialize dst: %s", fatal("could not initialize dst: %s",
isc_result_totext(ret)); isc_result_totext(ret));
@@ -360,7 +365,8 @@ main(int argc, char **argv) {
if (argc > isc_commandline_index + 1) if (argc > isc_commandline_index + 1)
fatal("extraneous arguments"); fatal("extraneous arguments");
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
isc_buffer_init(&buf, argv[isc_commandline_index], isc_buffer_init(&buf, argv[isc_commandline_index],
strlen(argv[isc_commandline_index])); strlen(argv[isc_commandline_index]));
isc_buffer_add(&buf, strlen(argv[isc_commandline_index])); isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
@@ -607,12 +613,13 @@ main(int argc, char **argv) {
/* associate the key */ /* associate the key */
ret = dst_key_fromlabel(name, alg, flags, protocol, rdclass, ret = dst_key_fromlabel(name, alg, flags, protocol, rdclass,
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
"pkcs11", "pkcs11",
#else #else
engine, engine,
#endif #endif
label, NULL, mctx, &key); label, NULL, mctx, &key);
isc_entropy_stopcallbacksources(ectx);
if (ret != ISC_R_SUCCESS) { if (ret != ISC_R_SUCCESS) {
char namestr[DNS_NAME_FORMATSIZE]; char namestr[DNS_NAME_FORMATSIZE];
@@ -731,6 +738,7 @@ main(int argc, char **argv) {
dst_key_free(&prevkey); dst_key_free(&prevkey);
cleanup_logging(&log); cleanup_logging(&log);
cleanup_entropy(&ectx);
dst_lib_destroy(); dst_lib_destroy();
dns_name_destroy(); dns_name_destroy();
if (verbose > 10) if (verbose > 10)
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2008-2012, 2014-2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2008-2012, 2014-2017 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+16 -1
View File
@@ -39,7 +39,7 @@
dnssec-keygen \- DNSSEC key generation tool dnssec-keygen \- DNSSEC key generation tool
.SH "SYNOPSIS" .SH "SYNOPSIS"
.HP \w'\fBdnssec\-keygen\fR\ 'u .HP \w'\fBdnssec\-keygen\fR\ 'u
\fBdnssec\-keygen\fR [\fB\-a\ \fR\fB\fIalgorithm\fR\fR] [\fB\-b\ \fR\fB\fIkeysize\fR\fR] [\fB\-n\ \fR\fB\fInametype\fR\fR] [\fB\-3\fR] [\fB\-A\ \fR\fB\fIdate/offset\fR\fR] [\fB\-C\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-D\ \fR\fB\fIdate/offset\fR\fR] [\fB\-D\ sync\ \fR\fB\fIdate/offset\fR\fR] [\fB\-E\ \fR\fB\fIengine\fR\fR] [\fB\-f\ \fR\fB\fIflag\fR\fR] [\fB\-G\fR] [\fB\-g\ \fR\fB\fIgenerator\fR\fR] [\fB\-h\fR] [\fB\-I\ \fR\fB\fIdate/offset\fR\fR] [\fB\-i\ \fR\fB\fIinterval\fR\fR] [\fB\-K\ \fR\fB\fIdirectory\fR\fR] [\fB\-k\fR] [\fB\-L\ \fR\fB\fIttl\fR\fR] [\fB\-P\ \fR\fB\fIdate/offset\fR\fR] [\fB\-P\ sync\ \fR\fB\fIdate/offset\fR\fR] [\fB\-p\ \fR\fB\fIprotocol\fR\fR] [\fB\-q\fR] [\fB\-R\ \fR\fB\fIdate/offset\fR\fR] [\fB\-S\ \fR\fB\fIkey\fR\fR] [\fB\-s\ \fR\fB\fIstrength\fR\fR] [\fB\-t\ \fR\fB\fItype\fR\fR] [\fB\-V\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-z\fR] {name} \fBdnssec\-keygen\fR [\fB\-a\ \fR\fB\fIalgorithm\fR\fR] [\fB\-b\ \fR\fB\fIkeysize\fR\fR] [\fB\-n\ \fR\fB\fInametype\fR\fR] [\fB\-3\fR] [\fB\-A\ \fR\fB\fIdate/offset\fR\fR] [\fB\-C\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-D\ \fR\fB\fIdate/offset\fR\fR] [\fB\-D\ sync\ \fR\fB\fIdate/offset\fR\fR] [\fB\-E\ \fR\fB\fIengine\fR\fR] [\fB\-f\ \fR\fB\fIflag\fR\fR] [\fB\-G\fR] [\fB\-g\ \fR\fB\fIgenerator\fR\fR] [\fB\-h\fR] [\fB\-I\ \fR\fB\fIdate/offset\fR\fR] [\fB\-i\ \fR\fB\fIinterval\fR\fR] [\fB\-K\ \fR\fB\fIdirectory\fR\fR] [\fB\-k\fR] [\fB\-L\ \fR\fB\fIttl\fR\fR] [\fB\-P\ \fR\fB\fIdate/offset\fR\fR] [\fB\-P\ sync\ \fR\fB\fIdate/offset\fR\fR] [\fB\-p\ \fR\fB\fIprotocol\fR\fR] [\fB\-q\fR] [\fB\-R\ \fR\fB\fIdate/offset\fR\fR] [\fB\-r\ \fR\fB\fIrandomdev\fR\fR] [\fB\-S\ \fR\fB\fIkey\fR\fR] [\fB\-s\ \fR\fB\fIstrength\fR\fR] [\fB\-t\ \fR\fB\fItype\fR\fR] [\fB\-V\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-z\fR] {name}
.SH "DESCRIPTION" .SH "DESCRIPTION"
.PP .PP
\fBdnssec\-keygen\fR \fBdnssec\-keygen\fR
@@ -178,6 +178,21 @@ stderr
indicating the progress of the key generation\&. A \*(Aq\&.\*(Aq indicates that a random number has been found which passed an initial sieve test; \*(Aq+\*(Aq means a number has passed a single round of the Miller\-Rabin primality test; a space means that the number has passed all the tests and is a satisfactory key\&. indicating the progress of the key generation\&. A \*(Aq\&.\*(Aq indicates that a random number has been found which passed an initial sieve test; \*(Aq+\*(Aq means a number has passed a single round of the Miller\-Rabin primality test; a space means that the number has passed all the tests and is a satisfactory key\&.
.RE .RE
.PP .PP
\-r \fIrandomdev\fR
.RS 4
Specifies a source of randomness\&. Normally, when generating DNSSEC keys, this option has no effect; the random number generation function provided by the cryptographic library will be used\&.
.sp
If that behavior is disabled at compile time, however, the specified file will be used as entropy source for key generation\&.
randomdev
is the name of a character device or file containing random data to be used\&. The special value
keyboard
indicates that keyboard input should be used\&.
.sp
The default is
/dev/random
if the operating system provides it or an equivalent device; if not, the default source of randomness is keyboard input\&.
.RE
.PP
\-S \fIkey\fR \-S \fIkey\fR
.RS 4 .RS 4
Create a new key which is an explicit successor to an existing key\&. The name, algorithm, size, and type of the key will be set to match the existing key\&. The activation date of the new key will be set to the inactivation date of the existing one\&. The publication date will be set to the activation date minus the prepublication interval, which defaults to 30 days\&. Create a new key which is an explicit successor to an existing key\&. The name, algorithm, size, and type of the key will be set to match the existing key\&. The activation date of the new key will be set to the inactivation date of the existing one\&. The publication date will be set to the activation date minus the prepublication interval, which defaults to 30 days\&.
+22 -13
View File
@@ -33,6 +33,7 @@
#include <isc/buffer.h> #include <isc/buffer.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/mem.h> #include <isc/mem.h>
#include <isc/print.h> #include <isc/print.h>
#include <isc/region.h> #include <isc/region.h>
@@ -52,7 +53,7 @@
#include <dst/dst.h> #include <dst/dst.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -106,7 +107,7 @@ usage(void) {
fprintf(stderr, " -c <class>: (default: IN)\n"); fprintf(stderr, " -c <class>: (default: IN)\n");
fprintf(stderr, " -d <digest bits> (0 => max, default)\n"); fprintf(stderr, " -d <digest bits> (0 => max, default)\n");
fprintf(stderr, " -E <engine>:\n"); fprintf(stderr, " -E <engine>:\n");
#if HAVE_PKCS11 #if defined(PKCS11CRYPTO)
fprintf(stderr, " path to PKCS#11 provider library " fprintf(stderr, " path to PKCS#11 provider library "
"(default is %s)\n", PK11_LIB_LOCATION); "(default is %s)\n", PK11_LIB_LOCATION);
#elif defined(USE_PKCS11) #elif defined(USE_PKCS11)
@@ -120,6 +121,7 @@ usage(void) {
"(DH only)\n"); "(DH only)\n");
fprintf(stderr, " -L <ttl>: default key TTL\n"); fprintf(stderr, " -L <ttl>: default key TTL\n");
fprintf(stderr, " -p <protocol>: (default: 3 [dnssec])\n"); fprintf(stderr, " -p <protocol>: (default: 3 [dnssec])\n");
fprintf(stderr, " -r <randomdev>: a file containing random data\n");
fprintf(stderr, " -s <strength>: strength value this key signs DNS " fprintf(stderr, " -s <strength>: strength value this key signs DNS "
"records with (default: 0)\n"); "records with (default: 0)\n");
fprintf(stderr, " -T <rrtype>: DNSKEY | KEY (default: DNSKEY; " fprintf(stderr, " -T <rrtype>: DNSKEY | KEY (default: DNSKEY; "
@@ -216,6 +218,7 @@ main(int argc, char **argv) {
dst_key_t *prevkey = NULL; dst_key_t *prevkey = NULL;
isc_buffer_t buf; isc_buffer_t buf;
isc_log_t *log = NULL; isc_log_t *log = NULL;
isc_entropy_t *ectx = NULL;
#ifdef USE_PKCS11 #ifdef USE_PKCS11
const char *engine = PKCS11_ENGINE; const char *engine = PKCS11_ENGINE;
#else #else
@@ -247,7 +250,7 @@ main(int argc, char **argv) {
if (argc == 1) if (argc == 1)
usage(); usage();
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
dns_result_register(); dns_result_register();
@@ -362,8 +365,7 @@ main(int argc, char **argv) {
quiet = ISC_TRUE; quiet = ISC_TRUE;
break; break;
case 'r': case 'r':
fatal("The -r option has been deprecated.\n" setup_entropy(mctx, isc_commandline_argument, &ectx);
"System random data is always used.\n");
break; break;
case 's': case 's':
signatory = strtol(isc_commandline_argument, signatory = strtol(isc_commandline_argument,
@@ -492,7 +494,10 @@ main(int argc, char **argv) {
if (!isatty(0)) if (!isatty(0))
quiet = ISC_TRUE; quiet = ISC_TRUE;
ret = dst_lib_init(mctx, engine); if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
ret = dst_lib_init2(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (ret != ISC_R_SUCCESS) if (ret != ISC_R_SUCCESS)
fatal("could not initialize dst: %s", fatal("could not initialize dst: %s",
isc_result_totext(ret)); isc_result_totext(ret));
@@ -508,7 +513,8 @@ main(int argc, char **argv) {
if (argc > isc_commandline_index + 1) if (argc > isc_commandline_index + 1)
fatal("extraneous arguments"); fatal("extraneous arguments");
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
isc_buffer_init(&buf, argv[isc_commandline_index], isc_buffer_init(&buf, argv[isc_commandline_index],
strlen(argv[isc_commandline_index])); strlen(argv[isc_commandline_index]));
isc_buffer_add(&buf, strlen(argv[isc_commandline_index])); isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
@@ -856,17 +862,19 @@ main(int argc, char **argv) {
if (!quiet && show_progress) { if (!quiet && show_progress) {
fprintf(stderr, "Generating key pair."); fprintf(stderr, "Generating key pair.");
ret = dst_key_generate(name, alg, size, param, flags, ret = dst_key_generate2(name, alg, size, param, flags,
protocol, rdclass, mctx, &key, protocol, rdclass, mctx, &key,
&progress); &progress);
putc('\n', stderr); putc('\n', stderr);
fflush(stderr); fflush(stderr);
} else { } else {
ret = dst_key_generate(name, alg, size, param, flags, ret = dst_key_generate2(name, alg, size, param, flags,
protocol, rdclass, mctx, &key, protocol, rdclass, mctx, &key,
NULL); NULL);
} }
isc_entropy_stopcallbacksources(ectx);
if (ret != ISC_R_SUCCESS) { if (ret != ISC_R_SUCCESS) {
char namestr[DNS_NAME_FORMATSIZE]; char namestr[DNS_NAME_FORMATSIZE];
char algstr[DNS_SECALG_FORMATSIZE]; char algstr[DNS_SECALG_FORMATSIZE];
@@ -1019,6 +1027,7 @@ main(int argc, char **argv) {
dst_key_free(&prevkey); dst_key_free(&prevkey);
cleanup_logging(&log); cleanup_logging(&log);
cleanup_entropy(&ectx);
dst_lib_destroy(); dst_lib_destroy();
dns_name_destroy(); dns_name_destroy();
if (verbose > 10) if (verbose > 10)
+26
View File
@@ -81,6 +81,7 @@
<arg choice="opt" rep="norepeat"><option>-p <replaceable class="parameter">protocol</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-p <replaceable class="parameter">protocol</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-q</option></arg> <arg choice="opt" rep="norepeat"><option>-q</option></arg>
<arg choice="opt" rep="norepeat"><option>-R <replaceable class="parameter">date/offset</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-R <replaceable class="parameter">date/offset</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-r <replaceable class="parameter">randomdev</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-S <replaceable class="parameter">key</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-S <replaceable class="parameter">key</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">strength</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">strength</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">type</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-t <replaceable class="parameter">type</replaceable></option></arg>
@@ -348,6 +349,31 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>-r <replaceable class="parameter">randomdev</replaceable></term>
<listitem>
<para>
Specifies a source of randomness. Normally, when generating
DNSSEC keys, this option has no effect; the random number
generation function provided by the cryptographic library will
be used.
</para>
<para>
If that behavior is disabled at compile time, however,
the specified file will be used as entropy source
for key generation. <filename>randomdev</filename> is
the name of a character device or file containing random
data to be used. The special value <filename>keyboard</filename>
indicates that keyboard input should be used.
</para>
<para>
The default is <filename>/dev/random</filename> if the
operating system provides it or an equivalent device;
if not, the default source of randomness is keyboard input.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term>-S <replaceable class="parameter">key</replaceable></term> <term>-S <replaceable class="parameter">key</replaceable></term>
<listitem> <listitem>
+23
View File
@@ -57,6 +57,7 @@
[<code class="option">-p <em class="replaceable"><code>protocol</code></em></code>] [<code class="option">-p <em class="replaceable"><code>protocol</code></em></code>]
[<code class="option">-q</code>] [<code class="option">-q</code>]
[<code class="option">-R <em class="replaceable"><code>date/offset</code></em></code>] [<code class="option">-R <em class="replaceable"><code>date/offset</code></em></code>]
[<code class="option">-r <em class="replaceable"><code>randomdev</code></em></code>]
[<code class="option">-S <em class="replaceable"><code>key</code></em></code>] [<code class="option">-S <em class="replaceable"><code>key</code></em></code>]
[<code class="option">-s <em class="replaceable"><code>strength</code></em></code>] [<code class="option">-s <em class="replaceable"><code>strength</code></em></code>]
[<code class="option">-t <em class="replaceable"><code>type</code></em></code>] [<code class="option">-t <em class="replaceable"><code>type</code></em></code>]
@@ -278,6 +279,28 @@
a satisfactory key. a satisfactory key.
</p> </p>
</dd> </dd>
<dt><span class="term">-r <em class="replaceable"><code>randomdev</code></em></span></dt>
<dd>
<p>
Specifies a source of randomness. Normally, when generating
DNSSEC keys, this option has no effect; the random number
generation function provided by the cryptographic library will
be used.
</p>
<p>
If that behavior is disabled at compile time, however,
the specified file will be used as entropy source
for key generation. <code class="filename">randomdev</code> is
the name of a character device or file containing random
data to be used. The special value <code class="filename">keyboard</code>
indicates that keyboard input should be used.
</p>
<p>
The default is <code class="filename">/dev/random</code> if the
operating system provides it or an equivalent device;
if not, the default source of randomness is keyboard input.
</p>
</dd>
<dt><span class="term">-S <em class="replaceable"><code>key</code></em></span></dt> <dt><span class="term">-S <em class="replaceable"><code>key</code></em></span></dt>
<dd> <dd>
<p> <p>
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2009, 2011, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2009, 2011, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -99,5 +99,5 @@ RFC 5011\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2009, 2011, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2009, 2011, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
.br .br
+15 -4
View File
@@ -18,6 +18,7 @@
#include <isc/buffer.h> #include <isc/buffer.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/mem.h> #include <isc/mem.h>
@@ -30,7 +31,7 @@
#include <dst/dst.h> #include <dst/dst.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -49,7 +50,7 @@ usage(void) {
fprintf(stderr, "Usage:\n"); fprintf(stderr, "Usage:\n");
fprintf(stderr, " %s [options] keyfile\n\n", program); fprintf(stderr, " %s [options] keyfile\n\n", program);
fprintf(stderr, "Version: %s\n", VERSION); fprintf(stderr, "Version: %s\n", VERSION);
#if HAVE_PKCS11 #if defined(PKCS11CRYPTO)
fprintf(stderr, " -E engine: specify PKCS#11 provider " fprintf(stderr, " -E engine: specify PKCS#11 provider "
"(default: %s)\n", PK11_LIB_LOCATION); "(default: %s)\n", PK11_LIB_LOCATION);
#elif defined(USE_PKCS11) #elif defined(USE_PKCS11)
@@ -86,6 +87,7 @@ main(int argc, char **argv) {
char keystr[DST_KEY_FORMATSIZE]; char keystr[DST_KEY_FORMATSIZE];
char *endp; char *endp;
int ch; int ch;
isc_entropy_t *ectx = NULL;
dst_key_t *key = NULL; dst_key_t *key = NULL;
isc_uint32_t flags; isc_uint32_t flags;
isc_buffer_t buf; isc_buffer_t buf;
@@ -100,7 +102,7 @@ main(int argc, char **argv) {
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("Out of memory"); fatal("Out of memory");
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
dns_result_register(); dns_result_register();
@@ -178,10 +180,17 @@ main(int argc, char **argv) {
} }
} }
result = dst_lib_init(mctx, engine); if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
result = dst_lib_init2(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("Could not initialize dst: %s", fatal("Could not initialize dst: %s",
isc_result_totext(result)); isc_result_totext(result));
result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
if (result != ISC_R_SUCCESS)
fatal("Could not initialize hash");
isc_entropy_stopcallbacksources(ectx);
result = dst_key_fromnamedfile(filename, dir, result = dst_key_fromnamedfile(filename, dir,
DST_TYPE_PUBLIC|DST_TYPE_PRIVATE, DST_TYPE_PUBLIC|DST_TYPE_PRIVATE,
@@ -262,7 +271,9 @@ main(int argc, char **argv) {
cleanup: cleanup:
dst_key_free(&key); dst_key_free(&key);
isc_hash_destroy();
dst_lib_destroy(); dst_lib_destroy();
cleanup_entropy(&ectx);
if (verbose > 10) if (verbose > 10)
isc_mem_stats(mctx, stdout); isc_mem_stats(mctx, stdout);
if (dir != NULL) if (dir != NULL)
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2009, 2011, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2009, 2011, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2009-2011, 2014-2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2009-2011, 2014-2017 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -200,5 +200,5 @@ RFC 5011\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2009-2011, 2014-2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2009-2011, 2014-2017 Internet Systems Consortium, Inc. ("ISC")
.br .br
+15 -4
View File
@@ -20,6 +20,7 @@
#include <isc/buffer.h> #include <isc/buffer.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/mem.h> #include <isc/mem.h>
@@ -33,7 +34,7 @@
#include <dst/dst.h> #include <dst/dst.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -53,7 +54,7 @@ usage(void) {
fprintf(stderr, " %s [options] keyfile\n\n", program); fprintf(stderr, " %s [options] keyfile\n\n", program);
fprintf(stderr, "Version: %s\n", VERSION); fprintf(stderr, "Version: %s\n", VERSION);
fprintf(stderr, "General options:\n"); fprintf(stderr, "General options:\n");
#if HAVE_PKCS11 #if defined(PKCS11CRYPTO)
fprintf(stderr, " -E engine: specify PKCS#11 provider " fprintf(stderr, " -E engine: specify PKCS#11 provider "
"(default: %s)\n", PK11_LIB_LOCATION); "(default: %s)\n", PK11_LIB_LOCATION);
#elif defined(USE_PKCS11) #elif defined(USE_PKCS11)
@@ -138,6 +139,7 @@ main(int argc, char **argv) {
char keystr[DST_KEY_FORMATSIZE]; char keystr[DST_KEY_FORMATSIZE];
char *endp, *p; char *endp, *p;
int ch; int ch;
isc_entropy_t *ectx = NULL;
const char *predecessor = NULL; const char *predecessor = NULL;
dst_key_t *prevkey = NULL; dst_key_t *prevkey = NULL;
dst_key_t *key = NULL; dst_key_t *key = NULL;
@@ -178,7 +180,7 @@ main(int argc, char **argv) {
setup_logging(mctx, &log); setup_logging(mctx, &log);
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
dns_result_register(); dns_result_register();
@@ -376,10 +378,17 @@ main(int argc, char **argv) {
if (argc > isc_commandline_index + 1) if (argc > isc_commandline_index + 1)
fatal("Extraneous arguments"); fatal("Extraneous arguments");
result = dst_lib_init(mctx, engine); if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
result = dst_lib_init2(mctx, ectx, engine,
ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("Could not initialize dst: %s", fatal("Could not initialize dst: %s",
isc_result_totext(result)); isc_result_totext(result));
result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
if (result != ISC_R_SUCCESS)
fatal("Could not initialize hash");
isc_entropy_stopcallbacksources(ectx);
if (predecessor != NULL) { if (predecessor != NULL) {
int major, minor; int major, minor;
@@ -663,7 +672,9 @@ main(int argc, char **argv) {
if (prevkey != NULL) if (prevkey != NULL)
dst_key_free(&prevkey); dst_key_free(&prevkey);
dst_key_free(&key); dst_key_free(&key);
isc_hash_destroy();
dst_lib_destroy(); dst_lib_destroy();
cleanup_entropy(&ectx);
if (verbose > 10) if (verbose > 10)
isc_mem_stats(mctx, stdout); isc_mem_stats(mctx, stdout);
cleanup_logging(&log); cleanup_logging(&log);
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2009-2011, 2014-2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2009-2011, 2014-2017 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+19 -3
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2000-2009, 2011-2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000-2009, 2011-2017 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -39,7 +39,7 @@
dnssec-signzone \- DNSSEC zone signing tool dnssec-signzone \- DNSSEC zone signing tool
.SH "SYNOPSIS" .SH "SYNOPSIS"
.HP \w'\fBdnssec\-signzone\fR\ 'u .HP \w'\fBdnssec\-signzone\fR\ 'u
\fBdnssec\-signzone\fR [\fB\-a\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-d\ \fR\fB\fIdirectory\fR\fR] [\fB\-D\fR] [\fB\-E\ \fR\fB\fIengine\fR\fR] [\fB\-e\ \fR\fB\fIend\-time\fR\fR] [\fB\-f\ \fR\fB\fIoutput\-file\fR\fR] [\fB\-g\fR] [\fB\-h\fR] [\fB\-i\ \fR\fB\fIinterval\fR\fR] [\fB\-I\ \fR\fB\fIinput\-format\fR\fR] [\fB\-j\ \fR\fB\fIjitter\fR\fR] [\fB\-K\ \fR\fB\fIdirectory\fR\fR] [\fB\-k\ \fR\fB\fIkey\fR\fR] [\fB\-L\ \fR\fB\fIserial\fR\fR] [\fB\-l\ \fR\fB\fIdomain\fR\fR] [\fB\-M\ \fR\fB\fImaxttl\fR\fR] [\fB\-N\ \fR\fB\fIsoa\-serial\-format\fR\fR] [\fB\-o\ \fR\fB\fIorigin\fR\fR] [\fB\-O\ \fR\fB\fIoutput\-format\fR\fR] [\fB\-P\fR] [\fB\-Q\fR] [\fB\-R\fR] [\fB\-S\fR] [\fB\-s\ \fR\fB\fIstart\-time\fR\fR] [\fB\-T\ \fR\fB\fIttl\fR\fR] [\fB\-t\fR] [\fB\-u\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-V\fR] [\fB\-X\ \fR\fB\fIextended\ end\-time\fR\fR] [\fB\-x\fR] [\fB\-z\fR] [\fB\-3\ \fR\fB\fIsalt\fR\fR] [\fB\-H\ \fR\fB\fIiterations\fR\fR] [\fB\-A\fR] {zonefile} [key...] \fBdnssec\-signzone\fR [\fB\-a\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-d\ \fR\fB\fIdirectory\fR\fR] [\fB\-D\fR] [\fB\-E\ \fR\fB\fIengine\fR\fR] [\fB\-e\ \fR\fB\fIend\-time\fR\fR] [\fB\-f\ \fR\fB\fIoutput\-file\fR\fR] [\fB\-g\fR] [\fB\-h\fR] [\fB\-i\ \fR\fB\fIinterval\fR\fR] [\fB\-I\ \fR\fB\fIinput\-format\fR\fR] [\fB\-j\ \fR\fB\fIjitter\fR\fR] [\fB\-K\ \fR\fB\fIdirectory\fR\fR] [\fB\-k\ \fR\fB\fIkey\fR\fR] [\fB\-L\ \fR\fB\fIserial\fR\fR] [\fB\-l\ \fR\fB\fIdomain\fR\fR] [\fB\-M\ \fR\fB\fImaxttl\fR\fR] [\fB\-N\ \fR\fB\fIsoa\-serial\-format\fR\fR] [\fB\-o\ \fR\fB\fIorigin\fR\fR] [\fB\-O\ \fR\fB\fIoutput\-format\fR\fR] [\fB\-P\fR] [\fB\-p\fR] [\fB\-Q\fR] [\fB\-R\fR] [\fB\-r\ \fR\fB\fIrandomdev\fR\fR] [\fB\-S\fR] [\fB\-s\ \fR\fB\fIstart\-time\fR\fR] [\fB\-T\ \fR\fB\fIttl\fR\fR] [\fB\-t\fR] [\fB\-u\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-V\fR] [\fB\-X\ \fR\fB\fIextended\ end\-time\fR\fR] [\fB\-x\fR] [\fB\-z\fR] [\fB\-3\ \fR\fB\fIsalt\fR\fR] [\fB\-H\ \fR\fB\fIiterations\fR\fR] [\fB\-A\fR] {zonefile} [key...]
.SH "DESCRIPTION" .SH "DESCRIPTION"
.PP .PP
\fBdnssec\-signzone\fR \fBdnssec\-signzone\fR
@@ -278,6 +278,11 @@ specifies the format version of the raw zone file: if N is 0, the raw file can b
\fBnamed\fR; if N is 1, the file can be read by release 9\&.9\&.0 or higher; the default is 1\&. \fBnamed\fR; if N is 1, the file can be read by release 9\&.9\&.0 or higher; the default is 1\&.
.RE .RE
.PP .PP
\-p
.RS 4
Use pseudo\-random data when signing the zone\&. This is faster, but less secure, than using real random data\&. This option may be useful when signing large zones or when the entropy source is limited\&.
.RE
.PP
\-P \-P
.RS 4 .RS 4
Disable post sign verification tests\&. Disable post sign verification tests\&.
@@ -306,6 +311,17 @@ This option is similar to
to signatures from keys that are no longer published\&. This enables ZSK rollover using the procedure described in RFC 4641, section 4\&.2\&.1\&.2 ("Double Signature Zone Signing Key Rollover")\&. to signatures from keys that are no longer published\&. This enables ZSK rollover using the procedure described in RFC 4641, section 4\&.2\&.1\&.2 ("Double Signature Zone Signing Key Rollover")\&.
.RE .RE
.PP .PP
\-r \fIrandomdev\fR
.RS 4
Specifies the source of randomness\&. If the operating system does not provide a
/dev/random
or equivalent device, the default source of randomness is keyboard input\&.
randomdev
specifies the name of a character device or file containing random data to be used instead of the default\&. The special value
keyboard
indicates that keyboard input should be used\&.
.RE
.PP
\-S \-S
.RS 4 .RS 4
Smart signing: Instructs Smart signing: Instructs
@@ -468,5 +484,5 @@ RFC 4641\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2000-2009, 2011-2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2000-2009, 2011-2017 Internet Systems Consortium, Inc. ("ISC")
.br .br
+69 -36
View File
@@ -34,6 +34,7 @@
#include <isc/app.h> #include <isc/app.h>
#include <isc/base32.h> #include <isc/base32.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/event.h> #include <isc/event.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/hash.h> #include <isc/hash.h>
@@ -79,7 +80,7 @@
#include <dst/dst.h> #include <dst/dst.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -129,6 +130,7 @@ static int jitter = 0;
static isc_boolean_t tryverify = ISC_FALSE; static isc_boolean_t tryverify = ISC_FALSE;
static isc_boolean_t printstats = ISC_FALSE; static isc_boolean_t printstats = ISC_FALSE;
static isc_mem_t *mctx = NULL; static isc_mem_t *mctx = NULL;
static isc_entropy_t *ectx = NULL;
static dns_ttl_t zone_soa_min_ttl; static dns_ttl_t zone_soa_min_ttl;
static dns_ttl_t soa_ttl; static dns_ttl_t soa_ttl;
static FILE *outfp = NULL; static FILE *outfp = NULL;
@@ -280,10 +282,11 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dst_key_t *key,
else else
expiry = endtime; expiry = endtime;
jendtime = (jitter != 0) ? expiry - isc_random_uniform(jitter) : expiry; jendtime = (jitter != 0) ? isc_random_jitter(expiry, jitter) : expiry;
isc_buffer_init(&b, array, sizeof(array)); isc_buffer_init(&b, array, sizeof(array));
result = dns_dnssec_sign(name, rdataset, key, &starttime, &jendtime, result = dns_dnssec_sign(name, rdataset, key, &starttime, &jendtime,
mctx, &b, &trdata); mctx, &b, &trdata);
isc_entropy_stopcallbacksources(ectx);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
fatal("dnskey '%s' failed to sign data: %s", fatal("dnskey '%s' failed to sign data: %s",
keystr, isc_result_totext(result)); keystr, isc_result_totext(result));
@@ -292,8 +295,8 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dst_key_t *key,
if (tryverify) { if (tryverify) {
result = dns_dnssec_verify(name, rdataset, key, result = dns_dnssec_verify(name, rdataset, key,
ISC_TRUE, 0, mctx, &trdata, NULL); ISC_TRUE, mctx, &trdata);
if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) { if (result == ISC_R_SUCCESS) {
vbprintf(3, "\tsignature verified\n"); vbprintf(3, "\tsignature verified\n");
INCSTAT(nverified); INCSTAT(nverified);
} else { } else {
@@ -453,9 +456,8 @@ setverifies(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key,
dns_rdata_t *rrsig) dns_rdata_t *rrsig)
{ {
isc_result_t result; isc_result_t result;
result = dns_dnssec_verify(name, set, key, ISC_FALSE, 0, mctx, rrsig, result = dns_dnssec_verify(name, set, key, ISC_FALSE, mctx, rrsig);
NULL); if (result == ISC_R_SUCCESS) {
if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) {
INCSTAT(nverified); INCSTAT(nverified);
return (ISC_TRUE); return (ISC_TRUE);
} else { } else {
@@ -847,7 +849,8 @@ addnowildcardhash(hashlist_t *l, /*const*/ dns_name_t *name,
isc_result_t result; isc_result_t result;
char namestr[DNS_NAME_FORMATSIZE]; char namestr[DNS_NAME_FORMATSIZE];
wild = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
wild = dns_fixedname_name(&fixed);
result = dns_name_concatenate(dns_wildcardname, name, wild, NULL); result = dns_name_concatenate(dns_wildcardname, name, wild, NULL);
if (result == ISC_R_NOSPACE) if (result == ISC_R_NOSPACE)
@@ -902,7 +905,7 @@ opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass,
rdclass, 0, NULL, dbp); rdclass, 0, NULL, dbp);
check_result(result, "dns_db_create()"); check_result(result, "dns_db_create()");
result = dns_db_load(*dbp, filename, inputformat, DNS_MASTER_HINT); result = dns_db_load3(*dbp, filename, inputformat, DNS_MASTER_HINT);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
dns_db_detach(dbp); dns_db_detach(dbp);
} }
@@ -1233,7 +1236,8 @@ get_soa_ttls(void) {
isc_result_t result; isc_result_t result;
dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdata_t rdata = DNS_RDATA_INIT;
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
dns_rdataset_init(&soaset); dns_rdataset_init(&soaset);
result = dns_db_find(gdb, gorigin, gversion, dns_rdatatype_soa, result = dns_db_find(gdb, gorigin, gversion, dns_rdatatype_soa,
0, 0, NULL, name, &soaset, NULL); 0, 0, NULL, name, &soaset, NULL);
@@ -1402,7 +1406,8 @@ signapex(void) {
dns_name_t *name; dns_name_t *name;
isc_result_t result; isc_result_t result;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
result = dns_dbiterator_seek(gdbiter, gorigin); result = dns_dbiterator_seek(gdbiter, gorigin);
check_result(result, "dns_dbiterator_seek()"); check_result(result, "dns_dbiterator_seek()");
result = dns_dbiterator_current(gdbiter, &node, name); result = dns_dbiterator_current(gdbiter, &node, name);
@@ -1452,7 +1457,8 @@ assignwork(isc_task_t *task, isc_task_t *worker) {
fname = isc_mem_get(mctx, sizeof(dns_fixedname_t)); fname = isc_mem_get(mctx, sizeof(dns_fixedname_t));
if (fname == NULL) if (fname == NULL)
fatal("out of memory"); fatal("out of memory");
name = dns_fixedname_initname(fname); dns_fixedname_init(fname);
name = dns_fixedname_name(fname);
node = NULL; node = NULL;
found = ISC_FALSE; found = ISC_FALSE;
while (!found) { while (!found) {
@@ -1486,7 +1492,8 @@ assignwork(isc_task_t *task, isc_task_t *worker) {
(zonecut == NULL || (zonecut == NULL ||
!dns_name_issubdomain(name, zonecut))) { !dns_name_issubdomain(name, zonecut))) {
if (is_delegation(gdb, gversion, gorigin, name, node, NULL)) { if (is_delegation(gdb, gversion, gorigin, name, node, NULL)) {
zonecut = dns_fixedname_initname(&fzonecut); dns_fixedname_init(&fzonecut);
zonecut = dns_fixedname_name(&fzonecut);
dns_name_copy(name, zonecut, NULL); dns_name_copy(name, zonecut, NULL);
if (!OPTOUT(nsec3flags) || if (!OPTOUT(nsec3flags) ||
secure(name, node)) secure(name, node))
@@ -1729,8 +1736,10 @@ nsecify(void) {
isc_uint32_t nsttl = 0; isc_uint32_t nsttl = 0;
dns_rdataset_init(&rdataset); dns_rdataset_init(&rdataset);
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
nextname = dns_fixedname_initname(&fnextname); name = dns_fixedname_name(&fname);
dns_fixedname_init(&fnextname);
nextname = dns_fixedname_name(&fnextname);
dns_fixedname_init(&fzonecut); dns_fixedname_init(&fzonecut);
zonecut = NULL; zonecut = NULL;
@@ -2142,7 +2151,8 @@ cleanup_zone(void) {
dns_diff_init(mctx, &add); dns_diff_init(mctx, &add);
dns_diff_init(mctx, &del); dns_diff_init(mctx, &del);
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
dns_rdataset_init(&rdataset); dns_rdataset_init(&rdataset);
result = dns_db_createiterator(gdb, 0, &dbiter); result = dns_db_createiterator(gdb, 0, &dbiter);
@@ -2202,8 +2212,10 @@ nsec3ify(unsigned int hashalg, dns_iterations_t iterations,
unsigned int count, nlabels; unsigned int count, nlabels;
dns_rdataset_init(&rdataset); dns_rdataset_init(&rdataset);
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
nextname = dns_fixedname_initname(&fnextname); name = dns_fixedname_name(&fname);
dns_fixedname_init(&fnextname);
nextname = dns_fixedname_name(&fnextname);
dns_fixedname_init(&fzonecut); dns_fixedname_init(&fzonecut);
zonecut = NULL; zonecut = NULL;
@@ -2447,7 +2459,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
isc_buffer_init(&b, origin, len); isc_buffer_init(&b, origin, len);
isc_buffer_add(&b, len); isc_buffer_add(&b, len);
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL); result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("failed converting name '%s' to dns format: %s", fatal("failed converting name '%s' to dns format: %s",
@@ -2457,7 +2470,7 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
rdclass, 0, NULL, db); rdclass, 0, NULL, db);
check_result(result, "dns_db_create()"); check_result(result, "dns_db_create()");
result = dns_db_load(*db, file, inputformat, 0); result = dns_db_load2(*db, file, inputformat);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
fatal("failed loading zone from '%s': %s", fatal("failed loading zone from '%s': %s",
file, isc_result_totext(result)); file, isc_result_totext(result));
@@ -2623,7 +2636,7 @@ build_final_keylist(void) {
* Find keys that match this zone in the key repository. * Find keys that match this zone in the key repository.
*/ */
result = dns_dnssec_findmatchingkeys(gorigin, directory, result = dns_dnssec_findmatchingkeys(gorigin, directory,
now, mctx, &matchkeys); mctx, &matchkeys);
if (result == ISC_R_NOTFOUND) { if (result == ISC_R_NOTFOUND) {
result = ISC_R_SUCCESS; result = ISC_R_SUCCESS;
} }
@@ -2795,7 +2808,8 @@ set_nsec3params(isc_boolean_t update, isc_boolean_t set_salt,
* (This assumes all NSEC3 records agree.) * (This assumes all NSEC3 records agree.)
*/ */
hashname = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
hashname = dns_fixedname_name(&fname);
result = dns_nsec3_hashname(&fname, NULL, NULL, result = dns_nsec3_hashname(&fname, NULL, NULL,
gorigin, gorigin, dns_hash_sha1, gorigin, gorigin, dns_hash_sha1,
orig_iter, orig_salt, orig_saltlen); orig_iter, orig_salt, orig_saltlen);
@@ -2884,7 +2898,8 @@ writeset(const char *prefix, dns_rdatatype_t type) {
unsigned int labels; unsigned int labels;
dns_name_init(&tname, NULL); dns_name_init(&tname, NULL);
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
labels = dns_name_countlabels(gorigin); labels = dns_name_countlabels(gorigin);
dns_name_getlabelsequence(gorigin, 0, labels - 1, &tname); dns_name_getlabelsequence(gorigin, 0, labels - 1, &tname);
result = dns_name_concatenate(&tname, dlv, name, NULL); result = dns_name_concatenate(&tname, dlv, name, NULL);
@@ -2970,8 +2985,7 @@ writeset(const char *prefix, dns_rdatatype_t type) {
check_result(result, "dns_diff_apply"); check_result(result, "dns_diff_apply");
dns_diff_clear(&diff); dns_diff_clear(&diff);
result = dns_master_dump(mctx, db, dbversion, style, filename, result = dns_master_dump(mctx, db, dbversion, style, filename);
dns_masterformat_text, NULL);
check_result(result, "dns_master_dump"); check_result(result, "dns_master_dump");
isc_mem_put(mctx, filename, filenamelen); isc_mem_put(mctx, filename, filenamelen);
@@ -3053,11 +3067,13 @@ usage(void) {
fprintf(stderr, "\t\tsoa serial format of signed zone file (keep)\n"); fprintf(stderr, "\t\tsoa serial format of signed zone file (keep)\n");
fprintf(stderr, "\t-D:\n"); fprintf(stderr, "\t-D:\n");
fprintf(stderr, "\t\toutput only DNSSEC-related records\n"); fprintf(stderr, "\t\toutput only DNSSEC-related records\n");
fprintf(stderr, "\t-r randomdev:\n");
fprintf(stderr, "\t\ta file containing random data\n");
fprintf(stderr, "\t-a:\t"); fprintf(stderr, "\t-a:\t");
fprintf(stderr, "verify generated signatures\n"); fprintf(stderr, "verify generated signatures\n");
fprintf(stderr, "\t-c class (IN)\n"); fprintf(stderr, "\t-c class (IN)\n");
fprintf(stderr, "\t-E engine:\n"); fprintf(stderr, "\t-E engine:\n");
#if HAVE_PKCS11 #if defined(PKCS11CRYPTO)
fprintf(stderr, "\t\tpath to PKCS#11 provider library " fprintf(stderr, "\t\tpath to PKCS#11 provider library "
"(default is %s)\n", PK11_LIB_LOCATION); "(default is %s)\n", PK11_LIB_LOCATION);
#elif defined(USE_PKCS11) #elif defined(USE_PKCS11)
@@ -3066,6 +3082,8 @@ usage(void) {
#else #else
fprintf(stderr, "\t\tname of an OpenSSL engine to use\n"); fprintf(stderr, "\t\tname of an OpenSSL engine to use\n");
#endif #endif
fprintf(stderr, "\t-p:\t");
fprintf(stderr, "use pseudorandom data (faster but less secure)\n");
fprintf(stderr, "\t-P:\t"); fprintf(stderr, "\t-P:\t");
fprintf(stderr, "disable post-sign verification\n"); fprintf(stderr, "disable post-sign verification\n");
fprintf(stderr, "\t-Q:\t"); fprintf(stderr, "\t-Q:\t");
@@ -3155,11 +3173,13 @@ main(int argc, char *argv[]) {
dns_dnsseckey_t *key; dns_dnsseckey_t *key;
isc_result_t result; isc_result_t result;
isc_log_t *log = NULL; isc_log_t *log = NULL;
isc_boolean_t pseudorandom = ISC_FALSE;
#ifdef USE_PKCS11 #ifdef USE_PKCS11
const char *engine = PKCS11_ENGINE; const char *engine = PKCS11_ENGINE;
#else #else
const char *engine = NULL; const char *engine = NULL;
#endif #endif
unsigned int eflags;
isc_boolean_t free_output = ISC_FALSE; isc_boolean_t free_output = ISC_FALSE;
int tempfilelen = 0; int tempfilelen = 0;
dns_rdataclass_t rdclass; dns_rdataclass_t rdclass;
@@ -3212,7 +3232,7 @@ main(int argc, char *argv[]) {
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("out of memory"); fatal("out of memory");
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
dns_result_register(); dns_result_register();
@@ -3344,7 +3364,8 @@ main(int argc, char *argv[]) {
isc_buffer_init(&b, isc_commandline_argument, len); isc_buffer_init(&b, isc_commandline_argument, len);
isc_buffer_add(&b, len); isc_buffer_add(&b, len);
dlv = dns_fixedname_initname(&dlv_fixed); dns_fixedname_init(&dlv_fixed);
dlv = dns_fixedname_name(&dlv_fixed);
result = dns_name_fromtext(dlv, &b, dns_rootname, 0, result = dns_name_fromtext(dlv, &b, dns_rootname, 0,
NULL); NULL);
check_result(result, "dns_name_fromtext(dlv)"); check_result(result, "dns_name_fromtext(dlv)");
@@ -3388,7 +3409,7 @@ main(int argc, char *argv[]) {
break; break;
case 'p': case 'p':
fatal("The -p option has been deprecated.\n"); pseudorandom = ISC_TRUE;
break; break;
case 'Q': case 'Q':
@@ -3400,7 +3421,7 @@ main(int argc, char *argv[]) {
break; break;
case 'r': case 'r':
fatal("The -r options has been deprecated.\n"); setup_entropy(mctx, isc_commandline_argument, &ectx);
break; break;
case 'S': case 'S':
@@ -3476,11 +3497,21 @@ main(int argc, char *argv[]) {
} }
} }
result = dst_lib_init(mctx, engine); if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
eflags = ISC_ENTROPY_BLOCKING;
if (!pseudorandom)
eflags |= ISC_ENTROPY_GOODONLY;
result = dst_lib_init2(mctx, ectx, engine, eflags);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("could not initialize dst: %s", fatal("could not initialize dst: %s",
isc_result_totext(result)); isc_result_totext(result));
result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
if (result != ISC_R_SUCCESS)
fatal("could not create hash context");
isc_stdtime_get(&now); isc_stdtime_get(&now);
if (startstr != NULL) { if (startstr != NULL) {
@@ -3606,8 +3637,8 @@ main(int argc, char *argv[]) {
if (output_dnssec_only && set_maxttl) if (output_dnssec_only && set_maxttl)
fatal("option -D cannot be used with -M"); fatal("option -D cannot be used with -M");
result = dns_master_stylecreate(&dsstyle, DNS_STYLEFLAG_NO_TTL, result = dns_master_stylecreate(&dsstyle, DNS_STYLEFLAG_NO_TTL,
0, 24, 0, 0, 0, 8, 0xffffffff, mctx); 0, 24, 0, 0, 0, 8, mctx);
check_result(result, "dns_master_stylecreate"); check_result(result, "dns_master_stylecreate");
gdb = NULL; gdb = NULL;
@@ -3851,9 +3882,9 @@ main(int argc, char *argv[]) {
header.flags = DNS_MASTERRAW_SOURCESERIALSET; header.flags = DNS_MASTERRAW_SOURCESERIALSET;
header.sourceserial = serialnum; header.sourceserial = serialnum;
} }
result = dns_master_dumptostream(mctx, gdb, gversion, result = dns_master_dumptostream3(mctx, gdb, gversion,
masterstyle, outputformat, masterstyle, outputformat,
&header, outfp); &header, outfp);
check_result(result, "dns_master_dumptostream3"); check_result(result, "dns_master_dumptostream3");
} }
@@ -3894,7 +3925,9 @@ main(int argc, char *argv[]) {
dns_master_styledestroy(&dsstyle, mctx); dns_master_styledestroy(&dsstyle, mctx);
cleanup_logging(&log); cleanup_logging(&log);
isc_hash_destroy();
dst_lib_destroy(); dst_lib_destroy();
cleanup_entropy(&ectx);
dns_name_destroy(); dns_name_destroy();
if (verbose > 10) if (verbose > 10)
isc_mem_stats(mctx, stdout); isc_mem_stats(mctx, stdout);
+31
View File
@@ -78,8 +78,10 @@
<arg choice="opt" rep="norepeat"><option>-o <replaceable class="parameter">origin</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-o <replaceable class="parameter">origin</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-O <replaceable class="parameter">output-format</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-O <replaceable class="parameter">output-format</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-P</option></arg> <arg choice="opt" rep="norepeat"><option>-P</option></arg>
<arg choice="opt" rep="norepeat"><option>-p</option></arg>
<arg choice="opt" rep="norepeat"><option>-Q</option></arg> <arg choice="opt" rep="norepeat"><option>-Q</option></arg>
<arg choice="opt" rep="norepeat"><option>-R</option></arg> <arg choice="opt" rep="norepeat"><option>-R</option></arg>
<arg choice="opt" rep="norepeat"><option>-r <replaceable class="parameter">randomdev</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-S</option></arg> <arg choice="opt" rep="norepeat"><option>-S</option></arg>
<arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">start-time</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-s <replaceable class="parameter">start-time</replaceable></option></arg>
<arg choice="opt" rep="norepeat"><option>-T <replaceable class="parameter">ttl</replaceable></option></arg> <arg choice="opt" rep="norepeat"><option>-T <replaceable class="parameter">ttl</replaceable></option></arg>
@@ -506,6 +508,18 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>-p</term>
<listitem>
<para>
Use pseudo-random data when signing the zone. This is faster,
but less secure, than using real random data. This option
may be useful when signing large zones or when the entropy
source is limited.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term>-P</term> <term>-P</term>
<listitem> <listitem>
@@ -557,6 +571,23 @@
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>-r <replaceable class="parameter">randomdev</replaceable></term>
<listitem>
<para>
Specifies the source of randomness. If the operating
system does not provide a <filename>/dev/random</filename>
or equivalent device, the default source of randomness
is keyboard input. <filename>randomdev</filename>
specifies
the name of a character device or file containing random
data to be used instead of the default. The special value
<filename>keyboard</filename> indicates that keyboard
input should be used.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term>-S</term> <term>-S</term>
<listitem> <listitem>
+26 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2000-2009, 2011-2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000-2009, 2011-2017 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -54,8 +54,10 @@
[<code class="option">-o <em class="replaceable"><code>origin</code></em></code>] [<code class="option">-o <em class="replaceable"><code>origin</code></em></code>]
[<code class="option">-O <em class="replaceable"><code>output-format</code></em></code>] [<code class="option">-O <em class="replaceable"><code>output-format</code></em></code>]
[<code class="option">-P</code>] [<code class="option">-P</code>]
[<code class="option">-p</code>]
[<code class="option">-Q</code>] [<code class="option">-Q</code>]
[<code class="option">-R</code>] [<code class="option">-R</code>]
[<code class="option">-r <em class="replaceable"><code>randomdev</code></em></code>]
[<code class="option">-S</code>] [<code class="option">-S</code>]
[<code class="option">-s <em class="replaceable"><code>start-time</code></em></code>] [<code class="option">-s <em class="replaceable"><code>start-time</code></em></code>]
[<code class="option">-T <em class="replaceable"><code>ttl</code></em></code>] [<code class="option">-T <em class="replaceable"><code>ttl</code></em></code>]
@@ -398,6 +400,15 @@
can be read by release 9.9.0 or higher; the default is 1. can be read by release 9.9.0 or higher; the default is 1.
</p> </p>
</dd> </dd>
<dt><span class="term">-p</span></dt>
<dd>
<p>
Use pseudo-random data when signing the zone. This is faster,
but less secure, than using real random data. This option
may be useful when signing large zones or when the entropy
source is limited.
</p>
</dd>
<dt><span class="term">-P</span></dt> <dt><span class="term">-P</span></dt>
<dd> <dd>
<p> <p>
@@ -442,6 +453,20 @@
("Double Signature Zone Signing Key Rollover"). ("Double Signature Zone Signing Key Rollover").
</p> </p>
</dd> </dd>
<dt><span class="term">-r <em class="replaceable"><code>randomdev</code></em></span></dt>
<dd>
<p>
Specifies the source of randomness. If the operating
system does not provide a <code class="filename">/dev/random</code>
or equivalent device, the default source of randomness
is keyboard input. <code class="filename">randomdev</code>
specifies
the name of a character device or file containing random
data to be used instead of the default. The special value
<code class="filename">keyboard</code> indicates that keyboard
input should be used.
</p>
</dd>
<dt><span class="term">-S</span></dt> <dt><span class="term">-S</span></dt>
<dd> <dd>
<p> <p>
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2012, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -113,5 +113,5 @@ RFC 4033\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2012, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
.br .br
+18 -6
View File
@@ -19,6 +19,7 @@
#include <isc/app.h> #include <isc/app.h>
#include <isc/base32.h> #include <isc/base32.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/entropy.h>
#include <isc/event.h> #include <isc/event.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/hash.h> #include <isc/hash.h>
@@ -61,7 +62,7 @@
#include <dst/dst.h> #include <dst/dst.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -72,6 +73,7 @@ int verbose;
static isc_stdtime_t now; static isc_stdtime_t now;
static isc_mem_t *mctx = NULL; static isc_mem_t *mctx = NULL;
static isc_entropy_t *ectx = NULL;
static dns_masterformat_t inputformat = dns_masterformat_text; static dns_masterformat_t inputformat = dns_masterformat_text;
static dns_db_t *gdb; /* The database */ static dns_db_t *gdb; /* The database */
static dns_dbversion_t *gversion; /* The database version */ static dns_dbversion_t *gversion; /* The database version */
@@ -95,7 +97,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
isc_buffer_init(&b, origin, len); isc_buffer_init(&b, origin, len);
isc_buffer_add(&b, len); isc_buffer_add(&b, len);
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL); result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("failed converting name '%s' to dns format: %s", fatal("failed converting name '%s' to dns format: %s",
@@ -105,7 +108,7 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) {
rdclass, 0, NULL, db); rdclass, 0, NULL, db);
check_result(result, "dns_db_create()"); check_result(result, "dns_db_create()");
result = dns_db_load(*db, file, inputformat, 0); result = dns_db_load2(*db, file, inputformat);
switch (result) { switch (result) {
case DNS_R_SEENINCLUDE: case DNS_R_SEENINCLUDE:
case ISC_R_SUCCESS: case ISC_R_SUCCESS:
@@ -149,7 +152,7 @@ usage(void) {
fprintf(stderr, "\t\tfile format of input zonefile (text)\n"); fprintf(stderr, "\t\tfile format of input zonefile (text)\n");
fprintf(stderr, "\t-c class (IN)\n"); fprintf(stderr, "\t-c class (IN)\n");
fprintf(stderr, "\t-E engine:\n"); fprintf(stderr, "\t-E engine:\n");
#if HAVE_PKCS11 #if defined(PKCS11CRYPTO)
fprintf(stderr, "\t\tpath to PKCS#11 provider library " fprintf(stderr, "\t\tpath to PKCS#11 provider library "
"(default is %s)\n", PK11_LIB_LOCATION); "(default is %s)\n", PK11_LIB_LOCATION);
#elif defined(USE_PKCS11) #elif defined(USE_PKCS11)
@@ -211,7 +214,7 @@ main(int argc, char *argv[]) {
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("out of memory"); fatal("out of memory");
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
dns_result_register(); dns_result_register();
@@ -275,11 +278,18 @@ main(int argc, char *argv[]) {
} }
} }
result = dst_lib_init(mctx, engine); if (ectx == NULL)
setup_entropy(mctx, NULL, &ectx);
result = dst_lib_init2(mctx, ectx, engine, ISC_ENTROPY_BLOCKING);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
fatal("could not initialize dst: %s", fatal("could not initialize dst: %s",
isc_result_totext(result)); isc_result_totext(result));
result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE);
if (result != ISC_R_SUCCESS)
fatal("could not create hash context");
isc_stdtime_get(&now); isc_stdtime_get(&now);
rdclass = strtoclass(classname); rdclass = strtoclass(classname);
@@ -330,6 +340,8 @@ main(int argc, char *argv[]) {
cleanup_logging(&log); cleanup_logging(&log);
dst_lib_destroy(); dst_lib_destroy();
isc_hash_destroy();
cleanup_entropy(&ectx);
dns_name_destroy(); dns_name_destroy();
if (verbose > 10) if (verbose > 10)
isc_mem_stats(mctx, stdout); isc_mem_stats(mctx, stdout);
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2012, 2014-2016, 2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+74 -8
View File
@@ -27,6 +27,7 @@
#include <isc/buffer.h> #include <isc/buffer.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/dir.h> #include <isc/dir.h>
#include <isc/entropy.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/heap.h> #include <isc/heap.h>
#include <isc/list.h> #include <isc/list.h>
@@ -72,6 +73,15 @@ struct nsec3_chain_fixed {
extern int verbose; extern int verbose;
extern const char *program; extern const char *program;
typedef struct entropysource entropysource_t;
struct entropysource {
isc_entropysource_t *source;
isc_mem_t *mctx;
ISC_LINK(entropysource_t) link;
};
static ISC_LIST(entropysource_t) sources;
static fatalcallback_t *fatalcallback = NULL; static fatalcallback_t *fatalcallback = NULL;
void void
@@ -212,6 +222,63 @@ cleanup_logging(isc_log_t **logp) {
dns_log_setcontext(NULL); dns_log_setcontext(NULL);
} }
void
setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx) {
isc_result_t result;
isc_entropysource_t *source = NULL;
entropysource_t *elt;
int usekeyboard = ISC_ENTROPY_KEYBOARDMAYBE;
REQUIRE(ectx != NULL);
if (*ectx == NULL) {
result = isc_entropy_create(mctx, ectx);
if (result != ISC_R_SUCCESS)
fatal("could not create entropy object: %s",
isc_result_totext(result));
ISC_LIST_INIT(sources);
}
#ifdef ISC_PLATFORM_CRYPTORANDOM
if (randomfile == NULL) {
isc_entropy_usehook(*ectx, ISC_TRUE);
}
#endif
if (randomfile != NULL && strcmp(randomfile, "keyboard") == 0) {
usekeyboard = ISC_ENTROPY_KEYBOARDYES;
randomfile = NULL;
}
result = isc_entropy_usebestsource(*ectx, &source, randomfile,
usekeyboard);
if (result != ISC_R_SUCCESS)
fatal("could not initialize entropy source: %s",
isc_result_totext(result));
if (source != NULL) {
elt = isc_mem_get(mctx, sizeof(*elt));
if (elt == NULL)
fatal("out of memory");
elt->source = source;
elt->mctx = mctx;
ISC_LINK_INIT(elt, link);
ISC_LIST_APPEND(sources, elt, link);
}
}
void
cleanup_entropy(isc_entropy_t **ectx) {
entropysource_t *source;
while (!ISC_LIST_EMPTY(sources)) {
source = ISC_LIST_HEAD(sources);
ISC_LIST_UNLINK(sources, source, link);
isc_entropy_destroysource(&source->source);
isc_mem_put(source->mctx, source, sizeof(*source));
}
isc_entropy_detach(ectx);
}
static isc_stdtime_t static isc_stdtime_t
time_units(isc_stdtime_t offset, char *suffix, const char *str) { time_units(isc_stdtime_t offset, char *suffix, const char *str) {
switch (suffix[0]) { switch (suffix[0]) {
@@ -439,7 +506,6 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
dns_secalg_t alg; dns_secalg_t alg;
char filename[ISC_DIR_NAMEMAX]; char filename[ISC_DIR_NAMEMAX];
isc_buffer_t fileb; isc_buffer_t fileb;
isc_stdtime_t now;
if (exact != NULL) if (exact != NULL)
*exact = ISC_FALSE; *exact = ISC_FALSE;
@@ -463,8 +529,7 @@ key_collision(dst_key_t *dstkey, dns_name_t *name, const char *dir,
} }
ISC_LIST_INIT(matchkeys); ISC_LIST_INIT(matchkeys);
isc_stdtime_get(&now); result = dns_dnssec_findmatchingkeys(name, dir, mctx, &matchkeys);
result = dns_dnssec_findmatchingkeys(name, dir, now, mctx, &matchkeys);
if (result == ISC_R_NOTFOUND) if (result == ISC_R_NOTFOUND)
return (ISC_FALSE); return (ISC_FALSE);
@@ -559,11 +624,10 @@ goodsig(dns_name_t *origin, dns_rdata_t *sigrdata, dns_name_t *name,
continue; continue;
} }
result = dns_dnssec_verify(name, rdataset, dstkey, ISC_FALSE, result = dns_dnssec_verify(name, rdataset, dstkey, ISC_FALSE,
0, mctx, sigrdata, NULL); mctx, sigrdata);
dst_key_free(&dstkey); dst_key_free(&dstkey);
if (result == ISC_R_SUCCESS || result == DNS_R_FROMWILDCARD) { if (result == ISC_R_SUCCESS)
return(ISC_TRUE); return(ISC_TRUE);
}
} }
return (ISC_FALSE); return (ISC_FALSE);
} }
@@ -1650,8 +1714,10 @@ verifyzone(dns_db_t *db, dns_dbversion_t *ver,
* present in the DNSKEY RRSET. * present in the DNSKEY RRSET.
*/ */
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
nextname = dns_fixedname_initname(&fnextname); name = dns_fixedname_name(&fname);
dns_fixedname_init(&fnextname);
nextname = dns_fixedname_name(&fnextname);
dns_fixedname_init(&fprevname); dns_fixedname_init(&fprevname);
prevname = NULL; prevname = NULL;
dns_fixedname_init(&fzonecut); dns_fixedname_init(&fzonecut);
+7
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: dnssectool.h,v 1.33 2011/10/20 23:46:51 tbox Exp $ */
#ifndef DNSSECTOOL_H #ifndef DNSSECTOOL_H
#define DNSSECTOOL_H 1 #define DNSSECTOOL_H 1
@@ -55,6 +56,12 @@ setup_logging(isc_mem_t *mctx, isc_log_t **logp);
void void
cleanup_logging(isc_log_t **logp); cleanup_logging(isc_log_t **logp);
void
setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx);
void
cleanup_entropy(isc_entropy_t **ectx);
dns_ttl_t strtottl(const char *str); dns_ttl_t strtottl(const char *str);
isc_stdtime_t isc_stdtime_t
+1 -1
View File
@@ -48,7 +48,7 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \
${ISC_INCLUDES} ${DLZDRIVER_INCLUDES} \ ${ISC_INCLUDES} ${DLZDRIVER_INCLUDES} \
${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@ ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@
CDEFINES = @CONTRIB_DLZ@ @USE_PKCS11@ @PKCS11_ENGINE@ CDEFINES = @CONTRIB_DLZ@ @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO@
CWARNINGS = CWARNINGS =
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: builtin.c,v 1.26 2012/01/21 19:44:18 each Exp $ */
/*! \file /*! \file
* \brief * \brief
+7 -4
View File
@@ -88,8 +88,13 @@ options {\n\
nta-recheck 300;\n\ nta-recheck 300;\n\
# pid-file \"" NAMED_LOCALSTATEDIR "/run/named/named.pid\"; \n\ # pid-file \"" NAMED_LOCALSTATEDIR "/run/named/named.pid\"; \n\
port 53;\n\ port 53;\n\
prefetch 2 9;\n\ prefetch 2 9;\n"
recursing-file \"named.recursing\";\n\ #if defined(ISC_PLATFORM_CRYPTORANDOM)
" random-device none;\n"
#elif defined(PATH_RANDOMDEV)
" random-device \"" PATH_RANDOMDEV "\";\n"
#endif
" recursing-file \"named.recursing\";\n\
recursive-clients 1000;\n\ recursive-clients 1000;\n\
request-nsid false;\n\ request-nsid false;\n\
reserved-sockets 512;\n\ reserved-sockets 512;\n\
@@ -190,7 +195,6 @@ options {\n\
resolver-nonbackoff-tries 3;\n\ resolver-nonbackoff-tries 3;\n\
resolver-retry-interval 800; /* in milliseconds */\n\ resolver-retry-interval 800; /* in milliseconds */\n\
# rfc2308-type1 <obsolete>;\n\ # rfc2308-type1 <obsolete>;\n\
root-key-sentinel yes;\n\
servfail-ttl 1;\n\ servfail-ttl 1;\n\
# sortlist <none>\n\ # sortlist <none>\n\
stale-answer-enable false;\n\ stale-answer-enable false;\n\
@@ -243,7 +247,6 @@ options {\n\
sig-signing-signatures 10;\n\ sig-signing-signatures 10;\n\
sig-signing-type 65534;\n\ sig-signing-type 65534;\n\
sig-validity-interval 30; /* days */\n\ sig-validity-interval 30; /* days */\n\
dnskey-sig-validity 0; /* default: sig-validity-interval */\n\
transfer-source *;\n\ transfer-source *;\n\
transfer-source-v6 *;\n\ transfer-source-v6 *;\n\
try-tcp-refresh yes; /* BIND 8 compat */\n\ try-tcp-refresh yes; /* BIND 8 compat */\n\
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: control.c,v 1.49 2012/01/31 23:47:31 tbox Exp $ */
/*! \file */ /*! \file */
+5 -3
View File
@@ -230,8 +230,7 @@ address_ok(isc_sockaddr_t *sockaddr, dns_acl_t *acl) {
isc_netaddr_fromsockaddr(&netaddr, sockaddr); isc_netaddr_fromsockaddr(&netaddr, sockaddr);
result = dns_acl_match(&netaddr, NULL, NULL, 0, NULL, acl, env, &match, result = dns_acl_match(&netaddr, NULL, acl, env, &match, NULL);
NULL);
if (result != ISC_R_SUCCESS || match <= 0) if (result != ISC_R_SUCCESS || match <= 0)
return (ISC_FALSE); return (ISC_FALSE);
@@ -326,6 +325,7 @@ static void
control_recvmessage(isc_task_t *task, isc_event_t *event) { control_recvmessage(isc_task_t *task, isc_event_t *event) {
controlconnection_t *conn = NULL; controlconnection_t *conn = NULL;
controllistener_t *listener = NULL; controllistener_t *listener = NULL;
named_server_t *server = NULL;
controlkey_t *key = NULL; controlkey_t *key = NULL;
isccc_sexpr_t *request = NULL; isccc_sexpr_t *request = NULL;
isccc_sexpr_t *response = NULL; isccc_sexpr_t *response = NULL;
@@ -347,6 +347,7 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
conn = event->ev_arg; conn = event->ev_arg;
listener = conn->listener; listener = conn->listener;
server = listener->controls->server;
algorithm = DST_ALG_UNKNOWN; algorithm = DST_ALG_UNKNOWN;
secret.rstart = NULL; secret.rstart = NULL;
text = NULL; text = NULL;
@@ -458,7 +459,8 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
*/ */
if (conn->nonce == 0) { if (conn->nonce == 0) {
while (conn->nonce == 0) { while (conn->nonce == 0) {
isc_random_buf(&conn->nonce, sizeof(conn->nonce)); isc_rng_randombytes(server->sctx->rngctx, &conn->nonce,
sizeof(conn->nonce));
} }
eresult = ISC_R_SUCCESS; eresult = ISC_R_SUCCESS;
} else } else
+2
View File
@@ -9,6 +9,8 @@
# See the COPYRIGHT file distributed with this work for additional # See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership. # information regarding copyright ownership.
# $Id: convertxsl.pl,v 1.14 2008/07/17 23:43:26 jinmei Exp $
use strict; use strict;
use warnings; use warnings;
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: dlz_dlopen_driver.h,v 1.4 2011/03/17 09:25:53 fdupont Exp $ */
#ifndef DLZ_DLOPEN_DRIVER_H #ifndef DLZ_DLOPEN_DRIVER_H
#define DLZ_DLOPEN_DRIVER_H #define DLZ_DLOPEN_DRIVER_H
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: config.h,v 1.16 2009/06/11 23:47:55 tbox Exp $ */
#ifndef NAMED_CONFIG_H #ifndef NAMED_CONFIG_H
#define NAMED_CONFIG_H 1 #define NAMED_CONFIG_H 1
+2
View File
@@ -48,6 +48,8 @@ EXTERN unsigned int named_g_cpus INIT(0);
EXTERN unsigned int named_g_udpdisp INIT(0); EXTERN unsigned int named_g_udpdisp INIT(0);
EXTERN isc_taskmgr_t * named_g_taskmgr INIT(NULL); EXTERN isc_taskmgr_t * named_g_taskmgr INIT(NULL);
EXTERN dns_dispatchmgr_t * named_g_dispatchmgr INIT(NULL); EXTERN dns_dispatchmgr_t * named_g_dispatchmgr INIT(NULL);
EXTERN isc_entropy_t * named_g_entropy INIT(NULL);
EXTERN isc_entropy_t * named_g_fallbackentropy INIT(NULL);
EXTERN unsigned int named_g_cpus_detected INIT(1); EXTERN unsigned int named_g_cpus_detected INIT(1);
#ifdef ENABLE_AFL #ifdef ENABLE_AFL
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: logconf.h,v 1.17 2007/06/19 23:46:59 tbox Exp $ */
#ifndef NAMED_LOGCONF_H #ifndef NAMED_LOGCONF_H
#define NAMED_LOGCONF_H 1 #define NAMED_LOGCONF_H 1
+2 -1
View File
@@ -23,7 +23,7 @@ ISC_LANG_BEGINDECLS
isc_result_t isc_result_t
named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx, named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
dns_tkeyctx_t **tctxp); isc_entropy_t *ectx, dns_tkeyctx_t **tctxp);
/*%< /*%<
* Create a TKEY context and configure it, including the default DH key * Create a TKEY context and configure it, including the default DH key
* and default domain, according to 'options'. * and default domain, according to 'options'.
@@ -31,6 +31,7 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
* Requires: * Requires:
*\li 'cfg' is a valid configuration options object. *\li 'cfg' is a valid configuration options object.
*\li 'mctx' is not NULL *\li 'mctx' is not NULL
*\li 'ectx' is not NULL
*\li 'tctx' is not NULL *\li 'tctx' is not NULL
*\li '*tctx' is NULL *\li '*tctx' is NULL
* *
+60 -8
View File
@@ -21,6 +21,7 @@
#include <isc/backtrace.h> #include <isc/backtrace.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/dir.h> #include <isc/dir.h>
#include <isc/entropy.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/httpd.h> #include <isc/httpd.h>
@@ -44,7 +45,7 @@
#include <dns/view.h> #include <dns/view.h>
#include <dst/result.h> #include <dst/result.h>
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
#include <pk11/result.h> #include <pk11/result.h>
#endif #endif
@@ -75,7 +76,7 @@
#include <named/smf_globals.h> #include <named/smf_globals.h>
#endif #endif
#if HAVE_OPENSSL #ifdef OPENSSL
#include <openssl/opensslv.h> #include <openssl/opensslv.h>
#include <openssl/crypto.h> #include <openssl/crypto.h>
#endif #endif
@@ -469,7 +470,6 @@ parse_command_line(int argc, char *argv[]) {
int ch; int ch;
int port; int port;
const char *p; const char *p;
char *last;
save_command_line(argc, argv); save_command_line(argc, argv);
@@ -607,14 +607,14 @@ parse_command_line(int argc, char *argv[]) {
else if (!strncmp(isc_commandline_argument, else if (!strncmp(isc_commandline_argument,
"mkeytimers=", 11)) "mkeytimers=", 11))
{ {
p = strtok_r(isc_commandline_argument + 11, "/", &last); p = strtok(isc_commandline_argument + 11, "/");
if (p == NULL) if (p == NULL)
named_main_earlyfatal("bad mkeytimer"); named_main_earlyfatal("bad mkeytimer");
dns_zone_mkey_hour = atoi(p); dns_zone_mkey_hour = atoi(p);
if (dns_zone_mkey_hour == 0) if (dns_zone_mkey_hour == 0)
named_main_earlyfatal("bad mkeytimer"); named_main_earlyfatal("bad mkeytimer");
p = strtok_r(NULL, "/", &last); p = strtok(NULL, "/");
if (p == NULL) { if (p == NULL) {
dns_zone_mkey_day = dns_zone_mkey_day =
(24 * dns_zone_mkey_hour); (24 * dns_zone_mkey_hour);
@@ -626,7 +626,7 @@ parse_command_line(int argc, char *argv[]) {
if (dns_zone_mkey_day < dns_zone_mkey_hour) if (dns_zone_mkey_day < dns_zone_mkey_hour)
named_main_earlyfatal("bad mkeytimer"); named_main_earlyfatal("bad mkeytimer");
p = strtok_r(NULL, "/", &last); p = strtok(NULL, "/");
if (p == NULL) { if (p == NULL) {
dns_zone_mkey_month = dns_zone_mkey_month =
(30 * dns_zone_mkey_day); (30 * dns_zone_mkey_day);
@@ -693,7 +693,7 @@ parse_command_line(int argc, char *argv[]) {
#ifdef __SUNPRO_C #ifdef __SUNPRO_C
printf("compiled by Solaris Studio %x\n", __SUNPRO_C); printf("compiled by Solaris Studio %x\n", __SUNPRO_C);
#endif #endif
#if HAVE_OPENSSL #ifdef OPENSSL
printf("compiled with OpenSSL version: %s\n", printf("compiled with OpenSSL version: %s\n",
OPENSSL_VERSION_TEXT); OPENSSL_VERSION_TEXT);
#if !defined(LIBRESSL_VERSION_NUMBER) && \ #if !defined(LIBRESSL_VERSION_NUMBER) && \
@@ -844,6 +844,23 @@ create_managers(void) {
ISC_LOG_INFO, "using up to %u sockets", socks); ISC_LOG_INFO, "using up to %u sockets", socks);
} }
result = isc_entropy_create(named_g_mctx, &named_g_entropy);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_entropy_create() failed: %s",
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
result = isc_hash_create(named_g_mctx, named_g_entropy,
DNS_NAME_MAXWIRE);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_hash_create() failed: %s",
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@@ -855,6 +872,13 @@ destroy_managers(void) {
isc_taskmgr_destroy(&named_g_taskmgr); isc_taskmgr_destroy(&named_g_taskmgr);
isc_timermgr_destroy(&named_g_timermgr); isc_timermgr_destroy(&named_g_timermgr);
isc_socketmgr_destroy(&named_g_socketmgr); isc_socketmgr_destroy(&named_g_socketmgr);
/*
* isc_hash_destroy() cannot be called as long as a resolver may be
* running. Calling this after isc_taskmgr_destroy() ensures the
* call is safe.
*/
isc_hash_destroy();
} }
static void static void
@@ -921,6 +945,30 @@ setup(void) {
isc_mem_free(named_g_mctx, instance); isc_mem_free(named_g_mctx, instance);
#endif /* HAVE_LIBSCF */ #endif /* HAVE_LIBSCF */
#ifdef PATH_RANDOMDEV
/*
* Initialize system's random device as fallback entropy source
* if running chroot'ed.
*/
if (named_g_chrootdir != NULL) {
result = isc_entropy_create(named_g_mctx,
&named_g_fallbackentropy);
if (result != ISC_R_SUCCESS)
named_main_earlyfatal("isc_entropy_create() failed: %s",
isc_result_totext(result));
result = isc_entropy_createfilesource(named_g_fallbackentropy,
PATH_RANDOMDEV);
if (result != ISC_R_SUCCESS) {
named_main_earlywarning("could not open pre-chroot "
"entropy source %s: %s",
PATH_RANDOMDEV,
isc_result_totext(result));
isc_entropy_detach(&named_g_fallbackentropy);
}
}
#endif
#ifdef ISC_PLATFORM_USETHREADS #ifdef ISC_PLATFORM_USETHREADS
/* /*
* Check for the number of cpu's before named_os_chroot(). * Check for the number of cpu's before named_os_chroot().
@@ -1127,6 +1175,10 @@ cleanup(void) {
if (named_g_mapped != NULL) if (named_g_mapped != NULL)
dns_acl_detach(&named_g_mapped); dns_acl_detach(&named_g_mapped);
isc_entropy_detach(&named_g_entropy);
if (named_g_fallbackentropy != NULL)
isc_entropy_detach(&named_g_fallbackentropy);
named_server_destroy(&named_g_server); named_server_destroy(&named_g_server);
named_builtin_deinit(); named_builtin_deinit();
@@ -1279,7 +1331,7 @@ main(int argc, char *argv[]) {
dns_result_register(); dns_result_register();
dst_result_register(); dst_result_register();
isccc_result_register(); isccc_result_register();
#if HAVE_PKCS11 #ifdef PKCS11CRYPTO
pk11_result_register(); pk11_result_register();
#endif #endif
+2 -2
View File
@@ -1,4 +1,4 @@
.\" Copyright (C) 2000, 2001, 2003-2009, 2011, 2013-2018 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001, 2003-2009, 2011, 2013-2017 Internet Systems Consortium, Inc. ("ISC")
.\" .\"
.\" This Source Code Form is subject to the terms of the Mozilla Public .\" This Source Code Form is subject to the terms of the Mozilla Public
.\" License, v. 2.0. If a copy of the MPL was not distributed with this .\" License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -378,5 +378,5 @@ BIND 9 Administrator Reference Manual\&.
\fBInternet Systems Consortium, Inc\&.\fR \fBInternet Systems Consortium, Inc\&.\fR
.SH "COPYRIGHT" .SH "COPYRIGHT"
.br .br
Copyright \(co 2000, 2001, 2003-2009, 2011, 2013-2018 Internet Systems Consortium, Inc. ("ISC") Copyright \(co 2000, 2001, 2003-2009, 2011, 2013-2017 Internet Systems Consortium, Inc. ("ISC")
.br .br
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- <!--
- Copyright (C) 2000, 2001, 2003-2009, 2011, 2013-2018 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003-2009, 2011, 2013-2017 Internet Systems Consortium, Inc. ("ISC")
- -
- This Source Code Form is subject to the terms of the Mozilla Public - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this - License, v. 2.0. If a copy of the MPL was not distributed with this
+194 -105
View File
@@ -25,6 +25,7 @@
#include <isc/base64.h> #include <isc/base64.h>
#include <isc/commandline.h> #include <isc/commandline.h>
#include <isc/dir.h> #include <isc/dir.h>
#include <isc/entropy.h>
#include <isc/file.h> #include <isc/file.h>
#include <isc/hash.h> #include <isc/hash.h>
#include <isc/hex.h> #include <isc/hex.h>
@@ -419,9 +420,6 @@ const char *empty_zones[] = {
/* RFC 7534 */ /* RFC 7534 */
"EMPTY.AS112.ARPA", "EMPTY.AS112.ARPA",
/* RFC 8375 */
"HOME.ARPA",
NULL NULL
}; };
@@ -658,7 +656,8 @@ configure_view_nametable(const cfg_obj_t *vconfig, const cfg_obj_t *config,
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
for (element = cfg_list_first(obj); for (element = cfg_list_first(obj);
element != NULL; element != NULL;
element = cfg_list_next(element)) { element = cfg_list_next(element)) {
@@ -870,8 +869,8 @@ load_view_keys(const cfg_obj_t *keys, const cfg_obj_t *vconfig,
* initializing key; that's why 'managed' * initializing key; that's why 'managed'
* is duplicated below. * is duplicated below.
*/ */
CHECK(dns_keytable_add(secroots, managed, CHECK(dns_keytable_add2(secroots, managed,
managed, &dstkey)); managed, &dstkey));
} }
} }
@@ -1096,7 +1095,8 @@ mustbesecure(const cfg_obj_t *mbs, dns_resolver_t *resolver) {
isc_result_t result; isc_result_t result;
isc_buffer_t b; isc_buffer_t b;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
for (element = cfg_list_first(mbs); for (element = cfg_list_first(mbs);
element != NULL; element != NULL;
element = cfg_list_next(element)) element = cfg_list_next(element))
@@ -1532,7 +1532,8 @@ disable_algorithms(const cfg_obj_t *disabled, dns_resolver_t *resolver) {
dns_name_t *name; dns_name_t *name;
isc_buffer_t b; isc_buffer_t b;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
str = cfg_obj_asstring(cfg_tuple_get(disabled, "name")); str = cfg_obj_asstring(cfg_tuple_get(disabled, "name"));
isc_buffer_constinit(&b, str, strlen(str)); isc_buffer_constinit(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str)); isc_buffer_add(&b, strlen(str));
@@ -1577,7 +1578,8 @@ disable_ds_digests(const cfg_obj_t *disabled, dns_resolver_t *resolver) {
dns_name_t *name; dns_name_t *name;
isc_buffer_t b; isc_buffer_t b;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
str = cfg_obj_asstring(cfg_tuple_get(disabled, "name")); str = cfg_obj_asstring(cfg_tuple_get(disabled, "name"));
isc_buffer_constinit(&b, str, strlen(str)); isc_buffer_constinit(&b, str, strlen(str));
isc_buffer_add(&b, strlen(str)); isc_buffer_add(&b, strlen(str));
@@ -1618,7 +1620,8 @@ on_disable_list(const cfg_obj_t *disablelist, dns_name_t *zonename) {
const char *str; const char *str;
isc_buffer_t b; isc_buffer_t b;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
for (element = cfg_list_first(disablelist); for (element = cfg_list_first(disablelist);
element != NULL; element != NULL;
@@ -1812,7 +1815,8 @@ dns64_reverse(dns_view_t *view, isc_mem_t *mctx, isc_netaddr_t *na,
dns64_dbtype[2] = server; dns64_dbtype[2] = server;
if (contact != NULL) if (contact != NULL)
dns64_dbtype[3] = contact; dns64_dbtype[3] = contact;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
isc_buffer_constinit(&b, reverse, strlen(reverse)); isc_buffer_constinit(&b, reverse, strlen(reverse));
isc_buffer_add(&b, strlen(reverse)); isc_buffer_add(&b, strlen(reverse));
CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL)); CHECK(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
@@ -2099,10 +2103,8 @@ configure_rpz_name2(dns_view_t *view, const cfg_obj_t *obj, dns_name_t *name,
static isc_result_t static isc_result_t
configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element, configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element,
isc_boolean_t recursive_only_default, isc_boolean_t recursive_only_def, dns_ttl_t ttl_def,
dns_ttl_t ttl_default, isc_uint32_t minupdateint_def, const dns_rpz_zone_t *old,
isc_uint32_t minupdateinterval_default,
const dns_rpz_zone_t *old,
isc_boolean_t *old_rpz_okp) isc_boolean_t *old_rpz_okp)
{ {
const cfg_obj_t *rpz_obj, *obj; const cfg_obj_t *rpz_obj, *obj;
@@ -2131,9 +2133,7 @@ configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element,
} }
obj = cfg_tuple_get(rpz_obj, "recursive-only"); obj = cfg_tuple_get(rpz_obj, "recursive-only");
if (cfg_obj_isvoid(obj) ? if (cfg_obj_isvoid(obj) ? recursive_only_def : cfg_obj_asboolean(obj)) {
recursive_only_default : cfg_obj_asboolean(obj))
{
view->rpzs->p.no_rd_ok &= ~DNS_RPZ_ZBIT(zone->num); view->rpzs->p.no_rd_ok &= ~DNS_RPZ_ZBIT(zone->num);
} else { } else {
view->rpzs->p.no_rd_ok |= DNS_RPZ_ZBIT(zone->num); view->rpzs->p.no_rd_ok |= DNS_RPZ_ZBIT(zone->num);
@@ -2150,14 +2150,14 @@ configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element,
if (cfg_obj_isuint32(obj)) { if (cfg_obj_isuint32(obj)) {
zone->max_policy_ttl = cfg_obj_asuint32(obj); zone->max_policy_ttl = cfg_obj_asuint32(obj);
} else { } else {
zone->max_policy_ttl = ttl_default; zone->max_policy_ttl = ttl_def;
} }
obj = cfg_tuple_get(rpz_obj, "min-update-interval"); obj = cfg_tuple_get(rpz_obj, "min-update-interval");
if (cfg_obj_isuint32(obj)) { if (cfg_obj_isuint32(obj)) {
zone->min_update_interval = cfg_obj_asuint32(obj); zone->min_update_int = cfg_obj_asuint32(obj);
} else { } else {
zone->min_update_interval = minupdateinterval_default; zone->min_update_int = minupdateint_def;
} }
if (*old_rpz_okp && zone->max_policy_ttl != old->max_policy_ttl) if (*old_rpz_okp && zone->max_policy_ttl != old->max_policy_ttl)
@@ -2256,11 +2256,11 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps,
char *rps_cstr; char *rps_cstr;
size_t rps_cstr_size; size_t rps_cstr_size;
const cfg_obj_t *sub_obj; const cfg_obj_t *sub_obj;
isc_boolean_t recursive_only_default; isc_boolean_t recursive_only_def;
isc_boolean_t nsip_enabled, nsdname_enabled; isc_boolean_t nsip_enabled, nsdname_enabled;
dns_rpz_zbits_t nsip_on, nsdname_on; dns_rpz_zbits_t nsip_on, nsdname_on;
dns_ttl_t ttl_default; dns_ttl_t ttl_def;
isc_uint32_t minupdateinterval_default; isc_uint32_t minupdateint_def;
dns_rpz_zones_t *zones; dns_rpz_zones_t *zones;
const dns_rpz_zones_t *old; const dns_rpz_zones_t *old;
dns_view_t *pview; dns_view_t *pview;
@@ -2351,9 +2351,9 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps,
sub_obj = cfg_tuple_get(rpz_obj, "recursive-only"); sub_obj = cfg_tuple_get(rpz_obj, "recursive-only");
if (!cfg_obj_isvoid(sub_obj) && if (!cfg_obj_isvoid(sub_obj) &&
!cfg_obj_asboolean(sub_obj)) !cfg_obj_asboolean(sub_obj))
recursive_only_default = ISC_FALSE; recursive_only_def = ISC_FALSE;
else else
recursive_only_default = ISC_TRUE; recursive_only_def = ISC_TRUE;
sub_obj = cfg_tuple_get(rpz_obj, "break-dnssec"); sub_obj = cfg_tuple_get(rpz_obj, "break-dnssec");
if (!cfg_obj_isvoid(sub_obj) && if (!cfg_obj_isvoid(sub_obj) &&
@@ -2364,15 +2364,15 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps,
sub_obj = cfg_tuple_get(rpz_obj, "max-policy-ttl"); sub_obj = cfg_tuple_get(rpz_obj, "max-policy-ttl");
if (cfg_obj_isuint32(sub_obj)) if (cfg_obj_isuint32(sub_obj))
ttl_default = cfg_obj_asuint32(sub_obj); ttl_def = cfg_obj_asuint32(sub_obj);
else else
ttl_default = DNS_RPZ_MAX_TTL_DEFAULT; ttl_def = DNS_RPZ_MAX_TTL_DEFAULT;
sub_obj = cfg_tuple_get(rpz_obj, "min-update-interval"); sub_obj = cfg_tuple_get(rpz_obj, "min-update-interval");
if (cfg_obj_isuint32(sub_obj)) if (cfg_obj_isuint32(sub_obj))
minupdateinterval_default = cfg_obj_asuint32(sub_obj); minupdateint_def = cfg_obj_asuint32(sub_obj);
else else
minupdateinterval_default = DNS_RPZ_MINUPDATEINTERVAL_DEFAULT; minupdateint_def = DNS_RPZ_MINUPDATEINT_DEF;
sub_obj = cfg_tuple_get(rpz_obj, "min-ns-dots"); sub_obj = cfg_tuple_get(rpz_obj, "min-ns-dots");
if (cfg_obj_isuint32(sub_obj)) if (cfg_obj_isuint32(sub_obj))
@@ -2416,10 +2416,9 @@ configure_rpz(dns_view_t *view, const cfg_obj_t **maps,
old_zone = NULL; old_zone = NULL;
} }
result = configure_rpz_zone(view, zone_element, result = configure_rpz_zone(view, zone_element,
recursive_only_default, recursive_only_def, ttl_def,
ttl_default, minupdateint_def, old_zone,
minupdateinterval_default, old_rpz_okp);
old_zone, old_rpz_okp);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
if (pview != NULL) if (pview != NULL)
dns_view_detach(&pview); dns_view_detach(&pview);
@@ -3229,9 +3228,12 @@ create_empty_zone(dns_zone_t *zone, dns_name_t *name, dns_view_t *view,
int order; int order;
unsigned int nlabels; unsigned int nlabels;
zname = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
ns = dns_fixedname_initname(&nsfixed); zname = dns_fixedname_name(&fixed);
contact = dns_fixedname_initname(&cfixed); dns_fixedname_init(&nsfixed);
ns = dns_fixedname_name(&nsfixed);
dns_fixedname_init(&cfixed);
contact = dns_fixedname_name(&cfixed);
/* /*
* Look for forward "zones" beneath this empty zone and if so * Look for forward "zones" beneath this empty zone and if so
@@ -3348,7 +3350,7 @@ create_empty_zone(dns_zone_t *zone, dns_name_t *name, dns_view_t *view,
dns_db_closeversion(db, &version, ISC_TRUE); dns_db_closeversion(db, &version, ISC_TRUE);
CHECK(dns_zone_replacedb(zone, db, ISC_FALSE)); CHECK(dns_zone_replacedb(zone, db, ISC_FALSE));
} }
dns_zone_setoption(zone, DNS_ZONEOPT_AUTOEMPTY, ISC_TRUE); dns_zone_setoption2(zone, DNS_ZONEOPT2_AUTOEMPTY, ISC_TRUE);
dns_zone_setview(zone, view); dns_zone_setview(zone, view);
CHECK(dns_view_addzone(view, zone)); CHECK(dns_view_addzone(view, zone));
@@ -3550,7 +3552,7 @@ configure_dnstap(const cfg_obj_t **maps, dns_view_t *view) {
fstrm_iothr_options_set_reopen_interval(fopt, i); fstrm_iothr_options_set_reopen_interval(fopt, i);
} }
CHECKM(dns_dt_create(named_g_mctx, dmode, dpath, CHECKM(dns_dt_create2(named_g_mctx, dmode, dpath,
&fopt, named_g_server->task, &fopt, named_g_server->task,
&named_g_server->dtenv), &named_g_server->dtenv),
"unable to create dnstap environment"); "unable to create dnstap environment");
@@ -3613,8 +3615,8 @@ create_mapped_acl(void) {
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
result = dns_iptable_addprefix(acl->iptable, &addr, 96, result = dns_iptable_addprefix2(acl->iptable, &addr, 96,
ISC_TRUE, ISC_FALSE); ISC_TRUE, ISC_FALSE);
if (result == ISC_R_SUCCESS) if (result == ISC_R_SUCCESS)
dns_acl_attach(acl, &named_g_mapped); dns_acl_attach(acl, &named_g_mapped);
dns_acl_detach(&acl); dns_acl_detach(&acl);
@@ -4206,10 +4208,10 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
isc_mem_setname(cmctx, "cache", NULL); isc_mem_setname(cmctx, "cache", NULL);
CHECK(isc_mem_create(0, 0, &hmctx)); CHECK(isc_mem_create(0, 0, &hmctx));
isc_mem_setname(hmctx, "cache_heap", NULL); isc_mem_setname(hmctx, "cache_heap", NULL);
CHECK(dns_cache_create(cmctx, hmctx, named_g_taskmgr, CHECK(dns_cache_create3(cmctx, hmctx, named_g_taskmgr,
named_g_timermgr, view->rdclass, named_g_timermgr, view->rdclass,
cachename, "rbt", 0, NULL, cachename, "rbt", 0, NULL,
&cache)); &cache));
isc_mem_detach(&cmctx); isc_mem_detach(&cmctx);
isc_mem_detach(&hmctx); isc_mem_detach(&hmctx);
} }
@@ -4227,7 +4229,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
ISC_LINK_INIT(nsc, link); ISC_LINK_INIT(nsc, link);
ISC_LIST_APPEND(*cachelist, nsc, link); ISC_LIST_APPEND(*cachelist, nsc, link);
} }
dns_view_setcache(view, cache, shared_cache); dns_view_setcache2(view, cache, shared_cache);
/* /*
* cache-file cannot be inherited if views are present, but this * cache-file cannot be inherited if views are present, but this
@@ -4689,11 +4691,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
view->trust_anchor_telemetry = cfg_obj_asboolean(obj); view->trust_anchor_telemetry = cfg_obj_asboolean(obj);
obj = NULL;
result = named_config_get(maps, "root-key-sentinel", &obj);
INSIST(result == ISC_R_SUCCESS);
view->root_key_sentinel = cfg_obj_asboolean(obj);
CHECK(configure_view_acl(vconfig, config, named_g_config, CHECK(configure_view_acl(vconfig, config, named_g_config,
"allow-query-cache-on", NULL, actx, "allow-query-cache-on", NULL, actx,
named_g_mctx, &view->cacheonacl)); named_g_mctx, &view->cacheonacl));
@@ -5033,9 +5030,10 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
dns_name_t *dlv, *iscdlv; dns_name_t *dlv, *iscdlv;
dns_fixedname_t f; dns_fixedname_t f;
dns_fixedname_init(&f);
/* Also log a warning if manually configured to dlv.isc.org */ /* Also log a warning if manually configured to dlv.isc.org */
iscdlv = dns_fixedname_initname(&f); iscdlv = dns_fixedname_name(&f);
CHECK(dns_name_fromstring(iscdlv, "dlv.isc.org", 0, NULL)); CHECK(dns_name_fromstring(iscdlv, "dlv.isc.org", 0, NULL));
for (element = cfg_list_first(obj); for (element = cfg_list_first(obj);
@@ -5105,7 +5103,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
dns_fixedname_t fixed; dns_fixedname_t fixed;
dns_name_t *name; dns_name_t *name;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
for (element = cfg_list_first(obj); for (element = cfg_list_first(obj);
element != NULL; element != NULL;
element = cfg_list_next(element)) element = cfg_list_next(element))
@@ -5180,7 +5179,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
int empty_dbtypec = 4; int empty_dbtypec = 4;
dns_zonestat_level_t statlevel; dns_zonestat_level_t statlevel;
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
obj = NULL; obj = NULL;
result = named_config_get(maps, "empty-server", &obj); result = named_config_get(maps, "empty-server", &obj);
@@ -5254,7 +5254,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
* empty zone for it. * empty zone for it.
*/ */
result = dns_fwdtable_find(view->fwdtable, name, result = dns_fwdtable_find(view->fwdtable, name,
NULL, &dnsforwarders); &dnsforwarders);
if (result == ISC_R_SUCCESS && if (result == ISC_R_SUCCESS &&
dnsforwarders->fwdpolicy == dns_fwdpolicy_only) dnsforwarders->fwdpolicy == dns_fwdpolicy_only)
continue; continue;
@@ -5423,7 +5423,8 @@ configure_alternates(const cfg_obj_t *config, dns_view_t *view,
isc_buffer_constinit(&buffer, str, strlen(str)); isc_buffer_constinit(&buffer, str, strlen(str));
isc_buffer_add(&buffer, strlen(str)); isc_buffer_add(&buffer, strlen(str));
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
CHECK(dns_name_fromtext(name, &buffer, dns_rootname, 0, CHECK(dns_name_fromtext(name, &buffer, dns_rootname, 0,
NULL)); NULL));
@@ -5671,7 +5672,12 @@ create_view(const cfg_obj_t *vconfig, dns_viewlist_t *viewlist,
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
isc_random_buf(view->secret, sizeof(view->secret)); result = isc_entropy_getdata(named_g_entropy, view->secret,
sizeof(view->secret), NULL, 0);
if (result != ISC_R_SUCCESS) {
dns_view_detach(&view);
return (result);
}
ISC_LIST_APPEND(*viewlist, view, link); ISC_LIST_APPEND(*viewlist, view, link);
dns_view_attach(view, viewp); dns_view_attach(view, viewp);
@@ -6139,8 +6145,7 @@ add_keydata_zone(dns_view_t *view, const char *directory, isc_mem_t *mctx) {
defaultview ? "managed-keys" : view->name, defaultview ? "managed-keys" : view->name,
defaultview ? "bind" : "mkeys", defaultview ? "bind" : "mkeys",
filename, sizeof(filename))); filename, sizeof(filename)));
CHECK(dns_zone_setfile(zone, filename, dns_masterformat_text, CHECK(dns_zone_setfile(zone, filename));
&dns_master_style_default));
dns_zone_setview(zone, view); dns_zone_setview(zone, view);
dns_zone_settype(zone, dns_zone_key); dns_zone_settype(zone, dns_zone_key);
@@ -6261,8 +6266,8 @@ add_listenelt(isc_mem_t *mctx, ns_listenlist_t *list, isc_sockaddr_t *addr,
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
result = dns_iptable_addprefix(src_acl->iptable, &netaddr, result = dns_iptable_addprefix(src_acl->iptable,
128, ISC_TRUE, ISC_FALSE); &netaddr, 128, ISC_TRUE);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto clean; goto clean;
@@ -6532,7 +6537,8 @@ dotat(dns_keytable_t *keytable, dns_keynode_t *keynode, void *arg) {
} }
isc_textregion_consume(&r, m); isc_textregion_consume(&r, m);
} }
tatname = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
tatname = dns_fixedname_name(&fixed);
result = dns_name_fromstring2(tatname, label, name, 0, NULL); result = dns_name_fromstring2(tatname, label, name, 0, NULL);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
return; return;
@@ -6559,9 +6565,9 @@ dotat(dns_keytable_t *keytable, dns_keynode_t *keynode, void *arg) {
result = dns_resolver_createfetch(view->resolver, tatname, result = dns_resolver_createfetch(view->resolver, tatname,
dns_rdatatype_null, NULL, NULL, dns_rdatatype_null, NULL, NULL,
NULL, NULL, 0, 0, 0, NULL, tat->task, NULL, 0, tat->task, tat_done, tat,
tat_done, tat, &tat->rdataset, &tat->rdataset, &tat->sigrdataset,
&tat->sigrdataset, &tat->fetch); &tat->fetch);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
isc_task_detach(&tat->task); isc_task_detach(&tat->task);
@@ -6813,7 +6819,7 @@ generate_session_key(const char *filename, const char *keynamestr,
/* generate key */ /* generate key */
result = dst_key_generate(keyname, algtype, bits, 1, 0, result = dst_key_generate(keyname, algtype, bits, 1, 0,
DNS_KEYPROTO_ANY, dns_rdataclass_in, DNS_KEYPROTO_ANY, dns_rdataclass_in,
mctx, &key, NULL); mctx, &key);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
@@ -6909,9 +6915,10 @@ configure_session_key(const cfg_obj_t **maps, named_server_t *server,
result = named_config_get(maps, "session-keyname", &obj); result = named_config_get(maps, "session-keyname", &obj);
INSIST(result == ISC_R_SUCCESS); INSIST(result == ISC_R_SUCCESS);
keynamestr = cfg_obj_asstring(obj); keynamestr = cfg_obj_asstring(obj);
dns_fixedname_init(&fname);
isc_buffer_constinit(&buffer, keynamestr, strlen(keynamestr)); isc_buffer_constinit(&buffer, keynamestr, strlen(keynamestr));
isc_buffer_add(&buffer, strlen(keynamestr)); isc_buffer_add(&buffer, strlen(keynamestr));
keyname = dns_fixedname_initname(&fname); keyname = dns_fixedname_name(&fname);
result = dns_name_fromtext(keyname, &buffer, dns_rootname, 0, NULL); result = dns_name_fromtext(keyname, &buffer, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
@@ -7217,7 +7224,8 @@ configure_zone_setviewcommit(isc_result_t result, const cfg_obj_t *zconfig,
dns_zone_t *raw = NULL; dns_zone_t *raw = NULL;
zname = cfg_obj_asstring(cfg_tuple_get(zconfig, "name")); zname = cfg_obj_asstring(cfg_tuple_get(zconfig, "name"));
origin = dns_fixedname_initname(&fixorigin); dns_fixedname_init(&fixorigin);
origin = dns_fixedname_name(&fixorigin);
result2 = dns_name_fromstring(origin, zname, 0, NULL); result2 = dns_name_fromstring(origin, zname, 0, NULL);
if (result2 != ISC_R_SUCCESS) { if (result2 != ISC_R_SUCCESS) {
@@ -7565,7 +7573,8 @@ get_newzone_config(dns_view_t *view, const char *zonename,
/* Normalize zone name */ /* Normalize zone name */
isc_buffer_constinit(&b, zonename, strlen(zonename)); isc_buffer_constinit(&b, zonename, strlen(zonename));
isc_buffer_add(&b, strlen(zonename)); isc_buffer_add(&b, strlen(zonename));
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
CHECK(dns_name_fromtext(name, &b, dns_rootname, CHECK(dns_name_fromtext(name, &b, dns_rootname,
DNS_NAME_DOWNCASE, NULL)); DNS_NAME_DOWNCASE, NULL));
dns_name_format(name, zname, sizeof(zname)); dns_name_format(name, zname, sizeof(zname));
@@ -8507,7 +8516,8 @@ load_configuration(const char *filename, named_server_t *server,
/* Load the TKEY information from the configuration. */ /* Load the TKEY information from the configuration. */
if (options != NULL) { if (options != NULL) {
dns_tkeyctx_t *t = NULL; dns_tkeyctx_t *t = NULL;
CHECKM(named_tkeyctx_fromconfig(options, named_g_mctx, &t), CHECKM(named_tkeyctx_fromconfig(options, named_g_mctx,
named_g_entropy, &t),
"configuring TKEY"); "configuring TKEY");
if (server->sctx->tkeyctx != NULL) { if (server->sctx->tkeyctx != NULL) {
dns_tkeyctx_destroy(&server->sctx->tkeyctx); dns_tkeyctx_destroy(&server->sctx->tkeyctx);
@@ -8522,6 +8532,72 @@ load_configuration(const char *filename, named_server_t *server,
named_g_aclconfctx), named_g_aclconfctx),
"binding control channel(s)"); "binding control channel(s)");
/*
* Open the source of entropy.
*/
if (first_time) {
const char *randomdev = NULL;
int level = ISC_LOG_ERROR;
obj = NULL;
result = named_config_get(maps, "random-device", &obj);
if (result == ISC_R_SUCCESS) {
if (!cfg_obj_isvoid(obj)) {
level = ISC_LOG_INFO;
randomdev = cfg_obj_asstring(obj);
}
}
if (randomdev == NULL) {
#ifdef ISC_PLATFORM_CRYPTORANDOM
isc_entropy_usehook(named_g_entropy, ISC_TRUE);
#else
if ((obj != NULL) && !cfg_obj_isvoid(obj))
level = ISC_LOG_INFO;
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, level,
"no source of entropy found");
if ((obj == NULL) || cfg_obj_isvoid(obj)) {
CHECK(ISC_R_FAILURE);
}
#endif
} else {
result = isc_entropy_createfilesource(named_g_entropy,
randomdev);
#ifdef PATH_RANDOMDEV
if (named_g_fallbackentropy != NULL) {
level = ISC_LOG_INFO;
}
#endif
if (result != ISC_R_SUCCESS) {
isc_log_write(named_g_lctx,
NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER,
level,
"could not open "
"entropy source %s: %s",
randomdev,
isc_result_totext(result));
}
#ifdef PATH_RANDOMDEV
if (named_g_fallbackentropy != NULL) {
if (result != ISC_R_SUCCESS) {
isc_log_write(named_g_lctx,
NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER,
ISC_LOG_INFO,
"using pre-chroot "
"entropy source %s",
PATH_RANDOMDEV);
isc_entropy_detach(&named_g_entropy);
isc_entropy_attach(
named_g_fallbackentropy,
&named_g_entropy);
}
isc_entropy_detach(&named_g_fallbackentropy);
}
#endif
}
}
#ifdef HAVE_LMDB #ifdef HAVE_LMDB
/* /*
* If we're using LMDB, we may have created newzones databases * If we're using LMDB, we may have created newzones databases
@@ -8851,8 +8927,14 @@ load_configuration(const char *filename, named_server_t *server,
} }
} }
} else { } else {
isc_random_buf(server->sctx->secret, result = isc_entropy_getdata(named_g_entropy,
sizeof(server->sctx->secret)); server->sctx->secret,
sizeof(server->sctx->secret),
NULL,
0);
if (result != ISC_R_SUCCESS) {
goto cleanup;
}
} }
/* /*
@@ -8930,7 +9012,7 @@ load_configuration(const char *filename, named_server_t *server,
{ {
dns_view_setviewrevert(view); dns_view_setviewrevert(view);
(void)dns_zt_apply(view->zonetable, ISC_FALSE, (void)dns_zt_apply(view->zonetable, ISC_FALSE,
NULL, removed, view); removed, view);
} }
dns_view_detach(&view); dns_view_detach(&view);
} }
@@ -9106,7 +9188,8 @@ run_server(isc_task_t *task, isc_event_t *event) {
isc_event_free(&event); isc_event_free(&event);
CHECKFATAL(dns_dispatchmgr_create(named_g_mctx, &named_g_dispatchmgr), CHECKFATAL(dns_dispatchmgr_create(named_g_mctx, named_g_entropy,
&named_g_dispatchmgr),
"creating dispatch manager"); "creating dispatch manager");
dns_dispatchmgr_setstats(named_g_dispatchmgr, server->resolverstats); dns_dispatchmgr_setstats(named_g_dispatchmgr, server->resolverstats);
@@ -9164,6 +9247,8 @@ run_server(isc_task_t *task, isc_event_t *event) {
CHECKFATAL(load_configuration(named_g_conffile, server, ISC_TRUE), CHECKFATAL(load_configuration(named_g_conffile, server, ISC_TRUE),
"loading configuration"); "loading configuration");
isc_hash_init();
CHECKFATAL(load_zones(server, ISC_TRUE, ISC_FALSE), "loading zones"); CHECKFATAL(load_zones(server, ISC_TRUE, ISC_FALSE), "loading zones");
#ifdef ENABLE_AFL #ifdef ENABLE_AFL
named_g_run_done = ISC_TRUE; named_g_run_done = ISC_TRUE;
@@ -9340,7 +9425,8 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
server->in_roothints = NULL; server->in_roothints = NULL;
/* Must be first. */ /* Must be first. */
CHECKFATAL(dst_lib_init(named_g_mctx, named_g_engine), CHECKFATAL(dst_lib_init2(named_g_mctx, named_g_entropy,
named_g_engine, ISC_ENTROPY_GOODONLY),
"initializing DST"); "initializing DST");
CHECKFATAL(dns_rootns_create(mctx, dns_rdataclass_in, NULL, CHECKFATAL(dns_rootns_create(mctx, dns_rdataclass_in, NULL,
@@ -9370,7 +9456,8 @@ named_server_create(isc_mem_t *mctx, named_server_t **serverp) {
isc_taskmgr_setexcltask(named_g_taskmgr, server->task); isc_taskmgr_setexcltask(named_g_taskmgr, server->task);
server->sctx = NULL; server->sctx = NULL;
CHECKFATAL(ns_server_create(mctx, get_matching_view, CHECKFATAL(ns_server_create(mctx, named_g_entropy,
get_matching_view,
&server->sctx), &server->sctx),
"creating server context"); "creating server context");
@@ -9825,7 +9912,8 @@ zone_from_args(named_server_t *server, isc_lex_t *lex, const char *zonetxt,
strlcpy(zonename, redirect ? "." : zonetxt, strlcpy(zonename, redirect ? "." : zonetxt,
DNS_NAME_FORMATSIZE); DNS_NAME_FORMATSIZE);
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
CHECK(dns_name_fromstring(name, zonebuf, 0, NULL)); CHECK(dns_name_fromstring(name, zonebuf, 0, NULL));
/* Look for the optional class name. */ /* Look for the optional class name. */
@@ -10293,7 +10381,7 @@ add_view_tolist(struct dumpcontext *dctx, dns_view_t *view) {
ISC_LIST_INIT(vle->zonelist); ISC_LIST_INIT(vle->zonelist);
ISC_LIST_APPEND(dctx->viewlist, vle, link); ISC_LIST_APPEND(dctx->viewlist, vle, link);
if (dctx->dumpzones) if (dctx->dumpzones)
result = dns_zt_apply(view->zonetable, ISC_TRUE, NULL, result = dns_zt_apply(view->zonetable, ISC_TRUE,
add_zone_tolist, dctx); add_zone_tolist, dctx);
return (result); return (result);
} }
@@ -10790,7 +10878,7 @@ named_server_validation(named_server_t *server, isc_lex_t *lex,
{ {
if (ptr != NULL && strcasecmp(ptr, view->name) != 0) if (ptr != NULL && strcasecmp(ptr, view->name) != 0)
continue; continue;
CHECK(dns_view_flushcache(view, ISC_FALSE)); CHECK(dns_view_flushcache(view));
if (set) { if (set) {
view->enablevalidation = enable; view->enablevalidation = enable;
@@ -10881,7 +10969,7 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex) {
if (ptr != NULL && !nsc->needflush) if (ptr != NULL && !nsc->needflush)
continue; continue;
nsc->needflush = ISC_TRUE; nsc->needflush = ISC_TRUE;
result = dns_view_flushcache(nsc->primaryview, ISC_FALSE); result = dns_view_flushcache2(nsc->primaryview, ISC_FALSE);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
flushed = ISC_FALSE; flushed = ISC_FALSE;
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
@@ -10912,7 +11000,7 @@ named_server_flushcache(named_server_t *server, isc_lex_t *lex) {
nsc = ISC_LIST_NEXT(nsc, link)) { nsc = ISC_LIST_NEXT(nsc, link)) {
if (!nsc->needflush || nsc->cache != view->cache) if (!nsc->needflush || nsc->cache != view->cache)
continue; continue;
result = dns_view_flushcache(view, ISC_TRUE); result = dns_view_flushcache2(view, ISC_TRUE);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
flushed = ISC_FALSE; flushed = ISC_FALSE;
isc_log_write(named_g_lctx, isc_log_write(named_g_lctx,
@@ -10985,7 +11073,8 @@ named_server_flushnode(named_server_t *server, isc_lex_t *lex,
strlcpy(target, ptr, DNS_NAME_FORMATSIZE); strlcpy(target, ptr, DNS_NAME_FORMATSIZE);
isc_buffer_constinit(&b, target, strlen(target)); isc_buffer_constinit(&b, target, strlen(target));
isc_buffer_add(&b, strlen(target)); isc_buffer_add(&b, strlen(target));
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL); result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
@@ -11210,7 +11299,8 @@ delete_keynames(dns_tsig_keyring_t *ring, char *target,
dns_tsigkey_t *tkey; dns_tsigkey_t *tkey;
dns_name_init(&foundname, NULL); dns_name_init(&foundname, NULL);
origin = dns_fixedname_initname(&fixedorigin); dns_fixedname_init(&fixedorigin);
origin = dns_fixedname_name(&fixedorigin);
again: again:
dns_rbtnodechain_init(&chain, ring->mctx); dns_rbtnodechain_init(&chain, ring->mctx);
@@ -11328,7 +11418,8 @@ list_keynames(dns_view_t *view, dns_tsig_keyring_t *ring, isc_buffer_t **text,
viewname = "(global)"; viewname = "(global)";
dns_name_init(&foundname, NULL); dns_name_init(&foundname, NULL);
origin = dns_fixedname_initname(&fixedorigin); dns_fixedname_init(&fixedorigin);
origin = dns_fixedname_name(&fixedorigin);
dns_rbtnodechain_init(&chain, ring->mctx); dns_rbtnodechain_init(&chain, ring->mctx);
result = dns_rbtnodechain_first(&chain, ring->keys, &foundname, result = dns_rbtnodechain_first(&chain, ring->keys, &foundname,
origin); origin);
@@ -11532,7 +11623,7 @@ named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text) {
view != NULL; view != NULL;
view = ISC_LIST_NEXT(view, link)) { view = ISC_LIST_NEXT(view, link)) {
result = dns_zt_apply(view->zonetable, ISC_FALSE, result = dns_zt_apply(view->zonetable, ISC_FALSE,
NULL, synczone, &cleanup); synczone, &cleanup);
if (result != ISC_R_SUCCESS && if (result != ISC_R_SUCCESS &&
tresult == ISC_R_SUCCESS) tresult == ISC_R_SUCCESS)
tresult = result; tresult = result;
@@ -12273,7 +12364,8 @@ migrate_nzf(dns_view_t *view) {
/* Normalize zone name */ /* Normalize zone name */
isc_buffer_constinit(&b, origin, strlen(origin)); isc_buffer_constinit(&b, origin, strlen(origin));
isc_buffer_add(&b, strlen(origin)); isc_buffer_add(&b, strlen(origin));
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
CHECK(dns_name_fromtext(name, &b, dns_rootname, CHECK(dns_name_fromtext(name, &b, dns_rootname,
DNS_NAME_DOWNCASE, NULL)); DNS_NAME_DOWNCASE, NULL));
dns_name_format(name, zname, sizeof(zname)); dns_name_format(name, zname, sizeof(zname));
@@ -12485,7 +12577,8 @@ delete_zoneconf(dns_view_t *view, cfg_parser_t *pctx,
DE_CONST(&zl->value.list, list); DE_CONST(&zl->value.list, list);
myname = dns_fixedname_initname(&myfixed); dns_fixedname_init(&myfixed);
myname = dns_fixedname_name(&myfixed);
for (elt = ISC_LIST_HEAD(*list); for (elt = ISC_LIST_HEAD(*list);
elt != NULL; elt != NULL;
@@ -12962,7 +13055,8 @@ named_server_changezone(named_server_t *server, char *command,
isc_buffer_constinit(&buf, zonename, strlen(zonename)); isc_buffer_constinit(&buf, zonename, strlen(zonename));
isc_buffer_add(&buf, strlen(zonename)); isc_buffer_add(&buf, strlen(zonename));
dnsname = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
dnsname = dns_fixedname_name(&fname);
CHECK(dns_name_fromtext(dnsname, &buf, dns_rootname, 0, NULL)); CHECK(dns_name_fromtext(dnsname, &buf, dns_rootname, 0, NULL));
if (redirect) { if (redirect) {
@@ -13340,8 +13434,10 @@ find_name_in_list_from_map(const cfg_obj_t *config,
isc_result_t result; isc_result_t result;
if (strcmp(map_key_for_list, "zone") == 0) { if (strcmp(map_key_for_list, "zone") == 0) {
name1 = dns_fixedname_initname(&fixed1); dns_fixedname_init(&fixed1);
name2 = dns_fixedname_initname(&fixed2); dns_fixedname_init(&fixed2);
name1 = dns_fixedname_name(&fixed1);
name2 = dns_fixedname_name(&fixed2);
result = dns_name_fromstring(name1, name, 0, NULL); result = dns_name_fromstring(name1, name, 0, NULL);
RUNTIME_CHECK(result == ISC_R_SUCCESS); RUNTIME_CHECK(result == ISC_R_SUCCESS);
} }
@@ -13528,7 +13624,7 @@ generate_salt(unsigned char *salt, size_t saltlen) {
if (saltlen > 256U) if (saltlen > 256U)
return (ISC_R_RANGE); return (ISC_R_RANGE);
isc_random_buf(salt, saltlen); isc_rng_randombytes(named_g_server->sctx->rngctx, salt, saltlen);
r.base = salt; r.base = salt;
r.length = (unsigned int) saltlen; r.length = (unsigned int) saltlen;
@@ -13773,8 +13869,7 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex,
const char *type, *file; const char *type, *file;
char zonename[DNS_NAME_FORMATSIZE]; char zonename[DNS_NAME_FORMATSIZE];
isc_uint32_t serial, signed_serial, nodes; isc_uint32_t serial, signed_serial, nodes;
char serbuf[16], sserbuf[16], nodebuf[16]; char serbuf[16], sserbuf[16], nodebuf[16], resignbuf[512];
char resignbuf[DNS_NAME_FORMATSIZE + DNS_RDATATYPE_FORMATSIZE + 2];
char lbuf[ISC_FORMATHTTPTIMESTAMP_SIZE]; char lbuf[ISC_FORMATHTTPTIMESTAMP_SIZE];
char xbuf[ISC_FORMATHTTPTIMESTAMP_SIZE]; char xbuf[ISC_FORMATHTTPTIMESTAMP_SIZE];
char rbuf[ISC_FORMATHTTPTIMESTAMP_SIZE]; char rbuf[ISC_FORMATHTTPTIMESTAMP_SIZE];
@@ -13843,18 +13938,10 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex,
} }
/* Serial number */ /* Serial number */
result = dns_zone_getserial(mayberaw, &serial); serial = dns_zone_getserial(mayberaw);
/* XXXWPK TODO this is to mirror old behavior with dns_zone_getserial */
if (result != ISC_R_SUCCESS) {
serial = 0;
}
snprintf(serbuf, sizeof(serbuf), "%u", serial); snprintf(serbuf, sizeof(serbuf), "%u", serial);
if (hasraw) { if (hasraw) {
result = dns_zone_getserial(zone, &signed_serial); signed_serial = dns_zone_getserial(zone);
/* XXXWPK TODO ut supra */
if (result != ISC_R_SUCCESS) {
serial = 0;
}
snprintf(sserbuf, sizeof(sserbuf), "%u", signed_serial); snprintf(sserbuf, sizeof(sserbuf), "%u", signed_serial);
} }
@@ -13912,7 +13999,8 @@ named_server_zonestatus(named_server_t *server, isc_lex_t *lex,
dns_rdataset_t next; dns_rdataset_t next;
dns_rdataset_init(&next); dns_rdataset_init(&next);
name = dns_fixedname_initname(&fixed); dns_fixedname_init(&fixed);
name = dns_fixedname_name(&fixed);
result = dns_db_getsigningtime(db, &next, name); result = dns_db_getsigningtime(db, &next, name);
if (result == ISC_R_SUCCESS) { if (result == ISC_R_SUCCESS) {
@@ -14094,7 +14182,8 @@ named_server_nta(named_server_t *server, isc_lex_t *lex,
UNUSED(force); UNUSED(force);
fname = dns_fixedname_initname(&fn); dns_fixedname_init(&fn);
fname = dns_fixedname_name(&fn);
/* Skip the command name. */ /* Skip the command name. */
ptr = next_token(lex, text); ptr = next_token(lex, text);
+27 -46
View File
@@ -100,7 +100,7 @@ user_zonetype( dns_zone_t *zone ) {
}; };
const struct zt *tp; const struct zt *tp;
if ((dns_zone_getoptions(zone) & DNS_ZONEOPT_AUTOEMPTY) != 0) if ((dns_zone_getoptions2(zone) & DNS_ZONEOPT2_AUTOEMPTY) != 0)
return ("builtin"); return ("builtin");
view = dns_zone_getview(zone); view = dns_zone_getview(zone);
@@ -1494,7 +1494,7 @@ zone_xmlrender(dns_zone_t *zone, void *arg) {
TRY0(xmlTextWriterEndElement(writer)); /* type */ TRY0(xmlTextWriterEndElement(writer)); /* type */
TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "serial")); TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "serial"));
if (dns_zone_getserial(zone, &serial) == ISC_R_SUCCESS) if (dns_zone_getserial2(zone, &serial) == ISC_R_SUCCESS)
TRY0(xmlTextWriterWriteFormatString(writer, "%u", serial)); TRY0(xmlTextWriterWriteFormatString(writer, "%u", serial));
else else
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR "-")); TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR "-"));
@@ -1916,7 +1916,7 @@ generatexml(named_server_t *server, isc_uint32_t flags,
TRY0(xmlTextWriterStartElement(writer, TRY0(xmlTextWriterStartElement(writer,
ISC_XMLCHAR "zones")); ISC_XMLCHAR "zones"));
result = dns_zt_apply(view->zonetable, ISC_TRUE, result = dns_zt_apply(view->zonetable, ISC_TRUE,
NULL, zone_xmlrender, writer); zone_xmlrender, writer);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto error; goto error;
TRY0(xmlTextWriterEndElement(writer)); /* /zones */ TRY0(xmlTextWriterEndElement(writer)); /* /zones */
@@ -2271,7 +2271,7 @@ zone_jsonrender(dns_zone_t *zone, void *arg) {
dns_rdataclass_format(rdclass, classbuf, sizeof(classbuf)); dns_rdataclass_format(rdclass, classbuf, sizeof(classbuf));
class_only = classbuf; class_only = classbuf;
if (dns_zone_getserial(zone, &serial) != ISC_R_SUCCESS) if (dns_zone_getserial2(zone, &serial) != ISC_R_SUCCESS)
zoneobj = addzone(zone_name_only, class_only, zoneobj = addzone(zone_name_only, class_only,
user_zonetype(zone), 0, ISC_FALSE); user_zonetype(zone), 0, ISC_FALSE);
else else
@@ -2609,10 +2609,8 @@ generatejson(named_server_t *server, size_t *msglen,
CHECKMEM(za); CHECKMEM(za);
if ((flags & STATS_JSON_ZONES) != 0) { if ((flags & STATS_JSON_ZONES) != 0) {
result = dns_zt_apply(view->zonetable, result = dns_zt_apply(view->zonetable, ISC_TRUE,
ISC_TRUE, zone_jsonrender, za);
NULL, zone_jsonrender,
za);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
goto error; goto error;
} }
@@ -3106,7 +3104,6 @@ render_xsl(const char *url, isc_httpdurl_t *urlinfo,
isc_httpdfree_t **freecb, void **freecb_args) isc_httpdfree_t **freecb, void **freecb_args)
{ {
isc_result_t result; isc_result_t result;
char *_headers = NULL;
UNUSED(url); UNUSED(url);
UNUSED(querystring); UNUSED(querystring);
@@ -3118,45 +3115,30 @@ render_xsl(const char *url, isc_httpdurl_t *urlinfo,
if (urlinfo->isstatic) { if (urlinfo->isstatic) {
isc_time_t when; isc_time_t when;
char *line, *saveptr; char *p = strcasestr(headers, "If-Modified-Since: ");
const char *if_modified_since = "If-Modified-Since: ";
_headers = strdup(headers);
if (_headers == NULL) { if (p != NULL) {
goto send; time_t t1, t2;
} p += strlen("If-Modified-Since: ");
result = isc_time_parsehttptimestamp(p, &when);
if (result != ISC_R_SUCCESS)
goto send;
saveptr = NULL; result = isc_time_secondsastimet(&when, &t1);
for (line = strtok_r(_headers, "\n", &saveptr); if (result != ISC_R_SUCCESS)
line; goto send;
line = strtok_r(NULL, "\n", &saveptr)) {
if (strncasecmp(line, if_modified_since,
strlen(if_modified_since)) == 0) {
time_t t1, t2;
line += strlen(if_modified_since);
result = isc_time_parsehttptimestamp(line, &when);
if (result != ISC_R_SUCCESS) {
goto send;
}
result = isc_time_secondsastimet(&when, &t1); result = isc_time_secondsastimet(&urlinfo->loadtime,
if (result != ISC_R_SUCCESS) { &t2);
goto send; if (result != ISC_R_SUCCESS)
} goto send;
result = isc_time_secondsastimet(&urlinfo->loadtime, &t2); if (t1 < t2)
if (result != ISC_R_SUCCESS) { goto send;
goto send;
}
if (t1 < t2) { *retcode = 304;
goto send; *retmsg = "Not modified";
} return (ISC_R_SUCCESS);
*retcode = 304;
*retmsg = "Not modified";
goto end;
}
} }
} }
@@ -3165,8 +3147,7 @@ render_xsl(const char *url, isc_httpdurl_t *urlinfo,
*retmsg = "OK"; *retmsg = "OK";
isc_buffer_reinit(b, xslmsg, strlen(xslmsg)); isc_buffer_reinit(b, xslmsg, strlen(xslmsg));
isc_buffer_add(b, strlen(xslmsg)); isc_buffer_add(b, strlen(xslmsg));
end:
free(_headers);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }
@@ -3196,7 +3177,7 @@ client_ok(const isc_sockaddr_t *fromaddr, void *arg) {
isc_netaddr_fromsockaddr(&netaddr, fromaddr); isc_netaddr_fromsockaddr(&netaddr, fromaddr);
LOCK(&listener->lock); LOCK(&listener->lock);
if (dns_acl_match(&netaddr, NULL, NULL, 0, NULL, listener->acl, env, if (dns_acl_match(&netaddr, NULL, listener->acl, env,
&match, NULL) == ISC_R_SUCCESS && match > 0) &match, NULL) == ISC_R_SUCCESS && match > 0)
{ {
UNLOCK(&listener->lock); UNLOCK(&listener->lock);
+9 -5
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: tkeyconf.c,v 1.33 2010/12/20 23:47:20 tbox Exp $ */
/*! \file */ /*! \file */
@@ -45,7 +46,7 @@
isc_result_t isc_result_t
named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx, named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
dns_tkeyctx_t **tctxp) isc_entropy_t *ectx, dns_tkeyctx_t **tctxp)
{ {
isc_result_t result; isc_result_t result;
dns_tkeyctx_t *tctx = NULL; dns_tkeyctx_t *tctx = NULL;
@@ -57,7 +58,7 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
const cfg_obj_t *obj; const cfg_obj_t *obj;
int type; int type;
result = dns_tkeyctx_create(mctx, &tctx); result = dns_tkeyctx_create(mctx, ectx, &tctx);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
return (result); return (result);
@@ -68,7 +69,8 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
n = cfg_obj_asuint32(cfg_tuple_get(obj, "keyid")); n = cfg_obj_asuint32(cfg_tuple_get(obj, "keyid"));
isc_buffer_constinit(&b, s, strlen(s)); isc_buffer_constinit(&b, s, strlen(s));
isc_buffer_add(&b, strlen(s)); isc_buffer_add(&b, strlen(s));
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL)); RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
type = DST_TYPE_PUBLIC|DST_TYPE_PRIVATE|DST_TYPE_KEY; type = DST_TYPE_PUBLIC|DST_TYPE_PRIVATE|DST_TYPE_KEY;
RETERR(dst_key_fromfile(name, (dns_keytag_t) n, DNS_KEYALG_DH, RETERR(dst_key_fromfile(name, (dns_keytag_t) n, DNS_KEYALG_DH,
@@ -81,7 +83,8 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
s = cfg_obj_asstring(obj); s = cfg_obj_asstring(obj);
isc_buffer_constinit(&b, s, strlen(s)); isc_buffer_constinit(&b, s, strlen(s));
isc_buffer_add(&b, strlen(s)); isc_buffer_add(&b, strlen(s));
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL)); RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
tctx->domain = isc_mem_get(mctx, sizeof(dns_name_t)); tctx->domain = isc_mem_get(mctx, sizeof(dns_name_t));
if (tctx->domain == NULL) { if (tctx->domain == NULL) {
@@ -99,7 +102,8 @@ named_tkeyctx_fromconfig(const cfg_obj_t *options, isc_mem_t *mctx,
isc_buffer_constinit(&b, s, strlen(s)); isc_buffer_constinit(&b, s, strlen(s));
isc_buffer_add(&b, strlen(s)); isc_buffer_add(&b, strlen(s));
name = dns_fixedname_initname(&fname); dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL)); RETERR(dns_name_fromtext(name, &b, dns_rootname, 0, NULL));
RETERR(dst_gssapi_acquirecred(name, ISC_FALSE, &tctx->gsscred)); RETERR(dst_gssapi_acquirecred(name, ISC_FALSE, &tctx->gsscred));
} }
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: tsigconf.c,v 1.35 2011/01/11 23:47:12 tbox Exp $ */
/*! \file */ /*! \file */
+3 -1
View File
@@ -7,6 +7,8 @@
# See the COPYRIGHT file distributed with this work for additional # See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership. # information regarding copyright ownership.
# $Id: Makefile.in,v 1.15 2011/03/10 23:47:49 tbox Exp $
srcdir = @srcdir@ srcdir = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
@@ -17,7 +19,7 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/../include \
${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} \ ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} \
${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@ ${DNS_INCLUDES} ${ISC_INCLUDES} @DST_OPENSSL_INC@
CDEFINES = CDEFINES = @CRYPTO@
CWARNINGS = CWARNINGS =
OBJS = os.@O@ dlz_dlopen_driver.@O@ OBJS = os.@O@ dlz_dlopen_driver.@O@
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id$ */
#include <config.h> #include <config.h>
+19 -7
View File
@@ -1003,24 +1003,36 @@ named_os_gethostname(char *buf, size_t len) {
return ((n == 0) ? ISC_R_SUCCESS : ISC_R_FAILURE); return ((n == 0) ? ISC_R_SUCCESS : ISC_R_FAILURE);
} }
static char *
next_token(char **stringp, const char *delim) {
char *res;
do {
res = strsep(stringp, delim);
if (res == NULL)
break;
} while (*res == '\0');
return (res);
}
void void
named_os_shutdownmsg(char *command, isc_buffer_t *text) { named_os_shutdownmsg(char *command, isc_buffer_t *text) {
char *last, *ptr; char *input, *ptr;
pid_t pid; pid_t pid;
input = command;
/* Skip the command name. */ /* Skip the command name. */
if ((ptr = strtok_r(command, " \t", &last)) == NULL) { ptr = next_token(&input, " \t");
if (ptr == NULL)
return; return;
}
if ((ptr = strtok_r(NULL, " \t", &last)) == NULL) { ptr = next_token(&input, " \t");
if (ptr == NULL)
return; return;
}
if (strcmp(ptr, "-p") != 0) { if (strcmp(ptr, "-p") != 0)
return; return;
}
#ifdef HAVE_LINUXTHREADS #ifdef HAVE_LINUXTHREADS
pid = mainpid; pid = mainpid;
+1
View File
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: dlz_dlopen_driver.c,v 1.5 2011/10/14 00:52:32 marka Exp $ */
#include <config.h> #include <config.h>
@@ -9,6 +9,7 @@
* information regarding copyright ownership. * information regarding copyright ownership.
*/ */
/* $Id: ntservice.h,v 1.6 2007/06/19 23:46:59 tbox Exp $ */
#ifndef NTSERVICE_H #ifndef NTSERVICE_H
#define NTSERVICE_H #define NTSERVICE_H

Some files were not shown because too many files have changed in this diff Show More