Used mariadb-connector-c-devel instead of mysql-devel

Resolves: rhbz#1494094
This commit is contained in:
Jaroslav Škarvada 2017-11-10 18:26:31 +01:00
parent 1063b058b4
commit 2845aec971
4 changed files with 86 additions and 20 deletions

View File

@ -11,7 +11,7 @@ index df3dcc8..de01565 100644
-LOOKUP_MYSQL=yes
+LOOKUP_LIBS=-lldap -llber -lsqlite3
+LOOKUP_MYSQL_INCLUDE=-I/usr/include/mysql
+LOOKUP_MYSQL_LIBS=-L/usr/${_lib}/mysql -lmysqlclient
+LOOKUP_MYSQL_LIBS=-lmysqlclient
+LOOKUP_PGSQL_LIBS=-lpq
+LOOKUP_MYSQL=2
LOOKUP_NIS=yes

View File

@ -1,10 +0,0 @@
--- a/src/lookups/mysql.c 2017-06-30 18:14:16.681819941 +0200
+++ b/src/lookups/mysql.c 2017-06-30 18:14:29.776921269 +0200
@@ -13,6 +13,7 @@
#include "lf_functions.h"
#include <mysql.h> /* The system header */
+#include <mysql_version.h>
/* Structure and anchor for caching connections. */

View File

