Mail archive
alpine-aports

[alpine-aports] [PATCH] testing/dma: update to HEAD plus fixes

From: Steffen Nurpmeso <steffen_at_sdaoden.eu>
Date: Wed, 31 Jan 2018 22:28:28 +0100

This configuration (though compiled and installed manually not via
package) works for me since end of October 2017.
Compared to the two year old release v0.11 this includes
severel security and other bug fixes.
---
 ...hangeset-seen-on-svn-src-head-freebsd.org.patch |  34 ++++++
 .../dma/0002-Compile-and-run-on-AlpineLinux.patch  | 136 +++++++++++++++++++++
 abuild-pkg/testing/dma/APKBUILD                    |  62 ++++++++++
 abuild-pkg/testing/dma/aliases                     |  22 ++++
 abuild-pkg/testing/dma/dma.cron                    |   5 +
 5 files changed, 259 insertions(+)
 create mode 100644 abuild-pkg/testing/dma/0001-Apply-changeset-seen-on-svn-src-head-freebsd.org.patch
 create mode 100644 abuild-pkg/testing/dma/0002-Compile-and-run-on-AlpineLinux.patch
 create mode 100644 abuild-pkg/testing/dma/APKBUILD
 create mode 100644 abuild-pkg/testing/dma/aliases
 create mode 100644 abuild-pkg/testing/dma/dma.cron
