Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a180a6

Browse files
committed
merge 3.5 (closes #25939)
2 parents 5ab2699 + 1378f7c commit 4a180a6

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ Core and Builtins
186186
Library
187187
-------
188188

189+
- Issue #25939: On Windows open the cert store readonly in ssl.enum_certificates.
190+
189191
- Issue #25995: os.walk() no longer uses FDs proportional to the tree depth.
190192

191193
- Issue #25994: Added the close() method and the support of the context manager

Modules/_ssl.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4198,7 +4198,9 @@ _ssl_enum_certificates_impl(PyModuleDef *module, const char *store_name)
41984198
if (result == NULL) {
41994199
return NULL;
42004200
}
4201-
hStore = CertOpenSystemStore((HCRYPTPROV)NULL, store_name);
4201+
hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_A, 0, (HCRYPTPROV)NULL,
4202+
CERT_STORE_READONLY_FLAG | CERT_SYSTEM_STORE_LOCAL_MACHINE,
4203+
store_name);
42024204
if (hStore == NULL) {
42034205
Py_DECREF(result);
42044206
return PyErr_SetFromWindowsErr(GetLastError());
@@ -4284,7 +4286,9 @@ _ssl_enum_crls_impl(PyModuleDef *module, const char *store_name)
42844286
if (result == NULL) {
42854287
return NULL;
42864288
}
4287-
hStore = CertOpenSystemStore((HCRYPTPROV)NULL, store_name);
4289+
hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_A, 0, (HCRYPTPROV)NULL,
4290+
CERT_STORE_READONLY_FLAG | CERT_SYSTEM_STORE_LOCAL_MACHINE,
4291+
store_name);
42884292
if (hStore == NULL) {
42894293
Py_DECREF(result);
42904294
return PyErr_SetFromWindowsErr(GetLastError());

0 commit comments

Comments
 (0)