@ -0,0 +1,73 @@
diff --git a/src/lookups/mysql.c b/src/lookups/mysql.c
index 5cf15af..b5133bc 100644
--- a/src/lookups/mysql.c
+++ b/src/lookups/mysql.c
@@ -14,6 +14,53 @@ functions. */
#include <mysql.h> /* The system header */
+/* We define symbols for *_VERSION_ID (numeric), *_VERSION_STR (char*)
+and *_BASE_STR (char*). It's a bit of guesswork. Especially for mariadb
+with versions before 10.2, as they do not define there there specific symbols.
+*/
+
+// Newer (>= 10.2) MariaDB
+#if defined MARIADB_VERSION_ID
+#define EXIM_MxSQL_VERSION_ID MARIADB_VERSION_ID
+
+// MySQL defines MYSQL_VERSION_ID, and MariaDB does so
+// https://dev.mysql.com/doc/refman/5.7/en/c-api-server-client-versions.html
+#elif defined LIBMYSQL_VERSION_ID
+#define EXIM_MxSQL_VERSION_ID LIBMYSQL_VERSION_ID
+#elif defined MYSQL_VERSION_ID
+#define EXIM_MxSQL_VERSION_ID MYSQL_VERSION_ID
+
+#else
+#define EXIM_MYSQL_VERSION_ID 0
+#endif
+
+// Newer (>= 10.2) MariaDB
+#ifdef MARIADB_CLIENT_VERSION_STR
+#define EXIM_MxSQL_VERSION_STR MARIADB_CLIENT_VERSION_STR
+
+// Mysql uses MYSQL_SERVER_VERSION
+#elif defined LIBMYSQL_VERSION
+#define EXIM_MxSQL_VERSION_STR LIBMYSQL_VERSION
+#elif defined MYSQL_SERVER_VERSION
+#define EXIM_MxSQL_VERSION_STR MYSQL_SERVER_VERSION
+
+#else
+#define EXIM_MxSQL_VERSION_STR "N.A."
+#endif
+
+#if defined MARIADB_BASE_VERSION
+#define EXIM_MxSQL_BASE_STR MARIADB_BASE_VERSION
+
+#elif defined MARIADB_PACKAGE_VERSION
+#define EXIM_MxSQL_BASE_STR "mariadb"
+
+#elif defined MYSQL_BASE_VERSION
+#define EXIM_MxSQL_BASE_STR MYSQL_BASE_VERSION
+
+#else
+#define EXIM_MxSQL_BASE_STR "n.A."
+#endif
+
/* Structure and anchor for caching connections. */
@@ -432,10 +479,10 @@ return quoted;
void
mysql_version_report(FILE *f)
{
-fprintf(f, "Library version: MySQL: Compile: %s [%s]\n"
- " Runtime: %s\n",
- MYSQL_SERVER_VERSION, MYSQL_COMPILATION_COMMENT,
- mysql_get_client_info());
+fprintf(f, "Library version: MySQL: Compile: %lu %s [%s]\n"
+ " Runtime: %lu %s\n",
+ (long)EXIM_MxSQL_VERSION_ID, EXIM_MxSQL_VERSION_STR, EXIM_MxSQL_BASE_STR,
+ mysql_get_client_version(), mysql_get_client_info());
#ifdef DYNLOOKUP
fprintf(f, " Exim version %s\n", EXIM_VERSION_STR);
#endif

View File

@ -14,7 +14,7 @@
Summary: The exim mail transfer agent
Name: exim
Version: 4.89
Release: 5%{?dist}
Release: 6%{?dist}
License: GPLv2+
Url: http://www.exim.org/
Group: System Environment/Daemons
@ -62,21 +62,20 @@ Patch25: exim-4.87-dynlookup-config.patch
# Upstream ticket: http://bugs.exim.org/show_bug.cgi?id=1584
Patch26: exim-4.85-pic.patch
Patch27: exim-4.89-environment.patch
# https://github.com/Exim/exim/pull/56
Patch28: exim-4.89-mariadb-10.2-compile-fix.patch
# Backported from upstream:
# https://github.com/Exim/exim/commit/65e061b76867a9ea7aeeb535341b790b90ae6c21
Patch29: exim-4.89-CVE-2017-1000369.patch
Patch28: exim-4.89-CVE-2017-1000369.patch
# Backported from upstream:
# https://git.exim.org/exim.git/commitdiff/14de8063d82edc5bf003ed50abdea55ac542679b
Patch30: exim-4.89-calloutsize.patch
Patch29: exim-4.89-calloutsize.patch
Patch30: exim-4.89-mariadb-macro-fix.patch
Requires: /etc/pki/tls/certs /etc/pki/tls/private
Requires: /etc/aliases
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
BuildRequires: libdb-devel openssl-devel openldap-devel pam-devel
BuildRequires: pcre-devel sqlite-devel tcp_wrappers-devel cyrus-sasl-devel
BuildRequires: openldap-devel openssl-devel mysql-devel postgresql-devel
BuildRequires: openldap-devel openssl-devel mariadb-connector-c-devel postgresql-devel
BuildRequires: libXaw-devel libXmu-devel libXext-devel libX11-devel libSM-devel
BuildRequires: perl-devel
BuildRequires: perl-generators
@ -216,9 +215,9 @@ greylisting unconditional.
%patch25 -p1 -b .dynconfig
%patch26 -p1 -b .fpic
%patch27 -p1 -b .environment
%patch28 -p1 -b .mariadb-10.2-compile-fix
%patch29 -p1 -b .CVE-2017-1000369
%patch30 -p1 -b .calloutsize
%patch28 -p1 -b .CVE-2017-1000369
%patch29 -p1 -b .calloutsize
%patch30 -p1 -b .mariadb-macro-fix
cp src/EDITME Local/Makefile
sed -i 's@^# LOOKUP_MODULE_DIR=.*@LOOKUP_MODULE_DIR=%{_libdir}/exim/%{version}-%{release}/lookups@' Local/Makefile
@ -599,6 +598,10 @@ test "$1" = 0 || %{_initrddir}/clamd.exim condrestart >/dev/null 2>&1 || :
%{_sysconfdir}/cron.daily/greylist-tidy.sh
%changelog
* Fri Nov 10 2017 Jaroslav Škarvada <jskarvad@redhat.com> - 4.89-6
- Used mariadb-connector-c-devel instead of mysql-devel
Resolves: rhbz#1494094
* Fri Aug 18 2017 Jaroslav Škarvada <jskarvad@redhat.com> - 4.89-5
- Fixed compilation with the mariadb-10.2
Resolves: rhbz#1467312