commit:     8aa66b24df477ccaed3070eae1e7dcc63d1b5992
Author:     Marco Scardovi <scardracs-gentoo <AT> proton <DOT> me>
AuthorDate: Sat Jan 14 21:48:57 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jan 14 22:07:13 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8aa66b24

net-mail/qmail-autoresponder: update EAPI 7 -> 8, backport patches

- Backport build fix w/o MySQL
- Backport UB fix

Closes: https://bugs.gentoo.org/740804
Signed-off-by: Marco Scardovi <scardracs-gentoo <AT> proton.me>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../qmail-autoresponder-2.0-clear-struct.patch     | 25 ++++++++++
 .../files/qmail-autoresponder-2.0-drop-mysql.patch | 21 +++++++++
 .../qmail-autoresponder-2.0-r1.ebuild              | 54 ++++++++++++++++++++++
 3 files changed, 100 insertions(+)

diff --git 
a/net-mail/qmail-autoresponder/files/qmail-autoresponder-2.0-clear-struct.patch 
b/net-mail/qmail-autoresponder/files/qmail-autoresponder-2.0-clear-struct.patch
new file mode 100644
index 000000000000..9a43d73465ec
--- /dev/null
+++ 
b/net-mail/qmail-autoresponder/files/qmail-autoresponder-2.0-clear-struct.patch
@@ -0,0 +1,25 @@
+Patch: 
https://github.com/bruceg/qmail-autoresponder/commit/baea8ec70d62fbc50868074c050dcb89f1a43f63
+
+From baea8ec70d62fbc50868074c050dcb89f1a43f63 Mon Sep 17 00:00:00 2001
+From: Bruce Guenter <[email protected]>
+Date: Fri, 13 Apr 2018 10:39:45 -0600
+Subject: [PATCH] options: Clear time struct before using
+
+The strptime may not set all the fields in struct tm, so we need to
+clear it before parsing, so that mktime doesn't use uninitialized data.
+---
+ options.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/options.c b/options.c
+index 325ea83..ce63867 100644
+--- a/options.c
++++ b/options.c
+@@ -87,6 +87,7 @@ static const char* copy_time(void* ptr, const char* value, 
unsigned int length)
+   }
+   for (i = 0; i < sizeof time_formats / sizeof *time_formats; i++) {
+     struct tm tm;
++    memset(&tm, 0, sizeof tm);
+     if (strptime(value, time_formats[i], &tm) == value + length) {
+       if ((*dest = mktime(&tm)) != (time_t)-1)
+         return NULL;

diff --git 
a/net-mail/qmail-autoresponder/files/qmail-autoresponder-2.0-drop-mysql.patch 
b/net-mail/qmail-autoresponder/files/qmail-autoresponder-2.0-drop-mysql.patch
new file mode 100644
index 000000000000..280e5af722e0
--- /dev/null
+++ 
b/net-mail/qmail-autoresponder/files/qmail-autoresponder-2.0-drop-mysql.patch
@@ -0,0 +1,21 @@
+Patch: 
https://github.com/bruceg/qmail-autoresponder/commit/514a15e22d2eaf888592690f6be3e7c7dd18b7d0
+Bug: https://bugs.gentoo.org/740804
+From 514a15e22d2eaf888592690f6be3e7c7dd18b7d0 Mon Sep 17 00:00:00 2001
+From: Bruce Guenter <[email protected]>
+Date: Fri, 13 Apr 2018 10:27:03 -0600
+Subject: [PATCH] options: Drop the extraneous #include <mysql/mysql.h>
+
+---
+ options.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/options.c b/options.c
+index 8d1d1e4..325ea83 100644
+--- a/options.c
++++ b/options.c
+@@ -1,5 +1,4 @@
+ #define _XOPEN_SOURCE
+-#include <mysql/mysql.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <time.h>

diff --git a/net-mail/qmail-autoresponder/qmail-autoresponder-2.0-r1.ebuild 
b/net-mail/qmail-autoresponder/qmail-autoresponder-2.0-r1.ebuild
new file mode 100644
index 000000000000..1580fd65df44
--- /dev/null
+++ b/net-mail/qmail-autoresponder/qmail-autoresponder-2.0-r1.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="Rate-limited autoresponder for qmail"
+HOMEPAGE="https://untroubled.org/qmail-autoresponder/";
+SRC_URI="https://untroubled.org/qmail-autoresponder/archive/${P}.tar.gz";
+
+SLOT="0"
+LICENSE="GPL-2+"
+KEYWORDS="~alpha ~amd64 ~hppa ~mips ~ppc ~sparc ~x86"
+IUSE="mysql"
+
+DEPEND="
+       >=dev-libs/bglibs-2.04
+       mysql? ( dev-db/mysql-connector-c:0= )
+"
+RDEPEND="
+       ${DEPEND}
+       virtual/qmail
+       mysql? ( virtual/mysql )
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-clear-struct.patch"
+       "${FILESDIR}/${P}-drop-mysql.patch"
+)
+
+src_configure() {
+       echo "$(tc-getCC) ${CFLAGS}" > conf-cc || die
+       echo "$(tc-getCC) ${LDFLAGS}" > conf-ld || die
+}
+
+src_compile() {
+       emake qmail-autoresponder
+       if use mysql; then
+               emake qmail-autoresponder-mysql
+       fi
+}
+
+src_install() {
+       dobin qmail-autoresponder
+       doman qmail-autoresponder.1
+       if use mysql; then
+               dobin qmail-autoresponder-mysql
+               doman qmail-autoresponder-mysql.1
+               dodoc schema.mysql
+       fi
+
+       dodoc ANNOUNCEMENT NEWS README TODO ChangeLog procedure.txt
+}

Reply via email to