diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2018-07-28 18:00:05 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2018-07-28 18:42:56 +0200 |
commit | 44e80ac21d375f4d3f5d01a3d6a00bba7d3669c3 (patch) | |
tree | 4ad59c677c1a326e52893a865190e19f9c87751f /testing | |
parent | cc0e1d47180c780dec1424b4030842710a9dac74 (diff) | |
download | aports-44e80ac21d375f4d3f5d01a3d6a00bba7d3669c3.tar.bz2 aports-44e80ac21d375f4d3f5d01a3d6a00bba7d3669c3.tar.xz |
testing/opensmtpd-extras: fix compatibility with opensmtpd 5.9+
Diffstat (limited to 'testing')
-rw-r--r-- | testing/opensmtpd-extras/APKBUILD | 7 | ||||
-rw-r--r-- | testing/opensmtpd-extras/fix-opensmtpd-5.9+-compat.patch | 177 |
2 files changed, 182 insertions, 2 deletions
diff --git a/testing/opensmtpd-extras/APKBUILD b/testing/opensmtpd-extras/APKBUILD index 18994c5f32..e8d616af1f 100644 --- a/testing/opensmtpd-extras/APKBUILD +++ b/testing/opensmtpd-extras/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Shiz <hi@shiz.me> pkgname=opensmtpd-extras pkgver=201703132115 -pkgrel=3 +pkgrel=4 pkgdesc="OpenSMTPD addons" url="https://opensmtpd.org/" arch="all" @@ -12,7 +12,9 @@ makedepends="libressl-dev libevent-dev python2-dev mariadb-connector-c-dev postg hiredis-dev sqlite-dev" subpackages="$pkgname-doc" source="https://www.opensmtpd.org/archives/$pkgname-$pkgver.tar.gz - remove-decls.patch" + fix-opensmtpd-5.9+-compat.patch + remove-decls.patch + " builddir="$srcdir/$pkgname-$pkgver" options="!check" # upstream does not provide tests @@ -80,4 +82,5 @@ _package_extra() { } sha512sums="d841c63445ca674b368a5aa6012ae90e46b0c31b650067bdcea5badca3d818b1b732be880b2a18421fb39d07291dd413455944b178597bc13ae6ff5c75ac9aed opensmtpd-extras-201703132115.tar.gz +e14990a94c9114958b1070467ca1119162b24a8ef9c4fee1ff6deb8b18bdc2a532e952e65fce1f6e5346c3bb784d623773a237d48384143c2cdcce80f60a5d4a fix-opensmtpd-5.9+-compat.patch 36efd3b6cf75728cc8b75b3d9d6bf464d1e949ccfbe6151ed53dbba0f9ee1e50eb61afcca05af302ab359bc9ea1136e7750a15e5f5b824899141298d3060782a remove-decls.patch" diff --git a/testing/opensmtpd-extras/fix-opensmtpd-5.9+-compat.patch b/testing/opensmtpd-extras/fix-opensmtpd-5.9+-compat.patch new file mode 100644 index 0000000000..ec87bc1492 --- /dev/null +++ b/testing/opensmtpd-extras/fix-opensmtpd-5.9+-compat.patch @@ -0,0 +1,177 @@ +From 5cd4a2022b30a70dc02d030e4b7bc90d5afe61cb Mon Sep 17 00:00:00 2001 +From: Jakub Jirutka <jakub@jirutka.cz> +Date: Sat, 28 Jul 2018 16:02:00 +0200 +Subject: [PATCH] fix compatibility with opensmtpd 5.9+ + +This mirrors changes done in [1]. + +When a table from extras is used (tested with passwd and postgres), +opensmtpd failes to start (on Alpine Linux): + + passwd[7508]: warn: table-proc: bogus data + passwd[7508]: fatal: table-proc: exiting + warn: table-proc: pipe closed + fatal: table-proc: exiting + +The error is printed by the table process and it's cased by mismatch +between expected and actual size of the struct table_open_params. + +Note: I've originally tried to port even changes of includes from [1], +but that would need to add many new includes to most of the extras. +Thus I've eventually decided that it's probably not the right approach. + +Fixes: https://github.com/OpenSMTPD/OpenSMTPD/issues/816 + +[1]: https://github.com/OpenSMTPD/OpenSMTPD/commit/5dfecad33e1301343473f7e9a6e425cdd11b9c3f + +Upstream-Issue: https://github.com/OpenSMTPD/OpenSMTPD-extras/pull/53 +--- + api/filter_api.c | 6 +++--- + api/queue_api.c | 2 +- + api/queue_utils.c | 2 +- + api/smtpd-api.h | 3 ++- + api/smtpd-defines.h | 5 ----- + api/to.c | 4 ++-- + extras/tables/table-mysql/table_mysql.c | 6 +++--- + 7 files changed, 12 insertions(+), 16 deletions(-) + +diff --git a/api/filter_api.c b/api/filter_api.c +index e3743c8..659a5fc 100644 +--- a/api/filter_api.c ++++ b/api/filter_api.c +@@ -652,8 +652,8 @@ filter_io_in(struct io *io, int evt) + case IO_DATAIN: + nextline: + line = iobuf_getline(&s->pipe.ibuf, &len); +- if ((line == NULL && iobuf_len(&s->pipe.ibuf) >= SMTPD_MAXLINESIZE) || +- (line && len >= SMTPD_MAXLINESIZE)) { ++ if ((line == NULL && iobuf_len(&s->pipe.ibuf) >= LINE_MAX) || ++ (line && len >= LINE_MAX)) { + s->pipe.error = 1; + break; + } +@@ -1210,7 +1210,7 @@ filter_api_sockaddr_to_text(const struct sockaddr *sa) + const char * + filter_api_mailaddr_to_text(const struct mailaddr *maddr) + { +- static char buffer[SMTPD_MAXLINESIZE]; ++ static char buffer[LINE_MAX]; + + strlcpy(buffer, maddr->user, sizeof buffer); + if (maddr->domain[0] == '\0') +diff --git a/api/queue_api.c b/api/queue_api.c +index 4c6de84..3c1ea8d 100644 +--- a/api/queue_api.c ++++ b/api/queue_api.c +@@ -111,7 +111,7 @@ queue_msg_dispatch(void) + uint64_t evpid; + uint32_t msgid, version; + size_t n, m; +- char buffer[8192], path[SMTPD_MAXPATHLEN]; ++ char buffer[8192], path[PATH_MAX]; + int r, fd; + FILE *ifile, *ofile; + +diff --git a/api/queue_utils.c b/api/queue_utils.c +index 45dced5..7eafd1b 100644 +--- a/api/queue_utils.c ++++ b/api/queue_utils.c +@@ -59,7 +59,7 @@ int + mktmpfile(void) + { + static char *tempdir = "/temporary"; +- char path[SMTPD_MAXPATHLEN]; ++ char path[PATH_MAX]; + int fd; + mode_t omode; + +diff --git a/api/smtpd-api.h b/api/smtpd-api.h +index 3416989..2595d68 100644 +--- a/api/smtpd-api.h ++++ b/api/smtpd-api.h +@@ -27,6 +27,7 @@ + #include <stdio.h> + #include <netinet/in.h> + #include <netdb.h> ++#include <limits.h> + + #include <event.h> + #include <imsg.h> +@@ -229,7 +230,7 @@ struct scheduler_info { + + struct table_open_params { + uint32_t version; +- char name[SMTPD_MAXLINESIZE]; ++ char name[LINE_MAX]; + }; + + enum table_service { +diff --git a/api/smtpd-defines.h b/api/smtpd-defines.h +index 2ced70e..f34eda8 100644 +--- a/api/smtpd-defines.h ++++ b/api/smtpd-defines.h +@@ -61,11 +61,6 @@ enum smtp_proc_type { + #define SMTPD_MAXLOCALPARTSIZE (255 + 1) + #define SMTPD_MAXDOMAINPARTSIZE (255 + 1) + +-#define SMTPD_MAXLOGNAME 32 +-#define SMTPD_MAXPATHLEN 1024 +-#define SMTPD_MAXHOSTNAMELEN 256 +-#define SMTPD_MAXLINESIZE 2048 +- + #define SMTPD_USER "_smtpd" + #define PATH_CHROOT "/var/empty" + #define SMTPD_QUEUE_USER "_smtpq" +diff --git a/api/to.c b/api/to.c +index e048341..2f0d294 100644 +--- a/api/to.c ++++ b/api/to.c +@@ -92,7 +92,7 @@ text_to_mailaddr(struct mailaddr *maddr, const char *email) + { + char *username; + char *hostname; +- char buffer[SMTPD_MAXLINESIZE]; ++ char buffer[LINE_MAX]; + + if (strlcpy(buffer, email, sizeof buffer) >= sizeof buffer) + return 0; +@@ -129,7 +129,7 @@ text_to_mailaddr(struct mailaddr *maddr, const char *email) + const char * + mailaddr_to_text(const struct mailaddr *maddr) + { +- static char buffer[SMTPD_MAXLINESIZE]; ++ static char buffer[LINE_MAX]; + + (void)strlcpy(buffer, maddr->user, sizeof buffer); + (void)strlcat(buffer, "@", sizeof buffer); +diff --git a/extras/tables/table-mysql/table_mysql.c b/extras/tables/table-mysql/table_mysql.c +index 449a693..2c32060 100644 +--- a/extras/tables/table-mysql/table_mysql.c ++++ b/extras/tables/table-mysql/table_mysql.c +@@ -68,7 +68,7 @@ static void config_free(struct config *); + #define DEFAULT_REFRESH 1000 + + static MYSQL_BIND results[SQL_MAX_RESULT]; +-static char results_buffer[SQL_MAX_RESULT][SMTPD_MAXLINESIZE]; ++static char results_buffer[SQL_MAX_RESULT][LINE_MAX]; + static char *conffile; + static struct config *config; + +@@ -333,7 +333,7 @@ table_mysql_query(const char *key, int service) + MYSQL_STMT *stmt; + MYSQL_BIND param[1]; + unsigned long keylen; +- char buffer[SMTPD_MAXLINESIZE]; ++ char buffer[LINE_MAX]; + int i; + + retry: +@@ -586,7 +586,7 @@ main(int argc, char **argv) + for (i = 0; i < SQL_MAX_RESULT; i++) { + results[i].buffer_type = MYSQL_TYPE_STRING; + results[i].buffer = results_buffer[i]; +- results[i].buffer_length = SMTPD_MAXLINESIZE; ++ results[i].buffer_length = LINE_MAX; + results[i].is_null = 0; + } + |