summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-08-25 14:12:50 +0200
committerChristian Heimes <christian@cheimes.de>2013-08-25 14:12:50 +0200
commit1d0fb524dce05d5cbd391449416b77e862ab045b (patch)
treea28555e1ca783958c21c2c884610d412e63d2f20 /Lib
parent15165bd38da66a588336930fceef76c1b7d5a641 (diff)
parent96c16d997ed6574bee6b6d51e4e041b7f9ca71bc (diff)
downloadcpython-1d0fb524dce05d5cbd391449416b77e862ab045b.tar.gz
Issue #18709: Fix issue with IPv6 address in subjectAltName on Mac OS X Tiger
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_ssl.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 6a99ad0484..8915305213 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -222,13 +222,21 @@ class BasicSocketTests(unittest.TestCase):
(('emailAddress', 'python-dev@python.org'),))
self.assertEqual(p['subject'], subject)
self.assertEqual(p['issuer'], subject)
- self.assertEqual(p['subjectAltName'],
- (('DNS', 'altnull.python.org\x00example.com'),
- ('email', 'null@python.org\x00user@example.org'),
- ('URI', 'http://null.python.org\x00http://example.org'),
- ('IP Address', '192.0.2.1'),
- ('IP Address', '2001:DB8:0:0:0:0:0:1\n'))
- )
+ if ssl._OPENSSL_API_VERSION >= (0, 9, 8):
+ san = (('DNS', 'altnull.python.org\x00example.com'),
+ ('email', 'null@python.org\x00user@example.org'),
+ ('URI', 'http://null.python.org\x00http://example.org'),
+ ('IP Address', '192.0.2.1'),
+ ('IP Address', '2001:DB8:0:0:0:0:0:1\n'))
+ else:
+ # OpenSSL 0.9.7 doesn't support IPv6 addresses in subjectAltName
+ san = (('DNS', 'altnull.python.org\x00example.com'),
+ ('email', 'null@python.org\x00user@example.org'),
+ ('URI', 'http://null.python.org\x00http://example.org'),
+ ('IP Address', '192.0.2.1'),
+ ('IP Address', '<invalid>'))
+
+ self.assertEqual(p['subjectAltName'], san)
def test_DER_to_PEM(self):
with open(SVN_PYTHON_ORG_ROOT_CERT, 'r') as f: