From 3c0ca170f3da2dadbcf07f0c0f3a8c22b7dd2267 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Tue, 5 Dec 2023 23:54:08 +0000 Subject: [PATCH] Remove EASYRSA_NO_VARS; Allow graceful use without a vars file Signed-off-by: Richard T Bonhomme --- ChangeLog | 1 + easyrsa3/easyrsa | 19 ++++++------------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index ccc83b574..7421e102f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ Easy-RSA 3 ChangeLog 3.2.0 (TBD) + * Remove EASYRSA_NO_VARS; Allow graceful use without a vars file (#1043) * New diagnostic command 'display-cn' (#1040) * Expand renewable certificate types to include code-signing (#1039) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 244f8e1be..98bc7b27d 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -5602,15 +5602,8 @@ To correct this problem, it is recommended that you either: # If not present, defaults are used to support # running without a sourced config format. select_vars() { - # No vars file will be used - if [ "$EASYRSA_NO_VARS" ]; then - verbose "select_vars: EASYRSA_NO_VARS" - unset -v EASYRSA_VARS_FILE - # skip the rest of this function - return - # User specified vars file will be used ONLY - elif [ "$EASYRSA_VARS_FILE" ]; then + if [ "$EASYRSA_VARS_FILE" ]; then # Takes priority, nothing to do verbose "select_vars: EASYRSA_VARS_FILE" @@ -5668,7 +5661,8 @@ select_vars() { if [ -z "$EASYRSA_VARS_FILE" ]; then [ "$require_pki" ] && information "\ No Easy-RSA 'vars' configuration file exists!" - EASYRSA_NO_VARS=1 + # select_vars failed to find a vars file + return 1 fi } # => select_vars() @@ -7211,10 +7205,9 @@ esac # Intelligent env-var detection and auto-loading: # Select vars file as EASYRSA_VARS_FILE -select_vars - -# source the vars file -[ "$EASYRSA_NO_VARS" ] || source_vars "$EASYRSA_VARS_FILE" +# then source the vars file, if found +# otherwise, ignore no vars file +select_vars && source_vars "$EASYRSA_VARS_FILE" # then set defaults default_vars