Commit 547ab5f7 authored by Benjamin Peterson's avatar Benjamin Peterson

open the cert store readonly

Patch from Chi Hsuan Yen.
parent 02246381
...@@ -16,6 +16,8 @@ Core and Builtins ...@@ -16,6 +16,8 @@ Core and Builtins
Library Library
------- -------
- Issue #25939: On Windows open the cert store readonly in ssl.enum_certificates.
- Issue #22570: Add 'path' attribute to pathlib.Path objects, - Issue #22570: Add 'path' attribute to pathlib.Path objects,
returning the same as str(), to make it more similar to DirEntry. returning the same as str(), to make it more similar to DirEntry.
Library code can now write getattr(p, 'path', p) to get the path as Library code can now write getattr(p, 'path', p) to get the path as
......
...@@ -3597,7 +3597,9 @@ PySSL_enum_certificates(PyObject *self, PyObject *args, PyObject *kwds) ...@@ -3597,7 +3597,9 @@ PySSL_enum_certificates(PyObject *self, PyObject *args, PyObject *kwds)
if (result == NULL) { if (result == NULL) {
return 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) { if (hStore == NULL) {
Py_DECREF(result); Py_DECREF(result);
return PyErr_SetFromWindowsErr(GetLastError()); return PyErr_SetFromWindowsErr(GetLastError());
...@@ -3685,7 +3687,9 @@ PySSL_enum_crls(PyObject *self, PyObject *args, PyObject *kwds) ...@@ -3685,7 +3687,9 @@ PySSL_enum_crls(PyObject *self, PyObject *args, PyObject *kwds)
if (result == NULL) { if (result == NULL) {
return 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) { if (hStore == NULL) {
Py_DECREF(result); Py_DECREF(result);
return PyErr_SetFromWindowsErr(GetLastError()); return PyErr_SetFromWindowsErr(GetLastError());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment