[python26-m2crypto/el5/master: 37/78] - Update to m2crypto-0.18

gholms gholms at fedoraproject.org
Wed Feb 23 00:28:22 UTC 2011


commit 7f963ccea986d803b51cd4a151986d0d9e4754f0
Author: Miloslav Trmac <mitr at fedoraproject.org>
Date:   Tue Jul 31 22:25:52 2007 +0000

    - Update to m2crypto-0.18

 .cvsignore                                         |    2 +-
 m2crypto-0.17-Py_ssize_t.patch                     |  750 --------------------
 m2crypto-0.17-xmlrpc.patch                         |   13 -
 ...-timeouts.patch => m2crypto-0.18-timeouts.patch |  132 ++--
 m2crypto.spec                                      |   13 +-
 sources                                            |    2 +-
 6 files changed, 62 insertions(+), 850 deletions(-)
---
diff --git a/.cvsignore b/.cvsignore
index 469e518..ada769d 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1 +1 @@
-m2crypto-0.17.tar.gz
+m2crypto-0.18.tar.gz
diff --git a/m2crypto-0.17-timeouts.patch b/m2crypto-0.18-timeouts.patch
similarity index 86%
rename from m2crypto-0.17-timeouts.patch
rename to m2crypto-0.18-timeouts.patch
index f18b276..f42a8c9 100644
--- a/m2crypto-0.17-timeouts.patch
+++ b/m2crypto-0.18-timeouts.patch
@@ -1,7 +1,7 @@
-diff -ur m2crypto/M2Crypto/SSL/Connection.py m2crypto-0.16/M2Crypto/SSL/Connection.py
---- m2crypto/M2Crypto/SSL/Connection.py	2006-05-11 00:43:47.000000000 +0200
-+++ m2crypto-0.16/M2Crypto/SSL/Connection.py	2006-10-23 18:55:39.000000000 +0200
-@@ -36,9 +36,11 @@
+diff -ur m2crypto-0.18/M2Crypto/SSL/Connection.py m2crypto/M2Crypto/SSL/Connection.py
+--- m2crypto-0.18/M2Crypto/SSL/Connection.py	2007-06-15 23:34:05.000000000 +0200
++++ m2crypto/M2Crypto/SSL/Connection.py	2007-07-31 23:30:51.000000000 +0200
+@@ -37,9 +37,11 @@
              self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
              self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
          self._fileno = self.socket.fileno()
@@ -13,10 +13,10 @@ diff -ur m2crypto/M2Crypto/SSL/Connection.py m2crypto-0.16/M2Crypto/SSL/Connecti
 +        if self._timeout is None:
 +            self._timeout = -1.0
 +
-     def __del__(self):
-         if getattr(self, 'sslbio', None):
-             self.m2_bio_free(self.sslbio)
-@@ -122,7 +124,7 @@
+         self.ssl_close_flag = m2.bio_noclose
+ 
+         
+@@ -137,7 +139,7 @@
          m2.ssl_set_accept_state(self.ssl)
  
      def accept_ssl(self):
