Skip to content

Commit

Permalink
source_vars(): Correct regex guard - Remove unnecessary guard
Browse files Browse the repository at this point in the history
The regex used by grep incorrectly expects a [:blank:] before 'export'.
This allows a line beginning with 'export' to slip through the net.
The same goes for 'unset'

Also, remove regex for '  > ', accidental --verbose output, copied to
the vars file.  --verbose no lomger uses '>' as a line label, instead
--verbose output is labelled with '#', which would be interpretted as
a comment in an input file.

Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed May 17, 2024
1 parent ef77067 commit a0f1238
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -4160,10 +4160,9 @@ Missing vars file:
if grep -q \
-e 'EASYRSA_PASSIN' -e 'EASYRSA_PASSOUT' \
-e '[^(]`[^)]' \
-e '[[:blank:]]export[[:blank:]]*' \
-e '[[:blank:]]unset[[:blank:]]*' \
-e '^ > ' \
"$target_file"
-e 'export ' \
-e 'unset ' \
"$target_file"
then
# here we go ..
err_msg="\
Expand Down Expand Up @@ -4191,7 +4190,7 @@ These problems have been found in your 'vars' settings:${NL}"

# No export
if grep -q \
-e '[[:blank:]]export[[:blank:]]*' \
-e 'export ' \
"$target_file"
then
err_msg="${err_msg}
Expand All @@ -4201,24 +4200,14 @@ These problems have been found in your 'vars' settings:${NL}"

# No unset
if grep -q \
-e '[[:blank:]]unset[[:blank:]]*' \
-e 'unset ' \
"$target_file"
then
err_msg="${err_msg}
Use of 'unset':
Remove 'unset' ('force_set_var' may also work)."
fi

# No redirection - caused by --verbose output
if grep -q \
-e '^ > ' \
"$target_file"
then
err_msg="${err_msg}
Use of unsupported characters:
These characters are not supported: '>' redirection"
fi

# Fatal error
user_error "${err_msg}${NL}
Please, correct these errors and try again."
Expand Down

0 comments on commit a0f1238

Please sign in to comment.