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

Skip to content

Commit b64ae7b

Browse files
committed
merge 3.4 (#23476)
2 parents 2f0441f + fdb1971 commit b64ae7b

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ Core and Builtins
1313
Library
1414
-------
1515

16+
- Issue #23476: In the ssl module, enable OpenSSL's X509_V_FLAG_TRUSTED_FIRST
17+
flag on certificate stores when it is available.
18+
1619
- Issue #23576: Avoid stalling in SSL reads when EOF has been reached in the
1720
SSL layer but the underlying connection hasn't been closed.
1821

Modules/_ssl.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,15 @@ context_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
21992199
sizeof(SID_CTX));
22002200
#undef SID_CTX
22012201

2202+
#ifdef X509_V_FLAG_TRUSTED_FIRST
2203+
{
2204+
/* Improve trust chain building when cross-signed intermediate
2205+
certificates are present. See https://bugs.python.org/issue23476. */
2206+
X509_STORE *store = SSL_CTX_get_cert_store(self->ctx);
2207+
X509_STORE_set_flags(store, X509_V_FLAG_TRUSTED_FIRST);
2208+
}
2209+
#endif
2210+
22022211
return (PyObject *)self;
22032212
}
22042213

0 commit comments

Comments
 (0)