]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Teach dnssec-settime to read unset times that it writes
authorTony Finch <fanf@isc.org>
Tue, 17 May 2022 12:13:57 +0000 (14:13 +0200)
committerTony Finch <fanf@isc.org>
Mon, 23 May 2022 13:15:10 +0000 (15:15 +0200)
When there is no time in a key file, `dnssec-settime` will print
"UNSET", but to unset a time the user must specify "none" or "never".
This change allows "unset" or "UNSET" as well as "none" or "never".
The "UNSET" output remains the same to avoid compatibility problems
with wrapper scripts.

I have also re-synchronized the "Timing Options" sections of the man
pages.

(cherry picked from commit 4c96efac5c3df764dc19c0855b0824d553324b96)

CHANGES
bin/dnssec/dnssec-importkey.rst
bin/dnssec/dnssec-keyfromlabel.rst
bin/dnssec/dnssec-keygen.rst
bin/dnssec/dnssec-settime.rst
bin/dnssec/dnssectool.c
bin/tests/system/metadata/tests.sh
doc/man/dnssec-importkey.1in
doc/man/dnssec-keyfromlabel.1in
doc/man/dnssec-keygen.1in
doc/man/dnssec-settime.1in

diff --git a/CHANGES b/CHANGES
index b4033eb1ce16d28996128e59a61f39bd69a1e70c..727e1e6301a5287a34742ec2805d6eee14ec5346 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+5891.  [func]          Key timing options for `dnssec-settime` and related
+                       utilities now accept "UNSET" times as printed by
+                       `dnssec-settime -p`. [GL #3361]
+
 5890.  [bug]           When the fetches-per-server quota was adjusted
                        because of an authoritative server timing out more
                        or less frequently, it was incorrectly set to 1
index d79b61112390081cc6832e075fabe1be8efdd50c..8f6a6b3a11c5b62e1c301bac077294ac0eaa9cc3 100644 (file)
@@ -80,14 +80,24 @@ Options
 Timing Options
 ~~~~~~~~~~~~~~
 
-Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS. If the
-argument begins with a ``+`` or ``-``, it is interpreted as an offset from
-the present time. For convenience, if such an offset is followed by one
-of the suffixes ``y``, ``mo``, ``w``, ``d``, ``h``, or ``mi``, then the offset is
-computed in years (defined as 365 24-hour days, ignoring leap years),
-months (defined as 30 24-hour days), weeks, days, hours, or minutes,
-respectively. Without a suffix, the offset is computed in seconds. To
-explicitly prevent a date from being set, use ``none`` or ``never``.
+Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS.
+(which is the format used inside key files),
+or 'Day Mon DD HH:MM:SS YYYY' (as printed by ``dnssec-settime -p``),
+or UNIX epoch time (as printed by ``dnssec-settime -up``),
+or the literal ``now``.
+
+The argument can be followed by ``+`` or ``-`` and an offset from the
+given time. The literal ``now`` can be omitted before an offset. The
+offset can be followed by one of the suffixes ``y``, ``mo``, ``w``,
+``d``, ``h``, or ``mi``, so that it is computed in years (defined as
+365 24-hour days, ignoring leap years), months (defined as 30 24-hour
+days), weeks, days, hours, or minutes, respectively. Without a suffix,
+the offset is computed in seconds.
+
+To explicitly prevent a date from being set, use ``none``, ``never``,
+or ``unset``.
+
+All these formats are case-insensitive.
 
 .. option:: -P date/offset
 
index 1178213b1c3855cbb3bca3cdb293fd6d249394b4..2b9cb488f7ad309f9ed0934cb99847e0832a581a 100644 (file)
@@ -178,14 +178,24 @@ Options
 Timing Options
 ~~~~~~~~~~~~~~
 
-Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS. If the
-argument begins with a ``+`` or ``-``, it is interpreted as an offset from
-the present time. For convenience, if such an offset is followed by one
-of the suffixes ``y``, ``mo``, ``w``, ``d``, ``h``, or ``mi``, then the offset is
-computed in years (defined as 365 24-hour days, ignoring leap years),
-months (defined as 30 24-hour days), weeks, days, hours, or minutes,
-respectively. Without a suffix, the offset is computed in seconds. To
-explicitly prevent a date from being set, use ``none`` or ``never``.
+Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS
+(which is the format used inside key files),
+or 'Day Mon DD HH:MM:SS YYYY' (as printed by ``dnssec-settime -p``),
+or UNIX epoch time (as printed by ``dnssec-settime -up``),
+or the literal ``now``.
+
+The argument can be followed by ``+`` or ``-`` and an offset from the
+given time. The literal ``now`` can be omitted before an offset. The
+offset can be followed by one of the suffixes ``y``, ``mo``, ``w``,
+``d``, ``h``, or ``mi``, so that it is computed in years (defined as
+365 24-hour days, ignoring leap years), months (defined as 30 24-hour
+days), weeks, days, hours, or minutes, respectively. Without a suffix,
+the offset is computed in seconds.
+
+To explicitly prevent a date from being set, use ``none``, ``never``,
+or ``unset``.
+
+All these formats are case-insensitive.
 
 .. option:: -P date/offset
 
index 995170ab07aceedde3df1d88edce226f4a267d35..3e659659ab4dbc9283aedf5ff2042d3a3215fe01 100644 (file)
@@ -227,15 +227,15 @@ or 'Day Mon DD HH:MM:SS YYYY' (as printed by ``dnssec-settime -p``),
 or UNIX epoch time (as printed by ``dnssec-settime -up``),
 or the literal ``now``.
 
-The argument can be followed by '+' or '-' and an offset from the
+The argument can be followed by ``+`` or ``-`` and an offset from the
 given time. The literal ``now`` can be omitted before an offset. The
-offset can be followed by one of the suffixes 'y', 'mo', 'w', 'd',
-'h', or 'mi', so that it is computed in years (defined as 365 24-hour
-days, ignoring leap years), months (defined as 30 24-hour days),
-weeks, days, hours, or minutes, respectively. Without a suffix, the
-offset is computed in seconds.
+offset can be followed by one of the suffixes ``y``, ``mo``, ``w``,
+``d``, ``h``, or ``mi``, so that it is computed in years (defined as
+365 24-hour days, ignoring leap years), months (defined as 30 24-hour
+days), weeks, days, hours, or minutes, respectively. Without a suffix,
+the offset is computed in seconds.
 
-To unset a date, use ``none`` or ``never``.
+To unset a date, use ``none``, ``never``, or ``unset``.
 
 .. option:: -P date/offset
 
index 057ceea3aa873c33ed7d653a3d7f37d0a6f3bc3c..790775646e054b3b259f0539c4a205e8d4faae52 100644 (file)
@@ -114,15 +114,17 @@ or 'Day Mon DD HH:MM:SS YYYY' (as printed by ``dnssec-settime -p``),
 or UNIX epoch time (as printed by ``dnssec-settime -up``),
 or the literal ``now``.
 
-The argument can be followed by '+' or '-' and an offset from the
+The argument can be followed by ``+`` or ``-`` and an offset from the
 given time. The literal ``now`` can be omitted before an offset. The
-offset can be followed by one of the suffixes 'y', 'mo', 'w', 'd',
-'h', or 'mi', so that it is computed in years (defined as 365 24-hour
-days, ignoring leap years), months (defined as 30 24-hour days),
-weeks, days, hours, or minutes, respectively. Without a suffix, the
-offset is computed in seconds.
+offset can be followed by one of the suffixes ``y``, ``mo``, ``w``,
+``d``, ``h``, or ``mi``, so that it is computed in years (defined as
+365 24-hour days, ignoring leap years), months (defined as 30 24-hour
+days), weeks, days, hours, or minutes, respectively. Without a suffix,
+the offset is computed in seconds.
 
-To unset a date, use ``none`` or ``never``.
+To unset a date, use ``none``, ``never``, or ``unset``.
+
+All these formats are case-insensitive.
 
 .. option:: -P date/offset
 
index f4fc3a865984c8b0d368daa5a0cc8ab65fc97f6d..ffe0978d794883a4ec85efb087a20d1669c9fadf 100644 (file)
@@ -241,7 +241,8 @@ time_units(isc_stdtime_t offset, char *suffix, const char *str) {
 static bool
 isnone(const char *str) {
        return ((strcasecmp(str, "none") == 0) ||
-               (strcasecmp(str, "never") == 0));
+               (strcasecmp(str, "never") == 0) ||
+               (strcasecmp(str, "unset") == 0));
 }
 
 dns_ttl_t
index b3c2cd3fec8be7ad8ef1d38f02c6d174f1e907f0..6e5b8fe26ddb1926a57e4e0f82c7632c2a08d899 100644 (file)
@@ -212,14 +212,22 @@ key=`$KEYGEN -q -a RSASHA1 $czone`
 
 echo_i "checking -p output time is accepted ($n)"
 t=`$SETTIME -pA $key | sed 's/.*: //'`
-$SETTIME -Psync "$t" $key > /dev/null 2>&1 || ret=1
+$SETTIME -Psync "$t" $key > settime2.test$n 2>&1 || ret=1
 n=`expr $n + 1`
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 
 echo_i "checking -up output time is accepted ($n)"
 t=`$SETTIME -upA $key | sed 's/.*: //'`
-$SETTIME -Dsync "$t" $key > /dev/null 2>&1 || ret=1
+$SETTIME -Dsync "$t" $key > settime2.test$n 2>&1 || ret=1
+n=`expr $n + 1`
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+
+echo_i "checking -p unset time is accepted ($n)"
+# The Delete timing metadata is unset.
+t=`$SETTIME -pD $key | sed 's/.*: //'`
+$SETTIME -Psync "$t" $key > settime2.test$n 2>&1 || ret=1
 n=`expr $n + 1`
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
index c2dde9b269f95fa50217d6dae17aadc07f5fb3ea..e36b3bba86d79c340d476b9411b3d7fc24a41459 100644 (file)
@@ -91,14 +91,24 @@ This option prints version information.
 .UNINDENT
 .SH TIMING OPTIONS
 .sp
-Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS. If the
-argument begins with a \fB+\fP or \fB\-\fP, it is interpreted as an offset from
-the present time. For convenience, if such an offset is followed by one
-of the suffixes \fBy\fP, \fBmo\fP, \fBw\fP, \fBd\fP, \fBh\fP, or \fBmi\fP, then the offset is
-computed in years (defined as 365 24\-hour days, ignoring leap years),
-months (defined as 30 24\-hour days), weeks, days, hours, or minutes,
-respectively. Without a suffix, the offset is computed in seconds. To
-explicitly prevent a date from being set, use \fBnone\fP or \fBnever\fP\&.
+Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS.
+(which is the format used inside key files),
+or \(aqDay Mon DD HH:MM:SS YYYY\(aq (as printed by \fBdnssec\-settime \-p\fP),
+or UNIX epoch time (as printed by \fBdnssec\-settime \-up\fP),
+or the literal \fBnow\fP\&.
+.sp
+The argument can be followed by \fB+\fP or \fB\-\fP and an offset from the
+given time. The literal \fBnow\fP can be omitted before an offset. The
+offset can be followed by one of the suffixes \fBy\fP, \fBmo\fP, \fBw\fP,
+\fBd\fP, \fBh\fP, or \fBmi\fP, so that it is computed in years (defined as
+365 24\-hour days, ignoring leap years), months (defined as 30 24\-hour
+days), weeks, days, hours, or minutes, respectively. Without a suffix,
+the offset is computed in seconds.
+.sp
+To explicitly prevent a date from being set, use \fBnone\fP, \fBnever\fP,
+or \fBunset\fP\&.
+.sp
+All these formats are case\-insensitive.
 .INDENT 0.0
 .TP
 .B \-P date/offset
index 82cd29f206cfe345f8cf28836fa731d41c13623e..810a1ebe963ed42cbca0c8628ebd643416044a78 100644 (file)
@@ -202,14 +202,24 @@ involved.)
 .UNINDENT
 .SH TIMING OPTIONS
 .sp
-Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS. If the
-argument begins with a \fB+\fP or \fB\-\fP, it is interpreted as an offset from
-the present time. For convenience, if such an offset is followed by one
-of the suffixes \fBy\fP, \fBmo\fP, \fBw\fP, \fBd\fP, \fBh\fP, or \fBmi\fP, then the offset is
-computed in years (defined as 365 24\-hour days, ignoring leap years),
-months (defined as 30 24\-hour days), weeks, days, hours, or minutes,
-respectively. Without a suffix, the offset is computed in seconds. To
-explicitly prevent a date from being set, use \fBnone\fP or \fBnever\fP\&.
+Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS
+(which is the format used inside key files),
+or \(aqDay Mon DD HH:MM:SS YYYY\(aq (as printed by \fBdnssec\-settime \-p\fP),
+or UNIX epoch time (as printed by \fBdnssec\-settime \-up\fP),
+or the literal \fBnow\fP\&.
+.sp
+The argument can be followed by \fB+\fP or \fB\-\fP and an offset from the
+given time. The literal \fBnow\fP can be omitted before an offset. The
+offset can be followed by one of the suffixes \fBy\fP, \fBmo\fP, \fBw\fP,
+\fBd\fP, \fBh\fP, or \fBmi\fP, so that it is computed in years (defined as
+365 24\-hour days, ignoring leap years), months (defined as 30 24\-hour
+days), weeks, days, hours, or minutes, respectively. Without a suffix,
+the offset is computed in seconds.
+.sp
+To explicitly prevent a date from being set, use \fBnone\fP, \fBnever\fP,
+or \fBunset\fP\&.
+.sp
+All these formats are case\-insensitive.
 .INDENT 0.0
 .TP
 .B \-P date/offset
index 672ecbc4bfe4457afacb3ce9e43a6c56e67a114d..de94a4573b1b49de2bad77c078ea949bda8da38f 100644 (file)
@@ -256,15 +256,15 @@ or \(aqDay Mon DD HH:MM:SS YYYY\(aq (as printed by \fBdnssec\-settime \-p\fP),
 or UNIX epoch time (as printed by \fBdnssec\-settime \-up\fP),
 or the literal \fBnow\fP\&.
 .sp
-The argument can be followed by \(aq+\(aq or \(aq\-\(aq and an offset from the
+The argument can be followed by \fB+\fP or \fB\-\fP and an offset from the
 given time. The literal \fBnow\fP can be omitted before an offset. The
-offset can be followed by one of the suffixes \(aqy\(aq, \(aqmo\(aq, \(aqw\(aq, \(aqd\(aq,
-\(aqh\(aq, or \(aqmi\(aq, so that it is computed in years (defined as 365 24\-hour
-days, ignoring leap years), months (defined as 30 24\-hour days),
-weeks, days, hours, or minutes, respectively. Without a suffix, the
-offset is computed in seconds.
+offset can be followed by one of the suffixes \fBy\fP, \fBmo\fP, \fBw\fP,
+\fBd\fP, \fBh\fP, or \fBmi\fP, so that it is computed in years (defined as
+365 24\-hour days, ignoring leap years), months (defined as 30 24\-hour
+days), weeks, days, hours, or minutes, respectively. Without a suffix,
+the offset is computed in seconds.
 .sp
-To unset a date, use \fBnone\fP or \fBnever\fP\&.
+To unset a date, use \fBnone\fP, \fBnever\fP, or \fBunset\fP\&.
 .INDENT 0.0
 .TP
 .B \-P date/offset
index f8dd6386c44981f0a607289f71ae58265cd990b1..369cea80e73e9d6d2094063cb7f89795041c1e3c 100644 (file)
@@ -126,15 +126,17 @@ or \(aqDay Mon DD HH:MM:SS YYYY\(aq (as printed by \fBdnssec\-settime \-p\fP),
 or UNIX epoch time (as printed by \fBdnssec\-settime \-up\fP),
 or the literal \fBnow\fP\&.
 .sp
-The argument can be followed by \(aq+\(aq or \(aq\-\(aq and an offset from the
+The argument can be followed by \fB+\fP or \fB\-\fP and an offset from the
 given time. The literal \fBnow\fP can be omitted before an offset. The
-offset can be followed by one of the suffixes \(aqy\(aq, \(aqmo\(aq, \(aqw\(aq, \(aqd\(aq,
-\(aqh\(aq, or \(aqmi\(aq, so that it is computed in years (defined as 365 24\-hour
-days, ignoring leap years), months (defined as 30 24\-hour days),
-weeks, days, hours, or minutes, respectively. Without a suffix, the
-offset is computed in seconds.
+offset can be followed by one of the suffixes \fBy\fP, \fBmo\fP, \fBw\fP,
+\fBd\fP, \fBh\fP, or \fBmi\fP, so that it is computed in years (defined as
+365 24\-hour days, ignoring leap years), months (defined as 30 24\-hour
+days), weeks, days, hours, or minutes, respectively. Without a suffix,
+the offset is computed in seconds.
 .sp
-To unset a date, use \fBnone\fP or \fBnever\fP\&.
+To unset a date, use \fBnone\fP, \fBnever\fP, or \fBunset\fP\&.
+.sp
+All these formats are case\-insensitive.
 .INDENT 0.0
 .TP
 .B \-P date/offset