Blame SOURCES/m2crypto-0.21.1-sni.patch

cf4299
Based on https://bugzilla.osafoundation.org/attachment.cgi?id=5760
cf4299
by Sander Steffann <sander@steffann.nl>.
cf4299
cf4299
diff -ur M2Crypto/M2Crypto/SSL/Connection.py M2Crypto-0.21.1/M2Crypto/SSL/Connection.py
cf4299
--- M2Crypto/M2Crypto/SSL/Connection.py	2013-12-17 02:01:49.843287273 +0100
cf4299
+++ M2Crypto-0.21.1/M2Crypto/SSL/Connection.py	2013-12-17 02:28:28.357633159 +0100
cf4299
@@ -368,3 +368,7 @@
cf4299
 
cf4299
     def set_post_connection_check_callback(self, postConnectionCheck):
cf4299
         self.postConnectionCheck = postConnectionCheck
cf4299
+
cf4299
+    def set_tlsext_host_name(self, name):
cf4299
+        "Set the requested hostname for the SNI (Server Name Indication) extension"
cf4299
+        m2.ssl_set_tlsext_host_name(self.ssl, name)
cf4299
diff -ur M2Crypto/SWIG/_ssl.i M2Crypto-0.21.1/SWIG/_ssl.i
cf4299
--- M2Crypto/SWIG/_ssl.i	2013-12-17 02:01:49.863287264 +0100
cf4299
+++ M2Crypto-0.21.1/SWIG/_ssl.i	2013-12-17 02:39:28.138364398 +0100
cf4299
@@ -15,6 +15,7 @@
cf4299
 #include <openssl/bio.h>
cf4299
 #include <openssl/dh.h>
cf4299
 #include <openssl/ssl.h>
cf4299
+#include <openssl/tls1.h>
cf4299
 #include <openssl/x509.h>
cf4299
 #include <poll.h>
cf4299
 #include <sys/time.h>
cf4299
@@ -398,6 +399,17 @@
cf4299
     return SSL_get_mode(ssl);
cf4299
 }
cf4299
 
cf4299
+int ssl_set_tlsext_host_name(SSL *ssl, const char *name) {
cf4299
+    long l;
cf4299
+
cf4299
+    if (!(l = SSL_set_tlsext_host_name(ssl, name))) {
cf4299
+        PyErr_SetString(_ssl_err, ERR_reason_error_string(ERR_get_error()));
cf4299
+        return -1;
cf4299
+    }
cf4299
+    /* Return an "int" to match the 'typemap(out) int' in _lib.i */
cf4299
+    return 1;
cf4299
+}
cf4299
+
cf4299
 void ssl_set_client_CA_list_from_file(SSL *ssl, const char *ca_file) {
cf4299
     SSL_set_client_CA_list(ssl, SSL_load_client_CA_file(ca_file));
cf4299
 }