dnssec-signzone.c revision 86ff74ccf6d2892126752df452840aaedb90ff6a
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * Copyright (C) 1999 Internet Software Consortium.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * Permission to use, copy, modify, and distribute this software for any
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * purpose with or without fee is hereby granted, provided that the above
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * copyright notice and this permission notice appear in all copies.
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews#define is_zone_key(key) ((dst_key_flags(key) & DNS_KEYFLAG_OWNERMASK) \
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewstypedef struct signer_array_struct signer_array_t;
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic inline void
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsstatic inline void
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewscheck_result(isc_result_t result, char *message) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewsset_bit(unsigned char *array, unsigned int index, unsigned int bit) {
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrewssignwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dns_rdata_t *rdata,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews result = dns_dnssec_sign(name, rdataset, key, &start, &end,
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews /* Verify the data. This won't work if the start time is reset */
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews result = dns_dnssec_verify(name, rdataset, key, mctx, rdata);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews isc_buffer_init(&b, origin, sizeof(origin), ISC_BUFFERTYPE_BINARY);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews result = dns_name_totext(dns_db_origin(db), ISC_FALSE, &b);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews return (strcasecmp(dst_key_name(key->key), origin) == 0 &&
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews (dst_key_flags(key->key) & DNS_KEYFLAG_OWNERMASK) ==
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews isc_buffer_init(&b, keyname, sizeof(keyname), ISC_BUFFERTYPE_BINARY);
5c526acb82c882e41b655c31f5fa4425c87b671cMark Andrews result = dns_name_totext(&sig->signer, ISC_FALSE, &b);
return key;
return (NULL);
return key;
static isc_boolean_t
switch (result) {
case DNS_R_SUCCESS:
case DNS_R_NXDOMAIN:
case DNS_R_NXRDATASET:
return ISC_TRUE;
case DNS_R_DELEGATION:
case DNS_R_CNAME:
case DNS_R_DNAME:
return ISC_FALSE;
static isc_boolean_t
#define allocbufferandrdata \
isc_buffer_t b; \
if (!nosigs) {
if (!expired)
if (!expired &&
if (!expired &&
else if (!expired)
if (keep) {
&sig, &b);
else if (resign) {
if (wassignedby[i] != 0) {
else if (!nosigs) {
static isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
if (!atorigin) {
NULL);
goto skip;
goto skip;
if (isdelegation) {
case dns_rdatatype_nxt:
case dns_rdatatype_key:
goto skip;
goto skip;
unsigned char *nxt_bits;
skip:
static inline isc_boolean_t
if (!active)
if (!active) {
return (active);
static inline isc_result_t
if (!active) {
return (result);
&nextnode);
int len;
unsigned int nkeys, i;
for (i = 0; i < nkeys; i++) {
static isc_stdtime_t
usage() {
exit(0);
int i, ch;
char *endp;
int verbose = 0;
switch (ch) {
usage();
if (argc == 0) {
for (i = 0; i < argc; i++) {
*algstr++ = 0;
if (s != NULL) {
algstr = s;
alg = 0;
if (alg == 0)