Skip to content

Commit

Permalink
Merge branch 'win-secure_session-fix-mkdir' of ssh://github.com/TinCa…
Browse files Browse the repository at this point in the history
…nTech/easy-rsa into TinCanTech-win-secure_session-fix-mkdir

Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Aug 10, 2024
2 parents 0081fca + 91b1036 commit 371a998
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -785,10 +785,18 @@ secure_session() {
secured_session="${EASYRSA_TEMP_DIR}/${session}"

# atomic:
# ONLY effects Windows 11 "broken" mkdir.exe
# The procedure now is a "poor man's" version
# of an atomic directory creation call.
# The "race condition" still exists but is minimized.
# What remains is equivalent to 32bit hash collision.
[ -d "$secured_session" ] && continue
if mkdir "$secured_session"; then
# Check mkdir.exe has created the directory
[ -d "$secured_session" ] || \
die "secure_session - mkdir FAILED"
[ -f "$secured_session"/temp.0.1 ] && \
die "secure_session - temp-file EXISTS"

# New session requires safe-ssl conf
unset -v OPENSSL_CONF safe_ssl_cnf_tmp \
Expand Down

0 comments on commit 371a998

Please sign in to comment.