Skip to content

Commit

Permalink
write: Forcibly silence execution
Browse files Browse the repository at this point in the history
This ensures command 'write' output will remain unpolluted by user
and diagnostic messages; Which allows for the raw command output to
be extenally redirected to a file.

Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Jan 7, 2024
1 parent 084e8a3 commit 7290835
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -5145,6 +5145,7 @@ Missing vars file:
-e '[^(]`[^)]' \
-e '[[:blank:]]export[[:blank:]]*' \
-e '[[:blank:]]unset[[:blank:]]*' \
-e '^ > ' \
"$target_file"
then
# here we go ..
Expand Down Expand Up @@ -5191,6 +5192,16 @@ These problems have been found in your 'vars' settings:${NL}"
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 Expand Up @@ -6226,7 +6237,11 @@ case "$cmd" in
case "$cmd" in
gen-req|gen-dh|build-ca|show-req| \
make-safe-ssl|export-p*|inline|write)
: # No change
# write is not compatible with diagnostics
if [ "$cmd" = write ]; then
unset -v EASYRSA_VERBOSE
EASYRSA_SILENT=1
fi
;;
*)
require_ca=1
Expand Down

0 comments on commit 7290835

Please sign in to comment.