File python-disable-ssl2.patch of Package python.openSUSE_13.1_Update

Index: Python-2.7.6/Lib/test/test_ssl.py
===================================================================
--- Python-2.7.6.orig/Lib/test/test_ssl.py
+++ Python-2.7.6/Lib/test/test_ssl.py
@@ -1046,7 +1046,7 @@ else:
             try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True)
             try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL)
             try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED)
-            try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, True)
+            try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False)
             try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False)
             try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False)
 
Index: Python-2.7.6/Modules/_ssl.c
===================================================================
--- Python-2.7.6.orig/Modules/_ssl.c
+++ Python-2.7.6/Modules/_ssl.c
@@ -274,6 +274,7 @@ newPySSLObject(PySocketSockObject *Sock,
     int ret;
     int verification_mode;
     struct stat stat_buf;
+    long options;
 
     self = PyObject_New(PySSLObject, &PySSL_Type); /* Create new object */
     if (self == NULL)
@@ -385,8 +386,10 @@ newPySSLObject(PySocketSockObject *Sock,
     }
 
     /* ssl compatibility */
-    SSL_CTX_set_options(self->ctx,
-                        SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS);
+    options = SSL_OP_ALL & ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;
+    if (proto_version != PY_SSL_VERSION_SSL2)
+        options |= SSL_OP_NO_SSLv2;
+    SSL_CTX_set_options(self->ctx, options);
 
     verification_mode = SSL_VERIFY_NONE;
     if (certreq == PY_SSL_CERT_OPTIONAL)
openSUSE Build Service is sponsored by