Skip to content

Commit

Permalink
Minor improvements to verbose messages and whitespace corrections
Browse files Browse the repository at this point in the history
Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Jul 17, 2024
1 parent ff74ad2 commit 97c00ae
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ easyrsa_mktemp: temp-file EXISTS: $want_tmp_file"
if force_set_var "$1" "$want_tmp_file"
then
verbose "\
:: easyrsa_mktemp: $1 OK: $want_tmp_file"
: easyrsa_mktemp: $1 OK: $want_tmp_file"

# unset noclobber
if [ "$easyrsa_host_os" = win ]; then
Expand Down Expand Up @@ -939,8 +939,6 @@ cleanup() {
# Remove files when build_full()->sign_req() is interrupted
[ "$error_build_full_cleanup" ] && \
rm -f "$crt_out" "$req_out" "$key_out"
# Restore files when renew is interrupted
[ "$error_undo_renew_move" ] && renew_restore_move

if [ "${secured_session%/*}" ] && \
[ -d "$secured_session" ]
Expand Down Expand Up @@ -1173,7 +1171,12 @@ expand_ssl_config: EASYRSA_SSL_CONF = $EASYRSA_SSL_CONF"
# sign-req or gen-req.
easyrsa_openssl() {
openssl_command="$1"; shift
verbose "> easyrsa_openssl - BEGIN $openssl_command"

if [ "$EASYRSA_DEBUG" ]; then
verbose "= easyrsa_openssl - BEGIN $openssl_command $*"
else
verbose "= easyrsa_openssl - BEGIN $openssl_command"
fi

# Do not allow 'rand' here, see easyrsa_random()
case "$openssl_command" in
Expand All @@ -1188,23 +1191,21 @@ easyrsa_openssl() {
[ "$OPENSSL_CONF" ] || \
die "easyrsa_openssl - OPENSSL_CONF undefined"
fi
verbose "easyrsa_openssl: OPENSSL_CONF = $OPENSSL_CONF"

# Debug level
[ -z "$EASYRSA_DEBUG" ] || \
verbose "> easyrsa_openssl - EXEC $openssl_command $*"
verbose "= easyrsa_openssl: OPENSSL_CONF = $OPENSSL_CONF"

# Exec SSL
if [ "$EASYRSA_SILENT_SSL" ] && [ "$EASYRSA_BATCH" ]
then
if "$EASYRSA_OPENSSL" "$openssl_command" "$@" \
2>/dev/null
then
verbose "= easyrsa_openssl - END $openssl_command"
return
fi
else
if "$EASYRSA_OPENSSL" "$openssl_command" "$@"
then
verbose "= easyrsa_openssl - END $openssl_command"
return
fi
fi
Expand Down Expand Up @@ -1337,7 +1338,10 @@ $help_note"

# When operating in 'test' mode, return success.
# test callers don't care about CA-specific dir structure
[ "$1" = "test" ] && return 0
if [ "$1" = "test" ]; then
unset -v help_note
return 0
fi

# verify expected CA-specific dirs:
for i in issued certs_by_serial
Expand Down Expand Up @@ -4162,7 +4166,7 @@ ssl_cert_serial() {

fn_ssl_out="$(
easyrsa_openssl x509 -in "$1" -noout -serial
)" || die "ssl_cert_serial - failed: -serial"
)" || die "ssl_cert_serial - failed: -serial"
# remove the serial= part -> we only need the XXXX part
fn_ssl_out="${fn_ssl_out##*=}"

Expand Down Expand Up @@ -4598,7 +4602,7 @@ ${unexpected_error}"
verify_working_env() {
verbose "verify_working_env: BEGIN"
# For commands which 'require a PKI' and PKI exists
if [ "$require_pki" ]; then
if [ "$require_pki" ]; then
# Verify PKI is initialised
verify_pki_init

Expand Down Expand Up @@ -4744,7 +4748,7 @@ f97425686fa1976d436fa31f550641aa"
esac

# Cleanup
unset -v file_hash known_heredoc_320 \
unset -v file_hash known_heredoc_320 \
known_file_317 \
known_file_315 \
known_file_310 \
Expand Down

0 comments on commit 97c00ae

Please sign in to comment.