cpython: 40f3f2b27112 (original) (raw)
Mercurial > cpython
changeset 101509:40f3f2b27112 2.7
Issue #27114: Fix SSLContext._load_windows_store_certs fails with PermissionError [#27114]
Steve Dower steve.dower@microsoft.com | |
---|---|
date | Thu, 26 May 2016 12:17:21 -0700 |
parents | 1e80e53ce20d |
children | 2eb8bf8b1f78 |
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 @@ -141,6 +141,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 if _ssl.HAS_TLS_UNIQUE: CHANNEL_BINDING_TYPES = ['tls-unique'] @@ -375,11 +376,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 OSError:[](#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 @@ -83,6 +83,9 @@ Core and Builtins Library ------- +- Issue #27114: Fix SSLContext._load_windows_store_certs fails with