dnssec-signzone.c revision b9043a19e20ccf8871c5fc7626d0c7f14c20d541
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * Portions Copyright (C) 1999-2001 Internet Software Consortium.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * Portions Copyright (C) 1995-2000 by Network Associates, Inc.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * Permission to use, copy, modify, and distribute this software for any
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * purpose with or without fee is hereby granted, provided that the above
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * copyright notice and this permission notice appear in all copies.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM AND
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * NETWORK ASSOCIATES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM OR NETWORK
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * ASSOCIATES BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
28a8f5b0de57d269cf2845c69cb6abe18cbd3b3aMark Andrews * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt * PERFORMANCE OF THIS SOFTWARE.
ef421f66f47224a42073deaf087378c5d0c9952eEvan Hunt/* $Id: dnssec-signzone.c,v 1.149 2001/10/22 23:49:13 bwelling Exp $ */
a2ca594252024a7b26d2f6b1984cb6da6f5bd09cMark Andrews#define SIGNER_EVENTCLASS ISC_EVENTCLASS(0x4453)
a2ca594252024a7b26d2f6b1984cb6da6f5bd09cMark Andrews#define SIGNER_EVENT_WRITE (SIGNER_EVENTCLASS + 0)
a2ca594252024a7b26d2f6b1984cb6da6f5bd09cMark Andrews#define SIGNER_EVENT_WORK (SIGNER_EVENTCLASS + 1)
b4d8192d210290112e07b0e22b491c45c50ba696Evan Huntstatic unsigned int keycount = 0;
c3b9fad5e3be639c9b36ff0ac921c30133da395cMar Andrewsstatic isc_stdtime_t starttime = 0, endtime = 0, now;
0cfb24736841b3e98bb25853229a0efabab88bddEvan Huntstatic unsigned int nsigned = 0, nretained = 0, ndropped = 0;
dbb012765c735ee0d82dedb116cdc7cf18957814Evan Huntstatic unsigned int nverified = 0, nverifyfailed = 0;
215ef83bbed20727813a52ddcdbcd1455856638bMark Andrewsstatic const char *directory;
a920fb9dc2ff16f32dd73e53469d0febcdcc6c11Mark Andrewsstatic dns_dbversion_t *gversion; /* The database version */
a920fb9dc2ff16f32dd73e53469d0febcdcc6c11Mark Andrewsstatic dns_dbiterator_t *gdbiter; /* The database iterator */
a920fb9dc2ff16f32dd73e53469d0febcdcc6c11Mark Andrewsstatic dns_name_t *gorigin; /* The database origin */
a920fb9dc2ff16f32dd73e53469d0febcdcc6c11Mark Andrewsstatic dns_dbnode_t *gnode = NULL; /* The "current" database node */
9c03f13e18c1b0c32f62391a17300378605bbc7bEvan Huntstatic unsigned int ntasks = 0;
dbb012765c735ee0d82dedb116cdc7cf18957814Evan Huntstatic isc_boolean_t shuttingdown = ISC_FALSE, finished = ISC_FALSE;
5a75f61dd413720c16d229b24ebba6bd6ecdb738Evan Huntstatic inline void
dbb012765c735ee0d82dedb116cdc7cf18957814Evan Huntset_bit(unsigned char *array, unsigned int index, unsigned int bit) {
dbb012765c735ee0d82dedb116cdc7cf18957814Evan Hunt result = dns_master_dumpnodetostream(mctx, gdb, gversion, node, name,
ef9f4d097794609e018963087fab10a8b51d8ad1Mark Andrews check_result(result, "dns_master_dumpnodetostream");
e7857b5ee05414961bb11f9e57f654163fae6acbckbnewkeystruct(dst_key_t *dstkey, isc_boolean_t isdefault) {
7829fad4093f2c1985b1efb7cea00287ff015d2bckbsignwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dns_rdata_t *rdata,
ce376a81fa674d240197628ceb6113a4fa5a1ab3Mukund Sivaraman result = dns_dnssec_sign(name, rdataset, key, &starttime, &endtime,
b4d8192d210290112e07b0e22b491c45c50ba696Evan Hunt return (ISC_TF(dns_name_equal(dst_key_name(key->key), gorigin) &&
static signer_key_t *
return key;
return (NULL);
return (key);
static isc_boolean_t
switch (result) {
case ISC_R_SUCCESS:
case DNS_R_NXDOMAIN:
case DNS_R_NXRRSET:
return (ISC_TRUE);
case DNS_R_DELEGATION:
case DNS_R_CNAME:
case DNS_R_DNAME:
return (ISC_FALSE);
static inline isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
int arraysize;
if (!nosigs)
for (i = 0; i < arraysize; i++)
if (nosigs)
sigstr);
sigstr);
if (!expired)
} else if (!expired) {
if (keep) {
if (resign) {
isc_buffer_t b;
&tuple);
isc_buffer_t b;
static isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
isc_buffer_t b;
if (isc_buffer_availablelength(&b) == 0) {
isc_buffer_putuint8(&b, 0);
goto failure;
goto failure;
goto failure;
goto failure;
goto failure;
static isc_boolean_t
return (ISC_FALSE);
goto failure;
goto failure;
goto failure;
goto failure;
namestr);
goto failure;
return (found);
isc_buffer_t b;
static int warned = 0;
if (warned++ != 0)
program);
static isc_boolean_t
return (ISC_FALSE);
if (isdelegation) {
NULL);
namestr);
} else if (childkey) {
if (neednullkey)
goto skip;
goto skip;
if (isdelegation) {
goto skip;
if (!nokeys)
if (neednullkey)
skip:
static inline isc_boolean_t
if (!active)
if (!active) {
dns_rdatatype_nxt, 0);
return (active);
static inline isc_result_t
if (!active) {
return (result);
static inline isc_result_t
return (ISC_R_SUCCESS);
return (result);
static dns_ttl_t
soattl(void) {
return (ttl);
if (destroy) {
covers);
presign(void) {
postsign(void) {
static isc_result_t
goto out;
out:
return (result);
assigned++;
completed++;
isc_buffer_t b;
int len;
unsigned int nkeys, i;
for (i = 0; i < nkeys; i++) {
&pubkey);
goto next;
goto next;
next:
usage(void) {
exit(0);
removetempfile(void) {
if (removefile)
if (runtime_us > 0) {
int i, ch;
char *endp;
unsigned int eflags;
int tempfilelen;
switch (ch) {
usage();
if (!pseudorandom)
if (ntasks == 0)
usage();
if (argc == 0) {
for (i = 0; i < argc; i++) {
argv[i]);
program);
for (i = 0; i < (int)ntasks; i++) {
if (printstats)
presign();
(void)isc_app_run();
if (!finished)
for (i = 0; i < (int)ntasks; i++)
postsign();
if (printstats)
if (free_output)
(void) isc_app_finish();
if (printstats) {