[Python-checkins] cpython (2.7): open the cert store readonly

benjamin.peterson python-checkins at python.org
Thu Feb 18 01:18:44 EST 2016


https://hg.python.org/cpython/rev/3cddcf471c70
changeset:   100250:3cddcf471c70
branch:      2.7
parent:      100244:58ebfa7c1361
user:        Benjamin Peterson <benjamin at python.org>
date:        Wed Feb 17 22:13:19 2016 -0800
summary:
  open the cert store readonly

Patch from Chi Hsuan Yen.

files:
  Misc/NEWS      |  2 ++
  Modules/_ssl.c |  8 ++++++--
  2 files changed, 8 insertions(+), 2 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -50,6 +50,8 @@
 Library
 -------
 
+- Issue #25939: On Windows open the cert store readonly in ssl.enum_certificates.
+
 - Issue #24303: Fix random EEXIST upon multiprocessing semaphores creation with
   Linux PID namespaces enabled.
 
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3653,7 +3653,9 @@
     if (result == NULL) {
         return NULL;
     }
-    hStore = CertOpenSystemStore((HCRYPTPROV)NULL, store_name);
+    hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_A, 0, (HCRYPTPROV)NULL,
+                            CERT_STORE_READONLY_FLAG | CERT_SYSTEM_STORE_LOCAL_MACHINE,
+                            store_name);
     if (hStore == NULL) {
         Py_DECREF(result);
         return PyErr_SetFromWindowsErr(GetLastError());
@@ -3741,7 +3743,9 @@
     if (result == NULL) {
         return NULL;
     }
-    hStore = CertOpenSystemStore((HCRYPTPROV)NULL, store_name);
+    hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_A, 0, (HCRYPTPROV)NULL,
+                            CERT_STORE_READONLY_FLAG | CERT_SYSTEM_STORE_LOCAL_MACHINE,
+                            store_name);
     if (hStore == NULL) {
         Py_DECREF(result);
         return PyErr_SetFromWindowsErr(GetLastError());

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list