From 0ed310cf9add9c2150d4a6e80cac68a976aa2cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20B=C3=BChlmann?= Date: Wed, 17 Feb 2021 21:49:59 +0100 Subject: [PATCH] Improved error reporting if TSA url does not reply with timestamp response. Corrected simplified merkle-tree schematic. --- docs/schematic_simplified.svg | 4 ++-- hooks/timestamping | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/schematic_simplified.svg b/docs/schematic_simplified.svg index 6e4250a..8b9e802 100644 --- a/docs/schematic_simplified.svg +++ b/docs/schematic_simplified.svg @@ -1,4 +1,4 @@ -HEADCommit#TimestampCommit#TimestampFiles V1TimestampLTV Metadata##Commit#Files V2#Commit#TimestampLTV Metadata### \ No newline at end of file diff --git a/hooks/timestamping b/hooks/timestamping index ffe37e8..b1f1a45 100644 --- a/hooks/timestamping +++ b/hooks/timestamping @@ -204,11 +204,16 @@ request_token() { local RESPONSE_STATUS=$(openssl ts -reply -in "$RESPONSE_FILE" -text 2> "$OUT_STREAM" | awk '/Status: /{print; exit}' | sed 's/Status: //' | sed 's/\.//') if [ "$RESPONSE_STATUS" != "Granted" ]; then echo "Error: Token request was not granted." - local STATUS_INFO=$(openssl ts -reply -in "$RESPONSE_FILE" -text 2> "$OUT_STREAM" | awk '/Status info:/{f=1} f {print} /Failure info: /{exit}') - echo "$STATUS_INFO" - echo "Note: If rejection reason is unrecognized or unsupported algorithm, then this tsa cannot be used for this repository, since it uses --object-format=$ALGO" - echo "The token request was:" - openssl ts -query -in "$REQ_FILE" -text 2> "$OUT_STREAM" + if [ -z "$RESPONSE_STATUS" ]; then + cat "$RESPONSE_FILE" + echo "" + else + local STATUS_INFO=$(openssl ts -reply -in "$RESPONSE_FILE" -text 2> "$OUT_STREAM" | awk '/Status info:/{f=1} f {print} /Failure info: /{exit}') + echo "$STATUS_INFO" + echo "Note: If rejection reason is unrecognized or unsupported algorithm, then this tsa cannot be used for this repository, since it uses --object-format=$ALGO" + echo "The token request was:" + openssl ts -query -in "$REQ_FILE" -text 2> "$OUT_STREAM" + fi return 1 fi if ! openssl ts -reply -in "$RESPONSE_FILE" -token_out -out "$OUTPUT_FILE" &> "$OUT_STREAM"; then