Skip to content

Commit

Permalink
Merge branch 'TinCanTech-win-secure_session-fix-mkdir'
Browse files Browse the repository at this point in the history
Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Aug 10, 2024
2 parents 0081fca + 371a998 commit 772e274
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 772e274

Please sign in to comment.