]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
schannel_verify: Fix concurrent openings of CA file
authorJay Satiro <raysatiro@yahoo.com>
Fri, 1 Nov 2019 22:02:59 +0000 (18:02 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Fri, 1 Nov 2019 22:02:59 +0000 (18:02 -0400)
- Open the CA file using FILE_SHARE_READ mode so that others can read
  from it as well.

Prior to this change our schannel code opened the CA file without
sharing which meant concurrent openings (eg an attempt from another
thread or process) would fail during the time it was open without
sharing, which in curl's case would cause error:
"schannel: failed to open CA file".

Bug: https://curl.haxx.se/mail/lib-2019-10/0104.html
Reported-by: Richard Alcock
lib/vtls/schannel_verify.c

index 5a09e969e8ccf4c4e9632878fbec2e37029ab9bf..1bdf50a55ca87c6c862ab23ea59d6aed3f761e27 100644 (file)
@@ -111,7 +111,7 @@ static CURLcode add_certs_to_store(HCERTSTORE trust_store,
    */
   ca_file_handle = CreateFile(ca_file_tstr,
                               GENERIC_READ,
-                              0,
+                              FILE_SHARE_READ,
                               NULL,
                               OPEN_EXISTING,
                               FILE_ATTRIBUTE_NORMAL,