@@ -25,7 +25,7 @@ diff -ur m2crypto/M2Crypto/SSL/Connection.py m2crypto-0.16/M2Crypto/SSL/Connecti
  
      def accept(self):
          """Accept an SSL connection. The return value is a pair (ssl, addr) where
-@@ -144,7 +146,7 @@
+@@ -159,7 +161,7 @@
          m2.ssl_set_connect_state(self.ssl)
  
      def connect_ssl(self):
@@ -34,7 +34,7 @@ diff -ur m2crypto/M2Crypto/SSL/Connection.py m2crypto-0.16/M2Crypto/SSL/Connecti
  
      def connect(self, addr):
          self.socket.connect(addr)
-@@ -171,7 +173,7 @@
+@@ -186,7 +188,7 @@
          return m2.ssl_pending(self.ssl)
  
      def _write_bio(self, data):
@@ -43,7 +43,7 @@ diff -ur m2crypto/M2Crypto/SSL/Connection.py m2crypto-0.16/M2Crypto/SSL/Connecti
  
      def _write_nbio(self, data):
          return m2.ssl_write_nbio(self.ssl, data)
-@@ -179,7 +181,7 @@
+@@ -194,7 +196,7 @@
      def _read_bio(self, size=1024):
          if size <= 0:
              raise ValueError, 'size <= 0'
@@ -52,7 +52,7 @@ diff -ur m2crypto/M2Crypto/SSL/Connection.py m2crypto-0.16/M2Crypto/SSL/Connecti
  
      def _read_nbio(self, size=1024):
          if size <= 0:
-@@ -187,13 +189,13 @@
+@@ -202,13 +204,13 @@
          return m2.ssl_read_nbio(self.ssl, size)
  
      def write(self, data):
@@ -68,7 +68,7 @@ diff -ur m2crypto/M2Crypto/SSL/Connection.py m2crypto-0.16/M2Crypto/SSL/Connecti
              return self._read_bio(size)
          return self._read_nbio(size)
      recv = read
-@@ -201,7 +203,17 @@
+@@ -216,7 +218,17 @@
      def setblocking(self, mode):
          """Set this connection's underlying socket to _mode_."""
          self.socket.setblocking(mode)
@@ -87,7 +87,7 @@ diff -ur m2crypto/M2Crypto/SSL/Connection.py m2crypto-0.16/M2Crypto/SSL/Connecti
  
      def fileno(self):
          return self.socket.fileno()
-@@ -280,15 +292,8 @@
+@@ -293,15 +305,8 @@
          """Set the cipher suites for this connection."""
          return m2.ssl_set_cipher_list(self.ssl, cipher_list)
  
@@ -105,9 +105,9 @@ diff -ur m2crypto/M2Crypto/SSL/Connection.py m2crypto-0.16/M2Crypto/SSL/Connecti
  
      def getsockname(self):
          return self.socket.getsockname()
