signer.c revision 2637aa6ccd42281bce3b08a6069c56a50e791140
/*
* Copyright (C) 1999 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h> /* for getopt */
#include <isc/assertions.h>
#include <dns/fixedname.h>
#include <dns/dbiterator.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/keyvalues.h>
#define BUFSIZE 2048
typedef struct signer_key_struct signer_key_t;
typedef struct signer_array_struct signer_array_t;
struct signer_key_struct {
};
struct signer_array_struct {
};
int cycle = -1;
static inline void
exit(1);
}
static inline void
if (result != ISC_R_SUCCESS) {
exit(1);
}
}
static void
if (bit)
else
}
static void
{
#if 0
/* Verify the data. This won't work if the start time is reset */
#endif
}
static inline isc_boolean_t
}
static inline isc_boolean_t
char origin[1024];
isc_buffer_t b;
}
static signer_key_t *
char keyname[1024];
isc_buffer_t b;
return key;
}
if (result != ISC_R_SUCCESS)
return (NULL);
if (result == ISC_R_SUCCESS) {
}
else
return key;
}
static isc_boolean_t
unsigned int options = DNS_DBFIND_NOWILD;
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;
default:
return ISC_FALSE; /* removess a warning */
}
}
static isc_boolean_t
{
return (result == ISC_R_SUCCESS);
}
#define allocbufferandrdata \
isc_buffer_t b; \
static void
{
int i;
for (i = 0; i < 256; i++)
if (result == ISC_R_NOTFOUND) {
}
if (!nosigs) {
while (result == ISC_R_SUCCESS) {
; /* sig is dropped and not replaced */
; /* sig is dropped and not replaced */
if (!expired)
}
else if (issigningkey(key)) {
if (!expired &&
{
}
else {
}
}
if (!expired &&
{
}
else {
}
}
else if (!expired)
/* else sig has expired and we cannot regenerate it */
if (keep) {
&sig, &b);
}
else if (resign) {
}
}
if (result == DNS_R_NOMORE)
}
for (i = 0; i < 256; i++)
if (wassignedby[i] != 0) {
break;
}
{
}
}
else
if (result == DNS_R_UNCHANGED)
}
else if (!nosigs) {
/*
dns_db_deleterdataset(db, node, version, dns_rdatatype_sig,
set->type);
*/
}
}
}
}
static isc_boolean_t
while (result == ISC_R_SUCCESS) {
return (ISC_TRUE);
}
if (result != DNS_R_NOMORE)
return (ISC_FALSE);
}
static void
{
if (!atorigin) {
dns_rdatatype_ns, 0, 0, &nsset,
NULL);
/* Is this a delegation point? */
if (result == ISC_R_SUCCESS) {
}
}
while (result == ISC_R_SUCCESS) {
/* If this is a SIG set, skip it. */
goto skip;
/* If this is a KEY set at the apex, skip it. */
goto skip;
/*
* If this name is a delegation point, skip all records
* except a KEY set containing a NULL key or an NXT set.
*/
if (isdelegation) {
case dns_rdatatype_nxt:
break;
case dns_rdatatype_key:
if (hasnullkey(rdataset))
break;
goto skip;
default:
goto skip;
}
}
/*
* There probably should be a dns_nxtsetbit, but it can get
* complicated if we need to extend the length of the
* bit set. In this case, since the NXT bit is set and
* SIG < NXT, the easy way works.
*/
unsigned char *nxt_bits;
isc_region_t r, r2;
dns_rdata_toregion(&rdata, &r);
dns_name_fromregion(&nxtname, &r);
}
skip:
}
if (result != DNS_R_NOMORE)
fatal("rdataset iteration failed");
}
static inline isc_boolean_t
while (result == ISC_R_SUCCESS) {
if (!active)
else
}
if (result != DNS_R_NOMORE)
fatal("rdataset iteration failed");
if (!active) {
/*
* Make sure there is no NXT record for this node.
*/
if (result == DNS_R_UNCHANGED)
}
return (active);
}
static inline isc_result_t
{
do {
if (result == ISC_R_SUCCESS) {
if (!active) {
}
}
return (result);
}
static void
unsigned char curdata[1024];
while (result == ISC_R_SUCCESS) {
if (result == ISC_R_SUCCESS)
&nextnode);
if (result == ISC_R_SUCCESS)
else if (result == DNS_R_NOMORE)
else {
fatal("db iteration failed");
}
}
if (result != DNS_R_NOMORE)
fatal("db iteration failed");
}
static void
isc_buffer_t b, b2;
unsigned char namedata[1024];
int len;
isc_buffer_add(&b, len);
}
static void
int nkeys, i;
for (i = 0; i < nkeys; i++) {
}
}
static isc_stdtime_t
char *endp = "";
if (str[0] == '+') {
}
}
else {
}
if (*endp != '\0')
return ((isc_stdtime_t) val);
}
static void
usage() {
"(zonefile + .signed)\n");
exit(0);
}
int
int i, ch;
char *endp;
int verbose = 0;
extern char *optarg;
extern int optind;
switch (ch) {
case 's':
break;
case 'e':
break;
case 'c':
if (*endp != '\0')
break;
case 'v':
if (*endp != '\0')
break;
case 'o':
break;
case 'f':
break;
case 'h':
usage();
}
}
}
else
}
else
if (cycle == -1) {
}
if (argc < 1)
argc -= 1;
argv += 1;
}
}
if (argc == 0) {
}
}
else {
for (i = 0; i < argc; i++) {
*algstr++ = 0;
if (s != NULL) {
*s++ = 0;
algstr = s;
}
}
if (*endp != '\0')
if (*endp != '\0')
}
else
alg = 0;
{
if (!dst_key_isprivate(dkey))
"key specify");
if (alg == 0)
break;
}
}
"isc_mem_get");
}
else
printf("Ignoring key with algorithm 0\n");
}
}
/* should we update the SOA serial? */
dns_db_detach(&db);
}
return (0);
}