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

Skip to content

Commit 2769d44

Browse files
committed
Issue #18709: Fix issue with IPv6 address in subjectAltName on Mac OS X Tiger
2 parents 5939027 + 157c983 commit 2769d44

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

Lib/test/test_ssl.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,21 @@ def test_parse_cert_CVE_2013_4238(self):
222222
(('emailAddress', '[email protected]'),))
223223
self.assertEqual(p['subject'], subject)
224224
self.assertEqual(p['issuer'], subject)
225-
self.assertEqual(p['subjectAltName'],
226-
(('DNS', 'altnull.python.org\x00example.com'),
227-
228-
('URI', 'http://null.python.org\x00http://example.org'),
229-
('IP Address', '192.0.2.1'),
230-
('IP Address', '2001:DB8:0:0:0:0:0:1\n'))
231-
)
225+
if ssl._OPENSSL_API_VERSION >= (0, 9, 8):
226+
san = (('DNS', 'altnull.python.org\x00example.com'),
227+
228+
('URI', 'http://null.python.org\x00http://example.org'),
229+
('IP Address', '192.0.2.1'),
230+
('IP Address', '2001:DB8:0:0:0:0:0:1\n'))
231+
else:
232+
# OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName
233+
san = (('DNS', 'altnull.python.org\x00example.com'),
234+
235+
('URI', 'http://null.python.org\x00http://example.org'),
236+
('IP Address', '192.0.2.1'),
237+
('IP Address', '<invalid>'))
238+
239+
self.assertEqual(p['subjectAltName'], san)
232240

233241
def test_DER_to_PEM(self):
234242
with open(SVN_PYTHON_ORG_ROOT_CERT, 'r') as f:

0 commit comments

Comments
 (0)