cpython: eaee5aed6fbc (original) (raw)
Mercurial > cpython
changeset 101511:eaee5aed6fbc
Issue #27114: Fix SSLContext._load_windows_store_certs fails with PermissionError [#27114]
Steve Dower steve.dower@microsoft.com | |
---|---|
date | Thu, 26 May 2016 12:19:42 -0700 |
parents | 20d515982b43(current diff)29f163db229e(diff) |
children | 09d6232e4705 |
files | Lib/ssl.py Misc/NEWS |
diffstat | 2 files changed, 12 insertions(+), 5 deletions(-)[+] [-] Lib/ssl.py 14 Misc/NEWS 3 |
line wrap: on
line diff
--- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -145,6 +145,7 @@ from socket import socket, AF_INET, SOCK from socket import SOL_SOCKET, SO_TYPE import base64 # for DER-to-PEM translation import errno +import warnings socket_error = OSError # keep that public name in module namespace @@ -405,11 +406,14 @@ class SSLContext(_SSLContext): def _load_windows_store_certs(self, storename, purpose): certs = bytearray()
for cert, encoding, trust in enum_certificates(storename):[](#l1.15)
# CA certs are never PKCS#7 encoded[](#l1.16)
if encoding == "x509_asn":[](#l1.17)
if trust is True or purpose.oid in trust:[](#l1.18)
certs.extend(cert)[](#l1.19)
try:[](#l1.20)
for cert, encoding, trust in enum_certificates(storename):[](#l1.21)
# CA certs are never PKCS#7 encoded[](#l1.22)
if encoding == "x509_asn":[](#l1.23)
if trust is True or purpose.oid in trust:[](#l1.24)
certs.extend(cert)[](#l1.25)
except PermissionError:[](#l1.26)
warnings.warn("unable to enumerate Windows certificate store")[](#l1.27) if certs:[](#l1.28) self.load_verify_locations(cadata=certs)[](#l1.29) return certs[](#l1.30)
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,6 +22,9 @@ Core and Builtins Library ------- +- Issue #27114: Fix SSLContext._load_windows_store_certs fails with