Add option to pipe signed message to mock signature verification tool
authorJacob Bachmeyer <jcb@gnu.org>
Tue, 25 Oct 2022 03:30:11 +0000 (22:30 -0500)
committerJacob Bachmeyer <jcb@gnu.org>
Tue, 25 Oct 2022 03:30:11 +0000 (22:30 -0500)
testsuite/lib/exec/mockgpgv

index c4ccfd257a3fc721b8131bd777644bd1c4592d48..a700199a9d93fede7790aa31afe064fb565c0f6e 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # -*- bash -*-
 
-# Copyright (C) 2021 Jacob Bachmeyer
+# Copyright (C) 2021, 2022 Jacob Bachmeyer
 #
 # This file is part of a testsuite for the GNU FTP upload system.
 #
@@ -214,7 +214,7 @@ function process_sig_file {
                ;;
        esac
     done
-} <"$SigFile"
+}
 
 # check that we were actually given a file to process
 if [ x"$*" = x ]; then
@@ -226,8 +226,11 @@ fi
 # check that the file is readable and process it
 SigFile="$1"
 shift
-if [ -r "$SigFile" ] ; then
-    process_sig_file "$@"
+if [ x"$SigFile" = x- ] ; then
+    # signed message arrives on stdin
+    process_sig_file
+elif [ -r "$SigFile" ] ; then
+    process_sig_file "$@" <"$SigFile"
 else
     log "can't" open '`'"$SigFile'"
     log verify signatures failed: file open error