From d249eebed26059da708ab0f7fd16dc508252cc91 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Fri, 27 Oct 2023 20:39:03 +0100 Subject: [PATCH] easyrsa_openssl(): Use 'case' for command selection Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 8070063e0..aec0f887b 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -1137,24 +1137,26 @@ easyrsa_openssl() { # Execute command - Return on success verbose "> easyrsa_openssl - EXEC $openssl_command $*" - if [ "$openssl_command" = "makesafeconf" ]; then + + case "$openssl_command" in + makesafeconf) # COPY temp-file to safessl-easyrsa.cnf unset -v makesafeconf cp -f "$safe_ssl_cnf_tmp" "$EASYRSA_SAFE_CONF" && \ - return - die "easyrsa_openssl: makesafeconf FAILED" - fi - - # Exec SSL - if [ "$EASYRSA_SILENT_SSL" ] && [ "$EASYRSA_BATCH" ] - then - "$EASYRSA_OPENSSL" "$openssl_command" "$@" \ - 2>/dev/null && \ - return - else - "$EASYRSA_OPENSSL" "$openssl_command" "$@" && \ - return - fi + return + ;; + *) + # Exec SSL + if [ "$EASYRSA_SILENT_SSL" ] && [ "$EASYRSA_BATCH" ] + then + "$EASYRSA_OPENSSL" "$openssl_command" "$@" \ + 2>/dev/null && \ + return + else + "$EASYRSA_OPENSSL" "$openssl_command" "$@" && \ + return + fi + esac # Always fail here die "\