Skip to content

Commit 1cf8eb3

Browse files
committed
PYTHON-2505 Use match_hostname from the ssl module
1 parent ab35e0d commit 1cf8eb3

File tree

3 files changed

+2
-189
lines changed

3 files changed

+2
-189
lines changed

THIRD-PARTY-NOTICES

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -95,57 +95,3 @@ Unicode Standard, and to make copies of this file in any form
9595
for internal or external distribution as long as this notice
9696
remains attached.
9797

98-
4) License Notice for ssl_match_hostname.py
99-
-------------------------------------------
100-
101-
Python License (Python-2.0)
102-
103-
Python License, Version 2 (Python-2.0)
104-
105-
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
106-
--------------------------------------------
107-
108-
1. This LICENSE AGREEMENT is between the Python Software Foundation
109-
("PSF"), and the Individual or Organization ("Licensee") accessing and
110-
otherwise using this software ("Python") in source or binary form and
111-
its associated documentation.
112-
113-
2. Subject to the terms and conditions of this License Agreement, PSF
114-
hereby grants Licensee a nonexclusive, royalty-free, world-wide
115-
license to reproduce, analyze, test, perform and/or display publicly,
116-
prepare derivative works, distribute, and otherwise use Python
117-
alone or in any derivative version, provided, however, that PSF's
118-
License Agreement and PSF's notice of copyright, i.e., "Copyright (c)
119-
2001-2013 Python Software Foundation; All Rights Reserved" are retained in
120-
Python alone or in any derivative version prepared by Licensee.
121-
122-
3. In the event Licensee prepares a derivative work that is based on
123-
or incorporates Python or any part thereof, and wants to make
124-
the derivative work available to others as provided herein, then
125-
Licensee hereby agrees to include in any such work a brief summary of
126-
the changes made to Python.
127-
128-
4. PSF is making Python available to Licensee on an "AS IS"
129-
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
130-
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
131-
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
132-
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
133-
INFRINGE ANY THIRD PARTY RIGHTS.
134-
135-
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
136-
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
137-
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
138-
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
139-
140-
6. This License Agreement will automatically terminate upon a material
141-
breach of its terms and conditions.
142-
143-
7. Nothing in this License Agreement shall be deemed to create any
144-
relationship of agency, partnership, or joint venture between PSF and
145-
Licensee. This License Agreement does not grant permission to use PSF
146-
trademarks or trade name in a trademark sense to endorse or promote
147-
products or services of Licensee, or any third party.
148-
149-
8. By copying, installing or otherwise using Python, Licensee
150-
agrees to be bound by the terms and conditions of this License
151-
Agreement.

pymongo/pool.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import ipaddress
1919
import os
2020
import platform
21+
import ssl
2122
import socket
2223
import sys
2324
import threading
@@ -57,8 +58,6 @@
5758
from pymongo.server_api import _add_to_command
5859
from pymongo.server_type import SERVER_TYPE
5960
from pymongo.socket_checker import SocketChecker
60-
# Always use our backport so we always have support for IP address matching
61-
from pymongo.ssl_match_hostname import match_hostname
6261
from pymongo.ssl_support import (
6362
SSLError as _SSLError,
6463
HAS_SNI as _HAVE_SNI,
@@ -1017,7 +1016,7 @@ def _configured_socket(address, options):
10171016
getattr(ssl_context, "check_hostname", False) and
10181017
options.ssl_match_hostname):
10191018
try:
1020-
match_hostname(sock.getpeercert(), hostname=host)
1019+
ssl.match_hostname(sock.getpeercert(), hostname=host)
10211020
except CertificateError:
10221021
sock.close()
10231022
raise

pymongo/ssl_match_hostname.py

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)