Skip to content

Commit

Permalink
Do not reset $mktemp_counter during create/destroy secure session
Browse files Browse the repository at this point in the history
Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed May 15, 2024
1 parent 6c17ed0 commit 537be2f
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -796,9 +796,8 @@ secure_session() {
# atomic:
if mkdir "$secured_session"; then
# New session requires safe-ssl conf
unset -v mktemp_counter \
OPENSSL_CONF safe_ssl_cnf_tmp \
working_safe_ssl_conf
unset -v OPENSSL_CONF \
safe_ssl_cnf_tmp working_safe_ssl_conf
easyrsa_err_log="$secured_session/error.log"

verbose "\
Expand All @@ -818,9 +817,8 @@ remove_secure_session() {
if rm -rf "$secured_session"; then
verbose "\
remove_secure_session: DELETED: $secured_session"
unset -v secured_session mktemp_counter \
OPENSSL_CONF safe_ssl_cnf_tmp \
working_safe_ssl_conf
unset -v secured_session OPENSSL_CONF \
safe_ssl_cnf_tmp working_safe_ssl_conf
return
fi
fi
Expand Down Expand Up @@ -858,9 +856,6 @@ easyrsa_mktemp - input error"
[ "$secured_session" ] || die "\
easyrsa_mktemp - Temporary session undefined (--tmp-dir)"

# Update counter
mktemp_counter="$(( mktemp_counter + 1 ))"

# Assign internal temp-file name
t="${secured_session}/temp.${mktemp_counter}"

Expand Down Expand Up @@ -897,6 +892,9 @@ easyrsa_mktemp: temp-file EXISTS: $want_tmp_file"
fi

if mv "$shotfile" "$want_tmp_file"; then
# Update counter
mktemp_counter="$(( mktemp_counter + 1 ))"

# Assign external temp-file name
if force_set_var "$1" "$want_tmp_file"
then
Expand Down

0 comments on commit 537be2f

Please sign in to comment.