dnssec-settime.c revision 53c22b8e0da67ca756ca309d5f84db9c189cd0a2
/*
* Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
*
* 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* $Id: dnssec-settime.c,v 1.13 2009/09/23 16:01:56 each Exp $ */
/*! \file */
#include <config.h>
#include <libgen.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <time.h>
#include <isc/commandline.h>
#include <dns/keyvalues.h>
#include "dnssectool.h"
const char *program = "dnssec-settime";
int verbose;
static void
usage(void) {
"keys\n");
"publication date\n");
"activation date\n");
"revocation date\n");
"inactivation date\n");
"deletion date\n");
"value or values "
"[default: all]\n");
"format\n");
"K<name>+<alg>+<new id>.private\n");
exit (-1);
}
static void
{
if (result == ISC_R_NOTFOUND) {
} else if (epoch) {
} else {
}
}
int
char newname[1024];
char keystr[KEY_FORMATSIZE];
char *endp, *p;
int ch;
if (argc == 1)
usage();
if (result != ISC_R_SUCCESS)
fatal("Out of memory");
"fK:uhp:v:P:A:R:I:D:")) != -1) {
switch (ch) {
case 'f':
break;
case 'p':
if (!strcasecmp(p, "all")) {
break;
}
do {
switch (*p++) {
case 'C':
break;
case 'P':
break;
case 'A':
break;
case 'R':
break;
case 'I':
break;
case 'D':
break;
case ' ':
break;
default:
usage();
break;
}
} while (*p != '\0');
break;
case 'u':
break;
case 'K':
/*
* We don't have to copy it here, but do it to
* simplify cleanup later
*/
fatal("Failed to allocate memory for "
"directory");
}
break;
case 'v':
if (*endp != '\0')
fatal("-v must be followed by a number");
break;
case 'P':
fatal("-P specified more than once");
} else {
}
break;
case 'A':
fatal("-A specified more than once");
} else {
}
break;
case 'R':
fatal("-R specified more than once");
} else {
}
break;
case 'I':
if (setinact || unsetinact)
fatal("-I specified more than once");
} else {
}
break;
case 'D':
fatal("-D specified more than once");
} else {
}
break;
case '?':
if (isc_commandline_option != '?')
/* Falls into */
case 'h':
usage();
default:
exit(1);
}
}
fatal("The key file name was not specified");
fatal("Extraneous arguments");
} else {
}
if (result != ISC_R_SUCCESS)
fatal("Could not initialize hash");
if (result != ISC_R_SUCCESS)
fatal("Could not initialize dst");
if (result != ISC_R_SUCCESS)
fatal("Invalid keyfile %s: %s",
if (!dst_key_isprivate(key))
/* Is this an old-style key? */
if (forceupdate) {
/*
* Updating to new-style key: set
* Private-key-format to 1.3
*/
} else
fatal("Incompatible key %s, "
"use -f to force update.", keystr);
}
if (verbose > 2)
/*
* Set time values.
*/
if (setpub)
else if (unsetpub)
if (setact)
else if (unsetact)
if (setrev) {
"revoked; changing the revocation date "
"will not affect this.\n",
"a KSK, but -R was used. Revoking a "
"ZSK is legal, but undefined.\n",
} else if (unsetrev) {
"revoked; removing the revocation date "
"will not affect this.\n",
}
if (setinact)
else if (unsetinact)
if (setdel)
else if (unsetdel)
/*
* Print out time values, if -p was used.
*/
if (printcreate)
if (printpub)
if (printact)
if (printrev)
if (printinact)
if (printdel)
if (changed) {
&buf);
if (result != ISC_R_SUCCESS) {
fatal("Failed to build public key filename: %s",
}
if (result != ISC_R_SUCCESS) {
}
&buf);
if (result != ISC_R_SUCCESS) {
fatal("Failed to build private key filename: %s",
}
}
dst_key_free(&key);
if (verbose > 10)
return (0);
}