Skip to content

Commit

Permalink
escape_hazard(): Reuse source_vars()
Browse files Browse the repository at this point in the history
This catches misuse of command options for DN.
eg: --dn-mode=org --req-ou="Test backtick: `" build-* foo

Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Oct 18, 2023
1 parent 3c233d2 commit 5cb462d
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -996,13 +996,8 @@ export EASYRSA_REQ_SERIAL=\"$EASYRSA_REQ_SERIAL\"\
escape_hazard - Failed to write temp-file"

# Reload fields from fully escaped temp-file
# shellcheck disable=SC1090 # can't follow ...
(. "$escape_hazard_tmp") || die "\
escape_hazard - Failed to source temp-file"

source_vars "$escape_hazard_tmp"
verbose "escape_hazard: COMPLETED"
# shellcheck disable=SC1090 # can't follow ...
. "$escape_hazard_tmp"
} # => escape_hazard()

# Replace environment variable names with current value
Expand Down Expand Up @@ -5684,12 +5679,6 @@ No Easy-RSA 'vars' configuration file exists!"

# Source a vars file
source_vars() {
# Never use vars file
if [ "$EASYRSA_NO_VARS" ]; then
verbose "source_vars: EASYRSA_NO_VARS"
return
fi

# File to be sourced
target_file="$1"

Expand Down Expand Up @@ -7223,7 +7212,7 @@ esac
select_vars

# source the vars file
source_vars "$EASYRSA_VARS_FILE"
[ "$EASYRSA_NO_VARS" ] || source_vars "$EASYRSA_VARS_FILE"

# then set defaults
default_vars
Expand Down

0 comments on commit 5cb462d

Please sign in to comment.