dnssec-makekeyset.c revision a9bc95f22ef2dd4a12e79be99412c9f18b814a5d
/*
* Copyright (C) 1999, 2000 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 <stdlib.h>
#include <isc/commandline.h>
#include <dns/fixedname.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#define PROGRAM "dnssec-makekeyset"
#define BUFSIZE 2048
struct keynode {
};
static int ttl = -1;
static int verbose;
static void
exit(1);
}
static inline void
if (result != ISC_R_SUCCESS) {
exit(1);
}
}
/* Not thread-safe! */
static char *
isc_buffer_t b;
isc_region_t r;
static char data[1025];
isc_buffer_usedregion(&b, &r);
return (char *) r.base;
}
/* Not thread-safe! */
static char *
isc_buffer_t b;
isc_region_t r;
static char data[10];
isc_buffer_usedregion(&b, &r);
return (char *) r.base;
}
static isc_stdtime_t
char *endp = "";
if (str[0] == '+') {
}
}
else {
if (result != ISC_R_SUCCESS)
}
if (*endp != '\0')
return ((isc_stdtime_t) val);
}
static void
usage(void) {
"absolute|from start|from now (now + 30 days)\n");
exit(0);
}
int
int i, ch;
char *endp;
unsigned char *data;
isc_buffer_t b;
isc_region_t r;
if (result != ISC_R_SUCCESS)
fatal("failed to create memory context: %s",
{
switch (ch) {
case 's':
fatal("out of memory");
break;
case 'e':
fatal("out of memory");
break;
case 't':
if (*endp != '\0')
fatal("TTL must be numeric");
break;
case 'v':
if (*endp != '\0')
fatal("verbose level must be numeric");
break;
default:
usage();
}
}
if (argc < 1)
usage();
}
else
}
else
if (ttl == -1) {
ttl = 3600;
PROGRAM);
}
if (verbose > 0) {
== ISC_R_SUCCESS);
}
for (i = 0; i < argc; i++) {
int alg;
char namestr[1025];
if (result != ISC_R_SUCCESS)
fsavedname = fname;
}
else {
fatal("all keys must have the same owner - %s "
"and %s do not match",
}
fatal("out of memory");
}
if (result != ISC_R_SUCCESS)
fatal("%s is not a valid name: %s",
}
if (dst_key_iszonekey(key)) {
&zonekey);
if (result != ISC_R_SUCCESS)
fatal("failed to read key %s/%s/%d: %s",
fatal("out of memory");
}
fatal("out of memory");
fatal("out of memory");
if (result != ISC_R_SUCCESS)
fatal("failed to convert key %s/%s/%d "
"to a DNS KEY: %s",
isc_buffer_usedregion(&b, &r);
dns_rdatatype_key, &r);
dst_key_free(&key);
}
if (ISC_LIST_EMPTY(keylist))
"%s: no private zone key found; not self-signing\n",
PROGRAM);
{
fatal("out of memory");
fatal("out of memory");
rdata);
if (result != ISC_R_SUCCESS)
fatal("failed to sign keyset with key %s/%s/%d: %s",
}
if (result != ISC_R_SUCCESS)
if (!ISC_LIST_EMPTY(keylist))
NULL);
if (result != ISC_R_SUCCESS)
fatal("failed to write database for %s to %s",
dns_db_detach(&db);
}
}
while (!ISC_LIST_EMPTY(keylist)) {
}
return (0);
}