[MySQL-python/f16] Fix failure to enable SSL support with mysql 5.5
Tom Lane
tgl at fedoraproject.org
Sat Jul 14 21:16:45 UTC 2012
commit fe6bd9d8602a8c555d72ab5fca3b688071c0b2da
Author: Tom Lane <tgl at redhat.com>
Date: Sat Jul 14 17:16:38 2012 -0400
Fix failure to enable SSL support with mysql 5.5
MySQL-python-no-openssl.patch | 53 +++++++++++++++++++++++++++++++++++++++++
MySQL-python.spec | 9 ++++++-
2 files changed, 61 insertions(+), 1 deletions(-)
---
diff --git a/MySQL-python-no-openssl.patch b/MySQL-python-no-openssl.patch
new file mode 100644
index 0000000..438df84
--- /dev/null
+++ b/MySQL-python-no-openssl.patch
@@ -0,0 +1,53 @@
+mysql 5.5 does not export a HAVE_OPENSSL symbol, thus breaking MySQL-python's
+rather-misguided-anyway conditional compilation for SSL support. Since we
+have no intention of ever shipping a non-SSL-enabled mysql in Fedora/RHEL,
+we can just drop the conditionals, pending some other fix upstream.
+(Since mysql_ssl_set is supposed to exist anyway, this might well be a
+suitable fix for upstream too.)
+
+
+diff -Naur MySQL-python-1.2.3.orig/_mysql.c MySQL-python-1.2.3/_mysql.c
+--- MySQL-python-1.2.3.orig/_mysql.c 2010-06-17 03:21:56.000000000 -0400
++++ MySQL-python-1.2.3/_mysql.c 2012-07-14 16:49:31.590349235 -0400
+@@ -475,10 +475,8 @@
+ MYSQL *conn = NULL;
+ PyObject *conv = NULL;
+ PyObject *ssl = NULL;
+-#if HAVE_OPENSSL
+ char *key = NULL, *cert = NULL, *ca = NULL,
+ *capath = NULL, *cipher = NULL;
+-#endif
+ char *host = NULL, *user = NULL, *passwd = NULL,
+ *db = NULL, *unix_socket = NULL;
+ unsigned int port = 0;
+@@ -519,18 +517,12 @@
+ PyErr_Clear();}
+
+ if (ssl) {
+-#if HAVE_OPENSSL
+ PyObject *value = NULL;
+ _stringsuck(ca, value, ssl);
+ _stringsuck(capath, value, ssl);
+ _stringsuck(cert, value, ssl);
+ _stringsuck(key, value, ssl);
+ _stringsuck(cipher, value, ssl);
+-#else
+- PyErr_SetString(_mysql_NotSupportedError,
+- "client library does not have SSL support");
+- return -1;
+-#endif
+ }
+
+ Py_BEGIN_ALLOW_THREADS ;
+@@ -556,11 +548,9 @@
+ if (local_infile != -1)
+ mysql_options(&(self->connection), MYSQL_OPT_LOCAL_INFILE, (char *) &local_infile);
+
+-#if HAVE_OPENSSL
+ if (ssl)
+ mysql_ssl_set(&(self->connection),
+ key, cert, ca, capath, cipher);
+-#endif
+
+ conn = mysql_real_connect(&(self->connection), host, user, passwd, db,
+ port, unix_socket, client_flag);
diff --git a/MySQL-python.spec b/MySQL-python.spec
index 7aaf70e..da58561 100644
--- a/MySQL-python.spec
+++ b/MySQL-python.spec
@@ -1,13 +1,15 @@
Summary: An interface to MySQL
Name: MySQL-python
Version: 1.2.3
-Release: 3%{?dist}
+Release: 5%{?dist}
License: GPLv2+
Group: Development/Libraries
URL: http://sourceforge.net/projects/mysql-python/
Source0: http://prdownloads.sourceforge.net/mysql-python/MySQL-python-%{version}.tar.gz
+Patch1: MySQL-python-no-openssl.patch
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: python-devel python-setuptools
BuildRequires: mysql-devel zlib-devel
@@ -33,6 +35,8 @@ not actively maintained. No code from that version is used in MySQLdb.
%prep
%setup -q -n %{name}-%{version}
+%patch1 -p1
+
%build
rm -f doc/*~
export libdirname=%{_lib}
@@ -57,6 +61,9 @@ rm -rf $RPM_BUILD_ROOT
%dir /usr/%{_lib}/python?.?/site-packages/MySQLdb/constants
%changelog
+* Sat Jul 14 2012 Tom Lane <tgl at redhat.com> 1.2.3-5
+- Fix failure to enable SSL support with mysql 5.5, per Matthias Runge
+
* Tue Mar 22 2011 Tom Lane <tgl at redhat.com> 1.2.3-3
- Rebuild for libmysqlclient 5.5.10 soname version bump
More information about the scm-commits
mailing list