[Python-checkins] cpython (merge 3.3 -> default): Issue #18709: Fix issue with IPv6 address in subjectAltName on Mac OS X Tiger

christian.heimes python-checkins at python.org
Sun Aug 25 14:15:08 CEST 2013


http://hg.python.org/cpython/rev/577e9402cadd
changeset:   85375:577e9402cadd
parent:      85373:ffb01a6c0960
parent:      85374:004743d210e4
user:        Christian Heimes <christian at cheimes.de>
date:        Sun Aug 25 14:12:50 2013 +0200
summary:
  Issue #18709: Fix issue with IPv6 address in subjectAltName on Mac OS X Tiger

files:
  Lib/test/test_ssl.py |  22 +++++++++++++++-------
  1 files changed, 15 insertions(+), 7 deletions(-)


diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -222,13 +222,21 @@
                    (('emailAddress', 'python-dev at python.org'),))
         self.assertEqual(p['subject'], subject)
         self.assertEqual(p['issuer'], subject)
-        self.assertEqual(p['subjectAltName'],
-                         (('DNS', 'altnull.python.org\x00example.com'),
-                         ('email', 'null at python.org\x00user at 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 at python.org\x00user at 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 at python.org\x00user at 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:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list