From 7c97dcd864fb684404adfa8250fe13026b300c85 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Tue, 29 Mar 2022 01:59:15 +0100 Subject: [PATCH] Do full shellcheck test. Wrap nasty long lines. Signed-off-by: Richard T Bonhomme --- .github/workflows/action.yml | 4 +++- easyrsa3/easyrsa | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index 3dc81db..a281053 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -30,7 +30,9 @@ jobs: - uses: actions/checkout@v2 # Runs a single command using the runners shell - - name: Run a one-line script + - name: shellcheck test + run: shellcheck easyrsa3/easyrsa + - name: operational test run: sh op_test.sh -v # Runs a set of commands using the runners shell diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 57917ac..c346967 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -1735,13 +1735,13 @@ display_san() { format="$1" path="$2" if echo "$EASYRSA_EXTRA_EXTS" | grep -q subjectAltName; then - #if [ $? -eq 0 ]; then - print "$(echo "$EASYRSA_EXTRA_EXTS" | grep subjectAltName | sed - 's/^\s*subjectAltName\s*=\s*//')" + print "$(echo "$EASYRSA_EXTRA_EXTS" | grep subjectAltName | + sed 's/^\s*subjectAltName\s*=\s*//')" else san=$( - "$EASYRSA_OPENSSL" "$format" -in "$path" -noout -text | sed -n \ - "/X509v3 Subject Alternative Name:/{n;s/ //g;s/IPAddress:/IP:/g;s/RegisteredID/RID/;p;}" + x509v3san="X509v3 Subject Alternative Name:" + "$EASYRSA_OPENSSL" "$format" -in "$path" -noout -text | + sed -n "/${x509v3san}/{n;s/ //g;s/IPAddress:/IP:/g;s/RegisteredID/RID/;p;}" ) [ -n "$san" ] && print "$san"