summaryrefslogtreecommitdiff
path: root/bin/dnssec/dnssec-keygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/dnssec/dnssec-keygen.c')
-rw-r--r--bin/dnssec/dnssec-keygen.c72
1 files changed, 27 insertions, 45 deletions
diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c
index 706182977e283..26504410db2e0 100644
--- a/bin/dnssec/dnssec-keygen.c
+++ b/bin/dnssec/dnssec-keygen.c
@@ -1,5 +1,5 @@
/*
- * Portions Copyright (C) 2004-2013 Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -29,8 +29,6 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dnssec-keygen.c,v 1.120 2011/11/30 00:48:51 marka Exp $ */
-
/*! \file */
#include <config.h>
@@ -142,6 +140,7 @@ usage(void) {
fprintf(stderr, " -m <memory debugging mode>:\n");
fprintf(stderr, " usage | trace | record | size | mctx\n");
fprintf(stderr, " -v <level>: set verbosity level (0 - 10)\n");
+ fprintf(stderr, " -V: print version information\n");
fprintf(stderr, "Timing options:\n");
fprintf(stderr, " -P date/[+-]offset/none: set key publication date "
"(default: now)\n");
@@ -257,7 +256,8 @@ main(int argc, char **argv) {
/*
* Process memory debugging argument first.
*/
-#define CMDLINE_FLAGS "3A:a:b:Cc:D:d:E:eFf:Gg:hI:i:K:kL:m:n:P:p:qR:r:S:s:T:t:v:"
+#define CMDLINE_FLAGS "3A:a:b:Cc:D:d:E:eFf:Gg:hI:i:K:kL:m:n:P:p:qR:r:S:s:T:t:" \
+ "v:V"
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
switch (ch) {
case 'm':
@@ -343,10 +343,7 @@ main(int argc, char **argv) {
"To generate a key with TYPE=KEY, use -T KEY.\n");
break;
case 'L':
- if (strcmp(isc_commandline_argument, "none") == 0)
- ttl = 0;
- else
- ttl = strtottl(isc_commandline_argument);
+ ttl = strtottl(isc_commandline_argument);
setttl = ISC_TRUE;
break;
case 'n':
@@ -403,61 +400,41 @@ main(int argc, char **argv) {
if (setpub || unsetpub)
fatal("-P specified more than once");
- if (strcasecmp(isc_commandline_argument, "none")) {
- setpub = ISC_TRUE;
- publish = strtotime(isc_commandline_argument,
- now, now);
- } else {
- unsetpub = ISC_TRUE;
- }
+ publish = strtotime(isc_commandline_argument,
+ now, now, &setpub);
+ unsetpub = !setpub;
break;
case 'A':
if (setact || unsetact)
fatal("-A specified more than once");
- if (strcasecmp(isc_commandline_argument, "none")) {
- setact = ISC_TRUE;
- activate = strtotime(isc_commandline_argument,
- now, now);
- } else {
- unsetact = ISC_TRUE;
- }
+ activate = strtotime(isc_commandline_argument,
+ now, now, &setact);
+ unsetact = !setact;
break;
case 'R':
if (setrev || unsetrev)
fatal("-R specified more than once");
- if (strcasecmp(isc_commandline_argument, "none")) {
- setrev = ISC_TRUE;
- revoke = strtotime(isc_commandline_argument,
- now, now);
- } else {
- unsetrev = ISC_TRUE;
- }
+ revoke = strtotime(isc_commandline_argument,
+ now, now, &setrev);
+ unsetrev = !setrev;
break;
case 'I':
if (setinact || unsetinact)
fatal("-I specified more than once");
- if (strcasecmp(isc_commandline_argument, "none")) {
- setinact = ISC_TRUE;
- inactive = strtotime(isc_commandline_argument,
- now, now);
- } else {
- unsetinact = ISC_TRUE;
- }
+ inactive = strtotime(isc_commandline_argument,
+ now, now, &setinact);
+ unsetinact = !setinact;
break;
case 'D':
if (setdel || unsetdel)
fatal("-D specified more than once");
- if (strcasecmp(isc_commandline_argument, "none")) {
- setdel = ISC_TRUE;
- delete = strtotime(isc_commandline_argument,
- now, now);
- } else {
- unsetdel = ISC_TRUE;
- }
+ delete = strtotime(isc_commandline_argument,
+ now, now, &setdel);
+ unsetdel = !setdel;
break;
case 'S':
predecessor = isc_commandline_argument;
@@ -474,8 +451,13 @@ main(int argc, char **argv) {
program, isc_commandline_option);
/* FALLTHROUGH */
case 'h':
+ /* Does not return. */
usage();
+ case 'V':
+ /* Does not return. */
+ version(program);
+
default:
fprintf(stderr, "%s: unhandled option -%c\n",
program, isc_commandline_option);
@@ -936,9 +918,9 @@ main(int argc, char **argv) {
if (setpub)
dst_key_settime(key, DST_TIME_PUBLISH, publish);
- else if (setact)
+ else if (setact && !unsetpub)
dst_key_settime(key, DST_TIME_PUBLISH,
- activate);
+ activate - prepub);
else if (!genonly && !unsetpub)
dst_key_settime(key, DST_TIME_PUBLISH, now);