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

Skip to content

Commit 157c983

Browse files
committed
Issue #18709: Fix issue with IPv6 address in subjectAltName on Mac OS X Tiger
1 parent ec8147b commit 157c983

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
@@ -208,13 +208,21 @@ def test_parse_cert_CVE_2013_4238(self):
208208
(('emailAddress', '[email protected]'),))
209209
self.assertEqual(p['subject'], subject)
210210
self.assertEqual(p['issuer'], subject)
211-
self.assertEqual(p['subjectAltName'],
212-
(('DNS', 'altnull.python.org\x00example.com'),
213-
214-
('URI', 'http://null.python.org\x00http://example.org'),
215-
('IP Address', '192.0.2.1'),
216-
('IP Address', '2001:DB8:0:0:0:0:0:1\n'))
217-
)
211+
if ssl._OPENSSL_API_VERSION >= (0, 9, 8):
212+
san = (('DNS', 'altnull.python.org\x00example.com'),
213+
214+
('URI', 'http://null.python.org\x00http://example.org'),
215+
('IP Address', '192.0.2.1'),
216+
('IP Address', '2001:DB8:0:0:0:0:0:1\n'))
217+
else:
218+
# OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName
219+
san = (('DNS', 'altnull.python.org\x00example.com'),
220+
221+
('URI', 'http://null.python.org\x00http://example.org'),
222+
('IP Address', '192.0.2.1'),
223+
('IP Address', '<invalid>'))
224+
225+
self.assertEqual(p['subjectAltName'], san)
218226

219227
def test_DER_to_PEM(self):
220228
with open(SVN_PYTHON_ORG_ROOT_CERT, 'r') as f:

0 commit comments

Comments
 (0)