[Opendnssec-user] Maximum key generation interval on 64-bit systems

Klaus Darilion klaus.mailinglists at pernau.at
Wed Jul 17 09:32:52 UTC 2013


> In the end it seems that a feature request is necessary, e.g. an option
> to ignore the the zonelist but specify the number of zones on the
> command line, e.g.:
>
>    ods-ksmutil key generate --policy default \
>        --zonecount [number of zones to generate keys] \
>        --interval [PERIOD]

In the end I was eager and took a look at ksmutil. The patch rather 
simple, just do not count the zones in the zoneliste but specify it on 
the console.

Attached is the patch (against ods 1.3.9), feel free to use it (it would 
be nice if this feature is added to ODS).

regards
Klaus
-------------- next part --------------
--- ksmutil.c.neu2	2013-06-28 20:13:37.000000000 +0200
+++ ksmutil.c.zonecount	2013-07-17 10:20:22.000000000 +0200
@@ -111,6 +111,7 @@
 char *o_time = NULL;
 char *o_retire = NULL;
 char *o_zone = NULL;
+char *o_zonecount = NULL;
 char *o_keytag = NULL;
 static int all_flag = 0;
 static int ds_flag = 0;
@@ -3464,12 +3465,13 @@
         {"keytag",  required_argument, 0, 'x'},
         {"retire",  required_argument, 0, 'y'},
         {"zone",    required_argument, 0, 'z'},
+        {"zonecount", required_argument, 0, 'Z'},
         {0,0,0,0}
     };
 
     progname = argv[0];
 
-    while ((ch = getopt_long(argc, argv, "ab:c:de:fg:hi:k:n:o:p:r:s:t:vVw:x:y:z:", long_options, &option_index)) != -1) {
+    while ((ch = getopt_long(argc, argv, "ab:c:de:fg:hi:k:n:o:p:r:s:t:vVw:x:y:z:Z:", long_options, &option_index)) != -1) {
         switch (ch) {
             case 'a':
                 all_flag = 1;
@@ -3551,6 +3553,9 @@
 				}
 
                 break;
+            case 'Z':
+                o_zonecount = StrStrdup(optarg);
+                break;
             default:
                 usage();
                 exit(1);
@@ -6550,12 +6555,30 @@
         same_keys = 0;
     }
 
-    /* How many zones on this policy */ 
-    status = KsmZoneCountInit(&result, policy->id); 
-    if (status == 0) { 
-        status = KsmZoneCount(result, &zone_count); 
+    /* Check if number of zones are specified manually */
+    if (o_zonecount) {
+      if (StrIsDigits(o_zonecount)) {
+        status = StrStrtoi(o_zonecount, &zone_count);
+        if (status != 0) {
+            printf("Error: Unable to convert zonecount \"%s\"; to an integer\n", o_zonecount);
+            db_disconnect(lock_fd);
+            KsmPolicyFree(policy);
+            exit(1);
+        }
+      } else {
+          printf("Error: zonecount \"%s\"; should be numeric only\n", o_zonecount);
+          db_disconnect(lock_fd);
+          KsmPolicyFree(policy);
+          exit(1);
+      }
+    } else {
+      /* How many zones on this policy */ 
+      status = KsmZoneCountInit(&result, policy->id); 
+      if (status == 0) { 
+          status = KsmZoneCount(result, &zone_count); 
+      }
+      DbFreeResult(result); 
     } 
-    DbFreeResult(result); 
 
     if (status == 0) { 
         /* make sure that we have at least one zone */ 


More information about the Opendnssec-user mailing list