Bug 220224 - [PATCH] mail/postfix-current with mysql80-server
Summary: [PATCH] mail/postfix-current with mysql80-server
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Olli Hauer
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-06-23 09:20 UTC by Klaus Mayr
Modified: 2018-02-28 21:50 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (ohauer)


Attachments
proposed patchfile (772 bytes, patch)
2017-06-23 09:42 UTC, Klaus Mayr
no flags Details | Diff
add optional ssl patch für mysql80-server/client (954 bytes, patch)
2018-02-12 23:29 UTC, klaus
no flags Details | Diff
added as optional extra-patch file (676 bytes, patch)
2018-02-12 23:30 UTC, klaus
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Klaus Mayr 2017-06-23 09:20:57 UTC
If databases/mysql80-server is usedand postfix-current is compiled with mysql support, building postfix-current fails in the file src/global/dict_mysql.c 

MYSQL_OPT_SSL_VERIFY_SERVER_CERT needs to be replaced by MYSQL_OPT_SSL_MODE
to fix this problem.

See ==> https://dev.mysql.com/worklog/task/?id=9091 for details.

I added a few more lines to the file to for mysql >= 8.0.

Maybe a postfix developer can add this Patch in the postfix-source ?

##############################################################################

--- dict_mysql.org      2017-06-23 10:25:56.580165000 +0200
+++ dict_mysql.c        2017-06-23 10:14:55.081609000 +0200
@@ -656,7 +656,11 @@
                      dict_mysql->tls_key_file, dict_mysql->tls_cert_file,
                      dict_mysql->tls_CAfile, dict_mysql->tls_CApath,
                      dict_mysql->tls_ciphers);
-#if MYSQL_VERSION_ID >= 50023
+#if MYSQL_VERSION_ID >= 80000
+    if (dict_mysql->tls_verify_cert != -1)
+       mysql_options(host->db, MYSQL_OPT_SSL_MODE,
+                     &dict_mysql->tls_verify_cert);
+#elif MYSQL_VERSION_ID >= 50023
     if (dict_mysql->tls_verify_cert != -1)
        mysql_options(host->db, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
                      &dict_mysql->tls_verify_cert);

##############################################################################
Comment 1 Klaus Mayr 2017-06-23 09:42:26 UTC
Created attachment 183735 [details]
proposed patchfile
Comment 2 Walter Schwarzenfeld freebsd_triage 2018-02-09 00:23:12 UTC
Feedback please!
Comment 3 Klaus Mayr 2018-02-12 10:42:42 UTC
I still need to adjust the mentioned postfix source file to change
MYSQL_OPT_SSL_VERIFY_SERVER_CERT TO MYSQL_OPT_SSL_MODE to make
postfix compile with mysql80-client/server ...
Comment 4 Olli Hauer freebsd_committer 2018-02-12 19:42:56 UTC
This patch cannot be applied in general, it will break for example mariadb and I suspect also percona backends

For example mariadb102 has the following "#define MYSQL_VERSION_ID 100212" but not "MYSQL_OPT_SSL_MODE"
Comment 5 klaus 2018-02-12 22:14:49 UTC
Can we create an optional patch and a make config option instead (default=off) ?
Comment 6 klaus 2018-02-12 23:29:00 UTC
Created attachment 190558 [details]
add optional ssl patch für mysql80-server/client
Comment 7 klaus 2018-02-12 23:30:09 UTC
Created attachment 190559 [details]
added as optional extra-patch file
Comment 8 commit-hook freebsd_committer 2018-02-25 15:27:40 UTC
A commit references this bug:

Author: ohauer
Date: Sun Feb 25 15:27:31 UTC 2018
New revision: 462959
URL: https://svnweb.freebsd.org/changeset/ports/462959

Log:
  - update to 3.3.0
  - add patch for MySQL 8.x [1}
  - add blacklistd support [2]

  additional:
  - regenerate patch for src/util/sys_defs.h

  Release Notes:
  ftp://ftp.porcupine.org/mirrors/postfix-release/official/postfix-3.3.0.RELEASE_NOTES

  PR:		220224 [1], 225664 [2]
  Submitted by:	Klaus Mayr [1], Koichiro IWAO [2]

Changes:
  head/mail/postfix/Makefile
  head/mail/postfix/distinfo
  head/mail/postfix/files/extra-patch-blacklistd
  head/mail/postfix/files/patch-src__util__sys_defs.h
  head/mail/postfix/files/patch-src_global_dict__mysql.c
  head/mail/postfix/files/patch-src_util_sys__defs.h
Comment 9 commit-hook freebsd_committer 2018-02-25 15:40:02 UTC
A commit references this bug:

Author: ohauer
Date: Sun Feb 25 15:39:08 UTC 2018
New revision: 462961
URL: https://svnweb.freebsd.org/changeset/ports/462961

Log:
  - update to 3.4-20180222
  - add patch for MySQL 8.x [1}
  - add blacklistd support [2]

  additional:
   regenerate patch for src/util/sys_defs.h

  PR:           220224 [1], 225664 [2]
  Submitted by: Klaus Mayr [1], Koichiro IWAO [2]

Changes:
  head/mail/postfix-current/Makefile
  head/mail/postfix-current/distinfo
  head/mail/postfix-current/files/extra-patch-blacklistd
  head/mail/postfix-current/files/patch-src__util__sys_defs.h
  head/mail/postfix-current/files/patch-src_global_dict__mysql.c
  head/mail/postfix-current/files/patch-src_util_sys__defs.h
Comment 10 Olli Hauer freebsd_committer 2018-02-25 15:54:11 UTC
Thanks for the patch!

The main issue was not to apply it as extra patch, since this would be applied also to percona and mariadb but to identify something in percona and mariadb e.g.
mariadb defines MARIADB_VERSION_ID but percona defines nothing own and has a higher MYSQL_VERSION_ID the mysql 5.7.

I've send the now applied patch also upstream, hopefully it will be adopted by postfix.
Comment 11 commit-hook freebsd_committer 2018-02-28 21:50:29 UTC
A commit references this bug:

Author: ohauer
Date: Wed Feb 28 21:49:47 UTC 2018
New revision: 463264
URL: https://svnweb.freebsd.org/changeset/ports/463264

Log:
  - fix build agains maraidb100 [1]

  Firt definition of MARIADB_VERSION_ID can be found in mariadb102
  therefore we have to use MARIADB_BASE_VERSION which is defined in
  mariadb55 and mariadb10x

  PR:		226266 [1], 220224
  Reported by:	Zilon [1]

Changes:
  head/mail/postfix/files/patch-src_global_dict__mysql.c
Comment 12 commit-hook freebsd_committer 2018-02-28 21:50:35 UTC
A commit references this bug:

Author: ohauer
Date: Wed Feb 28 21:50:21 UTC 2018
New revision: 463265
URL: https://svnweb.freebsd.org/changeset/ports/463265

Log:
  - fix build agains maraidb100 [1]

  Firt definition of MARIADB_VERSION_ID can be found in mariadb102
  therefore we have to use MARIADB_BASE_VERSION which is defined in
  mariadb55 and mariadb10x

  PR:             226266 [1], 220224
  Reported by:    Zilon [1]

Changes:
  head/mail/postfix-current/files/patch-src_global_dict__mysql.c