Add structured exception for invalid signature timestamp
authorJacob Bachmeyer <jcb@gnu.org>
Thu, 3 Nov 2022 20:48:48 +0000 (15:48 -0500)
committerJacob Bachmeyer <jcb@gnu.org>
Thu, 3 Nov 2022 20:48:48 +0000 (15:48 -0500)
gatekeeper.pl
testsuite/lib/gatekeeper.exp

index 1bcdd523895f87ebc79eb0b21d5e9e3643950e4b..84ccd6048cbb1bc45fc91983c8b2c76171af2967 100755 (executable)
@@ -581,6 +581,20 @@ END
     { return join("\n", map join(': ', @$_), @{(shift)->{trace}})."\n" }
 }
 
+{
+  package Local::Exception::signature_from_future;
+  {our @ISA = qw(Local::Exception)}
+
+  sub summary { return 'directive signature timestamp from the future' }
+
+  sub message { my $M = <<'END'; return join(' ', split /\n/, $M); }
+GPG signed upload from the future - not allowed.  Please make sure your
+clock is set correctly, resign the directive file, and upload again.  You
+may have to wait 24 hours before re-uploading if you do not change the
+filename for your triplet.
+END
+}
+
 {
   package Local::Exception::signature_replay;
   {our @ISA = qw(Local::Exception)}
@@ -2108,11 +2122,7 @@ sub check_replay {
     # Verify that this timestamp is not too far in the future. We allow a
     # discrepancy of 1 day so we don't have to worry about timezones
     if ($timestamp > (time() + 24*3600)) {
-      fatal("GPG signed upload from the future - not allowed. "
-           ."Please make sure your clock is set correctly, "
-           ."resign the directive file, and upload again. "
-           ."You may have to wait 24 hours before re-uploading if you do not "
-           ."change the filename for your triplet.",1);
+      throw signature_from_future => timestamp => $timestamp
     }
 
 
index b6b15ecd940ed97f257cec83dde64583f52f6306..ed8c9554357f36d2ea0040109122cff76d9854ca 100644 (file)
@@ -748,7 +748,7 @@ proc analyze_log { base_dir name assess } {
                     exp_continue
                 }
        -re {^gatekeeper\[[0-9]+\]: \(Test\) \[AA\]\
-                GPG signed upload from the future - not allowed[^\r\n]+} {
+                directive signature timestamp from the future} {
                     # from read_directive_file, if signature timestamp bad
                     set A(validate,future-signature-timestamp) 1
                     exp_continue