diff --git a/abuild-pkg/testing/dma/0001-Apply-changeset-seen-on-svn-src-head-freebsd.org.patch b/abuild-pkg/testing/dma/0001-Apply-changeset-seen-on-svn-src-head-freebsd.org.patch
new file mode 100644
index 0000000..7c347db
--- /dev/null
+++ b/abuild-pkg/testing/dma/0001-Apply-changeset-seen-on-svn-src-head-freebsd.org.patch
_at_@ -0,0 +1,34 @@
+From 6ccab27a89c55304a78f1825f77de62046cf7c13 Mon Sep 17 00:00:00 2001
+Message-Id: <6ccab27a89c55304a78f1825f77de62046cf7c13.1517433905.git.steffen_at_sdaoden.eu>
+From: Steffen Nurpmeso <steffen_at_sdaoden.eu>
+Date: Fri, 27 Oct 2017 23:05:28 +0200
+Subject: [PATCH 1/2] Apply changeset seen on svn-src-head_at_freebsd.org..
+
+  From: Ed Maste <emaste_at_FreeBSD.org>
+  Subject: svn commit: r325047 - head/contrib/dma
+  Date: Fri, 27 Oct 2017 20:21:09 +0000 (UTC)
+  Message-ID: <201710272021.v9RKL9nw046658_at_repo.freebsd.org>
+  To: src-committers_at_freebsd.org, svn-src-all_at_freebsd.org, svn-src-head_at_freebsd.org
+
+  Author: emaste
+  Date: Fri Oct 27 20:21:09 2017
+  New Revision: 325047
+  URL: https://svnweb.freebsd.org/changeset/base/325047
+
+diff --git a/dma.c b/dma.c
+index e643e0f..126aad7 100644
+--- a/dma.c
++++ b/dma.c
+_at_@ -331,8 +331,8 @@ retry:
+ 
+ 	switch (error) {
+ 	case 0:
+-		delqueue(it);
+ 		syslog(LOG_INFO, "<%s> delivery successful", it->addr);
++		delqueue(it);
+ 		exit(EX_OK);
+ 
+ 	case 1:
+-- 
+2.16.1
+
diff --git a/abuild-pkg/testing/dma/0002-Compile-and-run-on-AlpineLinux.patch b/abuild-pkg/testing/dma/0002-Compile-and-run-on-AlpineLinux.patch
new file mode 100644
index 0000000..a539cd1
--- /dev/null
+++ b/abuild-pkg/testing/dma/0002-Compile-and-run-on-AlpineLinux.patch
_at_@ -0,0 +1,136 @@
+From f8f802f4fdf7858789c386df45cd45e43f960fe9 Mon Sep 17 00:00:00 2001
+Message-Id: <f8f802f4fdf7858789c386df45cd45e43f960fe9.1517433905.git.steffen_at_sdaoden.eu>
+In-Reply-To: <6ccab27a89c55304a78f1825f77de62046cf7c13.1517433905.git.steffen_at_sdaoden.eu>
+References: <6ccab27a89c55304a78f1825f77de62046cf7c13.1517433905.git.steffen_at_sdaoden.eu>
+From: Steffen Nurpmeso <steffen_at_sdaoden.eu>
+Date: Tue, 7 Nov 2017 16:02:38 +0100
+Subject: [PATCH 2/2] Compile and run on AlpineLinux
+
+---
+ dfcompat.c        | 2 +-
+ dma-mbox-create.c | 5 ++---
+ dma.c             | 1 -
+ dma.h             | 7 +++++--
+ dns.c             | 3 +++
+ local.c           | 3 +--
+ 7 files changed, 13 insertions(+), 10 deletions(-)
+
+diff --git a/dfcompat.c b/dfcompat.c
+index 8df906e..b3cb878 100644
+--- a/dfcompat.c
++++ b/dfcompat.c
+_at_@ -105,7 +105,7 @@ reallocf(void *ptr, size_t size)
+ 
+ #ifndef HAVE_GETPROGNAME
+ 
+-#ifdef __GLIBC__
++#ifdef __linux__
+ 
+ #include <errno.h>
+ 
+diff --git a/dma-mbox-create.c b/dma-mbox-create.c
+index 8008860..3be17f9 100644
+--- a/dma-mbox-create.c
++++ b/dma-mbox-create.c
+_at_@ -44,7 +44,6 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <grp.h>
+-#include <paths.h>
+ #include <pwd.h>
+ #include <stdio.h>
+ #include <syslog.h>
+_at_@ -129,9 +128,9 @@ main(int argc, char **argv)
+ 	if (!pw)
+ 		logfail(EX_NOUSER, "cannot find user `%s'", user);
+ 
+-	maildirfd = open(_PATH_MAILDIR, O_RDONLY);
++	maildirfd = open(MAILDIR_PATH, O_RDONLY);
+ 	if (maildirfd < 0)
+-		logfail(EX_NOINPUT, "cannot open maildir %s", _PATH_MAILDIR);
++		logfail(EX_NOINPUT, "cannot open maildir %s", MAILDIR_PATH);
+ 
+ 	user_uid = pw->pw_uid;
+ 
+diff --git a/dma.c b/dma.c
+index 126aad7..4af1501 100644
+--- a/dma.c
++++ b/dma.c
+_at_@ -48,7 +48,6 @@
+ #include <fcntl.h>
+ #include <inttypes.h>
+ #include <libgen.h>
+-#include <paths.h>
+ #include <pwd.h>
+ #include <signal.h>
+ #include <stdarg.h>
+diff --git a/dma.h b/dma.h
+index 5934176..fb27d44 100644
+--- a/dma.h
++++ b/dma.h
+_at_@ -38,7 +38,7 @@
+ #define DMA_H
+ 
+ #include <sys/types.h>
+-#include <sys/queue.h>
++#include <bsd/sys/queue.h>
+ #include <sys/socket.h>
+ #include <arpa/nameser.h>
+ #include <arpa/inet.h>
+_at_@ -81,7 +81,7 @@
+ #define SPOOL_FLUSHFILE	"flush"
+ 
+ #ifndef DMA_ROOT_USER
+-#define DMA_ROOT_USER	"mail"
++#define DMA_ROOT_USER	"smtpd"
+ #endif
+ #ifndef DMA_GROUP
+ #define DMA_GROUP	"mail"
+_at_@ -91,6 +91,9 @@
+ #define MBOX_STRICT	0
+ #endif
+ 
++#ifndef MAILDIR_PATH
++# define MAILDIR_PATH	"/var/spool/mail"
++#endif
+ 
+ struct stritem {
+ 	SLIST_ENTRY(stritem) next;
+diff --git a/dns.c b/dns.c
+index bd28c4d..e95cc4a 100644
+--- a/dns.c
++++ b/dns.c
+_at_@ -45,6 +45,9 @@
+ #include <stdlib.h>
+ 
+ #include "dma.h"
++#ifndef roundup
++#define roundup(x, y)  ((((x) + ((y) - 1)) / (y)) * (y))
++#endif
+ 
+ static int
+ sort_pref(const void *a, const void *b)
+diff --git a/local.c b/local.c
+index 2bfdbb3..27d5b43 100644
+--- a/local.c
++++ b/local.c
+_at_@ -40,7 +40,6 @@
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <limits.h>
+-#include <paths.h>
+ #include <signal.h>
+ #include <stdint.h>
+ #include <stdio.h>
+_at_@ -137,7 +136,7 @@ deliver_local(struct qitem *it)
+ 	off_t mboxlen;
+ 	time_t now = time(NULL);
+ 
+-	error = snprintf(fn, sizeof(fn), "%s/%s", _PATH_MAILDIR, it->addr);
++	error = snprintf(fn, sizeof(fn), "%s/%s", MAILDIR_PATH, it->addr);
+ 	if (error < 0 || (size_t)error >= sizeof(fn)) {
+ 		syslog(LOG_NOTICE, "local delivery deferred: %m");
+ 		return (1);
+-- 
+2.16.1
+
diff --git a/abuild-pkg/testing/dma/APKBUILD b/abuild-pkg/testing/dma/APKBUILD
new file mode 100644
index 0000000..043bd80
--- /dev/null
+++ b/abuild-pkg/testing/dma/APKBUILD
_at_@ -0,0 +1,62 @@
+# Contributor: Sören Tempel <soeren+alpine_at_soeren-tempel.net>
+# Contributor: Steffen Nurpmeso <steffen_at_sdaoden.eu>
+# Maintainer:
+pkgname=dma
+pkgver=20180131
+pkgsha=47ac0463433c187ff4528f2b0b9eb75f63866815
+pkgrel=0
+pkgdesc="DragonFly (BSD) Mail Agent"
+url="https://github.com/corecode/dma"
+arch="all"
+license="BSD"
+depends=""
+makedepends="byacc flex libbsd-dev bsd-compat-headers libressl-dev"
+options="suid !check"
+subpackages="$pkgname-doc"
+source="$pkgname-$pkgver.tar.gz::https://github.com/corecode/$pkgname/archive/$pkgsha.tar.gz
+	aliases
+	$pkgname.cron
+	0001-Apply-changeset-seen-on-svn-src-head-freebsd.org.patch
+	0002-Compile-and-run-on-AlpineLinux.patch"
+builddir="$srcdir"/$pkgname-$pkgsha
+
+# LD_LIBRARY_PATH is included via -rpath, so use system defaults only.
+# And ensure no other paths sneak in.
+unset LIBRARY_PATH LD_RUN_PATH
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+C_INCLUDE_PATH=/usr/include
+LD_LIBRARY_PATH=/lib:/usr/lib
+export PATH C_INCLUDE_PATH LD_LIBRARY_PATH
+
+build() {
+	make -C "$builddir"
+}
+
+package() {
+	cd "$builddir"
+
+	make DESTDIR="$pkgdir" PREFIX=/usr install install-etc
+
+	for p in bin/mailq bin/newailases sbin/sendmail; do
+		mkdir -p "$pkgdir"/usr/${p%/*}
+		ln -s /usr/sbin/dma "$pkgdir"/usr/$p
+	done
+
+	# Create spool directory.
+	install -d -o root -g mail \
+		-m 775 "$pkgdir"/var/spool/$pkgname
+
+	# And homework
+	install -Dm644 "$srcdir"/aliases "$pkgdir"/etc/aliases
+	install -Dm755 "$srcdir"/$pkgname.cron \
+		"$pkgdir"/etc/periodic/15min/$pkgname
+
+}
+
+sha512sums="
+ab34a454c38f3a7986f2f5704d87d6d3a4332d24cfb1df1512c7dffb40389df737e9451127272ed793f59932514bd6b2518343f373ef1d58097e52337dd7ea8d  $pkgname-$pkgver.tar.gz
+eacaf6a9894e265dd1003447bba6daa53cd4e9dc8536f499da81698d795bbe34a345f9e1b9c696c2a0badc8fa5076b40b7eebfdc918424c4e4514df2fc9119be  aliases
+5a79895fd42ffee347b979402225eb8025ea9bb41d0dc24b43d4b1e64106f1c612024456ea98e20aef4258eb8e852b370410e47d6ee34cea630dda29cc54840e  dma.cron
+db86b8d1ae948d5693819dccc7399332d5c5f223087d94ce881518279ac71605c371933f602aa4910498da666cb33bddb60afda61e0317c97063830bfd6485fc  0001-Apply-changeset-seen-on-svn-src-head-freebsd.org.patch
+c0fa10945d85bd46f9fb9d447e7b1e9b22aad09736e693e0cd64af4f36112df85e6c8f8e14474d273d9da4a940165cc6800cd91a3ddc35ef451d495c0c74fdc6  0002-Compile-and-run-on-AlpineLinux.patch
+"
diff --git a/abuild-pkg/testing/dma/aliases b/abuild-pkg/testing/dma/aliases
new file mode 100644
index 0000000..0369b14
--- /dev/null
+++ b/abuild-pkg/testing/dma/aliases
_at_@ -0,0 +1,22 @@
+# Basic system aliases -- these MUST be present
+MAILER-DAEMON:  postmaster
+postmaster:     root
+
+# General redirections for pseudo accounts
+bin:            root
+daemon:         root
+named:          root
+nobody:         root
+uucp:           root
+www:            root
+
+# Put your local aliases here.
+
+# Well-known aliases
+manager:        root
+dumper:         root
+operator:       root
+abuse:          postmaster
+
+# trap decode to catch security attacks
+decode:         root
diff --git a/abuild-pkg/testing/dma/dma.cron b/abuild-pkg/testing/dma/dma.cron
new file mode 100644
index 0000000..d37f4f9
--- /dev/null
+++ b/abuild-pkg/testing/dma/dma.cron
_at_@ -0,0 +1,5 @@
+#!/bin/sh
+# Flush the DMA queue automatically.
+
+/usr/sbin/dma -q1
+exit 0
-- 
2.16.1
--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Wed Jan 31 2018 - 23:11:52 GMT