From adc2cbed58912ff124456efb7397493e8670b684 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Tue, 19 Apr 2022 15:27:20 +0100 Subject: [PATCH] Check status of command, not exit-code, in default_server_san() Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 7187405..0a89e4e 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -1991,10 +1991,8 @@ default_server_san() { easyrsa_openssl req -in "$path" -noout -subject -nameopt sep_multiline | awk -F'=' '/^ *CN=/{print $2}' ) - echo "$cn" | grep -E -q '^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$' - # Check exit code directly with e.g. if mycmd;, not indirectly with $?. - # shellcheck disable=SC2181 - if [ $? -eq 0 ]; then + + if echo "$cn" | grep -E -q '^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$'; then print "subjectAltName = IP:$cn" else print "subjectAltName = DNS:$cn"