-diff -ur m2crypto/M2Crypto/SSL/__init__.py m2crypto-0.16/M2Crypto/SSL/__init__.py
---- m2crypto/M2Crypto/SSL/__init__.py	2006-03-20 20:26:28.000000000 +0100
-+++ m2crypto-0.16/M2Crypto/SSL/__init__.py	2006-10-23 19:53:10.000000000 +0200
+diff -ur m2crypto-0.18/M2Crypto/SSL/__init__.py m2crypto/M2Crypto/SSL/__init__.py
+--- m2crypto-0.18/M2Crypto/SSL/__init__.py	2006-03-20 20:26:28.000000000 +0100
++++ m2crypto/M2Crypto/SSL/__init__.py	2007-07-31 23:29:21.000000000 +0200
 @@ -2,11 +2,14 @@
  
  Copyright (c) 1999-2004 Ng Pheng Siong. All rights reserved."""
@@ -124,9 +124,9 @@ diff -ur m2crypto/M2Crypto/SSL/__init__.py m2crypto-0.16/M2Crypto/SSL/__init__.p
  
  # M2Crypto.SSL
  from Cipher import Cipher, Cipher_Stack
-diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
---- m2crypto/SWIG/_ssl.i	2006-04-01 00:11:55.000000000 +0200
-+++ m2crypto-0.16/SWIG/_ssl.i	2006-10-23 20:00:36.000000000 +0200
+diff -ur m2crypto-0.18/SWIG/_ssl.i m2crypto/SWIG/_ssl.i
+--- m2crypto-0.18/SWIG/_ssl.i	2007-06-05 02:30:11.000000000 +0200
++++ m2crypto/SWIG/_ssl.i	2007-08-01 00:06:34.000000000 +0200
 @@ -8,10 +8,13 @@
  
  %{
@@ -153,7 +153,7 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
  %constant int ssl_error_none              = SSL_ERROR_NONE;
  %constant int ssl_error_ssl               = SSL_ERROR_SSL;
  %constant int ssl_error_want_read         = SSL_ERROR_WANT_READ;
-@@ -192,14 +200,19 @@
+@@ -197,14 +205,19 @@
  %constant int SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER = SSL_MODE_ENABLE_PARTIAL_WRITE;
  %constant int SSL_MODE_AUTO_RETRY           = SSL_MODE_AUTO_RETRY;
  
@@ -174,7 +174,7 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
  }
  
  void ssl_ctx_passphrase_callback(SSL_CTX *ctx, PyObject *pyfunc) {
-@@ -353,36 +366,139 @@
+@@ -358,36 +371,130 @@
      return ret;
  }
  
@@ -205,10 +205,9 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
 +
 +static int ssl_sleep_with_timeout(SSL *ssl, const struct timeval *start,
 +                                  double timeout, int ssl_err) {
-+    PyGILState_STATE gilstate;
 +    struct pollfd fd;
 +    struct timeval tv;
-+    int ms;
++    int ms, tmp;
 +
 +    assert(timeout > 0);
 + again:
@@ -248,12 +247,13 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
 +            assert(0);
 +    }
 +    if (fd.fd == -1) {
-+        gilstate = PyGILState_Ensure();
 +        PyErr_SetString(_ssl_err, "timeout on a non-FD SSL");
-+        PyGILState_Release(gilstate);
 +        return -1;
 +    }
-+    switch (poll(&fd, 1, ms)) {
++    Py_BEGIN_ALLOW_THREADS
++    tmp = poll(&fd, 1, ms);
++    Py_END_ALLOW_THREADS
++    switch (tmp) {
 +    	case 1:
 +            return 0;
 +    	case 0:
@@ -261,17 +261,13 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
 +    	case -1:
 +            if (errno == EINTR)
 +                goto again;
-+            gilstate = PyGILState_Ensure();
 +            PyErr_SetFromErrno(_ssl_err);
-+            PyGILState_Release(gilstate);
 +            return -1;
 +    }
 +    return 0;
 +
 + timeout:
-+    gilstate = PyGILState_Ensure();
 +    PyErr_SetNone(_ssl_timeout_err);
-+    PyGILState_Release(gilstate);
 +    return -1;
 +}
 +
@@ -280,15 +276,15 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
 -    int r, err;
 +    int r, ssl_err;
 +    struct timeval tv;
-     PyGILState_STATE gilstate;
  
 +    if (timeout > 0)
 +        gettimeofday(&tv, NULL);
 + again:
+     Py_BEGIN_ALLOW_THREADS
      r = SSL_accept(ssl);
 +    ssl_err = SSL_get_error(ssl, r);
+     Py_END_ALLOW_THREADS
  
-     gilstate = PyGILState_Ensure();
  
 -    switch (SSL_get_error(ssl, r)) {
 +    switch (ssl_err) {
@@ -306,15 +302,10 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
 +                obj = PyInt_FromLong((long)0);
 +                break;
 +            }
-+
-+            PyGILState_Release(gilstate);
 +            if (ssl_sleep_with_timeout(ssl, &tv, timeout, ssl_err) == 0)
 +                goto again;
-+            gilstate = PyGILState_Ensure();
-+
              obj = NULL;
              break;
-+
 +        case SSL_ERROR_SSL:
          case SSL_ERROR_SYSCALL:
 -            err = ERR_get_error();
@@ -328,7 +319,7 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
              obj = NULL;
              break;
      }
-@@ -392,36 +508,43 @@
+@@ -396,36 +503,38 @@
      return obj;
  }
  
@@ -338,15 +329,15 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
 -    int r, err;
 +    int r, ssl_err;
 +    struct timeval tv;
-     PyGILState_STATE gilstate;
  
 +    if (timeout > 0)
 +        gettimeofday(&tv, NULL);
 + again:
+     Py_BEGIN_ALLOW_THREADS
      r = SSL_connect(ssl);
 +    ssl_err = SSL_get_error(ssl, r);
+     Py_END_ALLOW_THREADS
  
-     gilstate = PyGILState_Ensure();
      
 -    switch (SSL_get_error(ssl, r)) {
 +    switch (ssl_err) {
@@ -364,15 +355,10 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
 +                obj = PyInt_FromLong((long)0);
 +                break;
 +            }
-+
-+            PyGILState_Release(gilstate);
 +            if (ssl_sleep_with_timeout(ssl, &tv, timeout, ssl_err) == 0)
 +                goto again;
-+            gilstate = PyGILState_Ensure();
-+
              obj = NULL;
              break;
-+
 +        case SSL_ERROR_SSL:
          case SSL_ERROR_SYSCALL:
 -            err = ERR_get_error();
@@ -386,7 +372,7 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
              obj = NULL;
              break;
      }
-@@ -435,10 +558,11 @@
+@@ -438,10 +547,11 @@
      SSL_set_shutdown(ssl, mode);
  }
  
@@ -397,19 +383,20 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
 -    int r, err;
 +    int r;
 +    struct timeval tv;
-     PyGILState_STATE gilstate;
  
-     gilstate = PyGILState_Ensure();
-@@ -451,36 +575,48 @@
+     if (!(buf = PyMem_Malloc(num))) {
+         PyErr_SetString(PyExc_MemoryError, "ssl_read");
+@@ -449,37 +559,44 @@
+     }
  
-     PyGILState_Release(gilstate);
  
 +    if (timeout > 0)
 +        gettimeofday(&tv, NULL);
 + again:
+     Py_BEGIN_ALLOW_THREADS
      r = SSL_read(ssl, buf, num);
+     Py_END_ALLOW_THREADS
  
-     gilstate = PyGILState_Ensure();
  
 -    switch (SSL_get_error(ssl, r)) {
 -        case SSL_ERROR_NONE:
@@ -457,15 +444,10 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
 +                    obj = Py_None;
 +                    break;
 +                }
-+
-+                PyGILState_Release(gilstate);
 +                if (ssl_sleep_with_timeout(ssl, &tv, timeout, ssl_err) == 0)
 +                    goto again;
-+                gilstate = PyGILState_Ensure();
-+
 +                obj = NULL;
 +                break;
-+
 +            case SSL_ERROR_SSL:
 +            case SSL_ERROR_SYSCALL:
 +                ssl_handle_error(ssl_err, r);
@@ -475,7 +457,7 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
      }
      PyMem_Free(buf);
  
-@@ -543,9 +679,10 @@
+@@ -537,22 +654,26 @@
      return obj;
  }
  
@@ -485,29 +467,28 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
 -    int len, r, err, ret;
 +    int len, r, ssl_err, ret;
 +    struct timeval tv;
-     PyGILState_STATE gilstate;
  
-     gilstate = PyGILState_Ensure();
-@@ -556,12 +693,16 @@
+ 
+     if (m2_PyObject_AsReadBufferInt(blob, &buf, &len) == -1) {
+         return -1;
      }
  
-     PyGILState_Release(gilstate);
 -    
-+
 +    if (timeout > 0)
 +        gettimeofday(&tv, NULL);
 + again:
+     Py_BEGIN_ALLOW_THREADS
      r = SSL_write(ssl, buf, len);
 +    ssl_err = SSL_get_error(ssl, r);
+     Py_END_ALLOW_THREADS
  
-     gilstate = PyGILState_Ensure();
  
 -    switch (SSL_get_error(ssl, r)) {
 +    switch (ssl_err) {
          case SSL_ERROR_NONE:
          case SSL_ERROR_ZERO_RETURN:
              ret = r;
-@@ -569,20 +710,22 @@
+@@ -560,20 +681,17 @@
          case SSL_ERROR_WANT_WRITE:
          case SSL_ERROR_WANT_READ:
          case SSL_ERROR_WANT_X509_LOOKUP:
@@ -515,15 +496,10 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
 +                ret = -1;
 +                break;
 +            }
-+
-+            PyGILState_Release(gilstate);
 +            if (ssl_sleep_with_timeout(ssl, &tv, timeout, ssl_err) == 0)
 +                goto again;
-+            gilstate = PyGILState_Ensure();
-+
              ret = -1;
              break;
-+
          case SSL_ERROR_SSL:
 -            PyErr_SetString(_ssl_err, ERR_reason_error_string(ERR_get_error()));
 -            ret = -1;
@@ -540,12 +516,12 @@ diff -ur m2crypto/SWIG/_ssl.i m2crypto-0.16/SWIG/_ssl.i
          default:
              ret = -1;
      }
-diff -ur m2crypto/tests/test_ssl.py m2crypto-0.16/tests/test_ssl.py
---- m2crypto/tests/test_ssl.py	2006-10-22 01:22:57.000000000 +0200
-+++ m2crypto-0.16/tests/test_ssl.py	2006-10-23 20:14:46.000000000 +0200
-@@ -631,6 +631,53 @@
-             self.stop_server(pid)
-         self.failIf(string.find(data, 's_server -quiet -www') == -1)
+diff -ur m2crypto-0.18/tests/test_ssl.py m2crypto/tests/test_ssl.py
+--- m2crypto-0.18/tests/test_ssl.py	2007-07-02 22:25:45.000000000 +0200
++++ m2crypto/tests/test_ssl.py	2007-07-31 23:29:21.000000000 +0200
+@@ -887,6 +887,53 @@
+ 
+ class TwistedSSLClientTestCase(BaseSSLClientTestCase):
  
 +    def test_timeout(self):
 +        pid = self.start_server(self.args)
@@ -595,5 +571,5 @@ diff -ur m2crypto/tests/test_ssl.py m2crypto-0.16/tests/test_ssl.py
 +            self.stop_server(pid)
 +
      def test_twisted_wrapper(self):
-         #
-         # LEAK ALERT!
+         # Test only when twisted and ZopeInterfaces are present
+         try:
diff --git a/m2crypto.spec b/m2crypto.spec
index b9b1d2a..aae20a9 100644
--- a/m2crypto.spec
+++ b/m2crypto.spec
@@ -5,12 +5,10 @@
 
 Summary: Support for using OpenSSL in python scripts
 Name: m2crypto
-Version: 0.17
-Release: 3
+Version: 0.18
+Release: 1
 Source0: http://wiki.osafoundation.org/pub/Projects/MeTooCrypto/m2crypto-%{version}.tar.gz
-Patch0: m2crypto-0.17-timeouts.patch
-Patch1: m2crypto-0.17-Py_ssize_t.patch
-Patch2: m2crypto-0.17-xmlrpc.patch
+Patch0: m2crypto-0.18-timeouts.patch
 License: BSDish
 Group: System Environment/Libraries
 URL: http://wiki.osafoundation.org/bin/view/Projects/MeTooCrypto
@@ -25,8 +23,6 @@ This package allows you to call OpenSSL functions from python scripts.
 %prep
 %setup -q
 %patch0 -p1
-%patch1 -p1 -b .Py_ssize_t
-%patch2 -p1 -b .xmlrpc
 
 # Red Hat opensslconf.h #includes an architecture-specific file, but SWIG
 # doesn't follow the #include.
@@ -78,6 +74,9 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitearch}/M2Crypto
 
 %changelog
+* Wed Aug  1 2007 Miloslav Trmač <mitr at redhat.com> - 0.18-1
+- Update to m2crypto-0.18
+
 * Wed Jul 11 2007 Miloslav Trmač <mitr at redhat.com> - 0.17-3
 - Try to fix build on Alpha
   Resolves: #246828
diff --git a/sources b/sources
index 5b26557..96e812b 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-c67b45c752fd5e8115cd6b14831c5a38  m2crypto-0.17.tar.gz
+4e5432d08fd50287b80ac2237f01bda3  m2crypto-0.18.tar.gz


More information about the scm-commits mailing list