aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoramdmi3 <amdmi3@FreeBSD.org>2009-07-07 21:29:02 +0800
committeramdmi3 <amdmi3@FreeBSD.org>2009-07-07 21:29:02 +0800
commita97b6b8386a46b8543a4a636bad18b3847acd2ac (patch)
tree9007c8b9a55c506dd33a7e53e7085cd4934e2dc3
parent0fe541b53268bd87d6c2194e6760c7b45f469423 (diff)
downloadfreebsd-ports-graphics-a97b6b8386a46b8543a4a636bad18b3847acd2ac.tar.gz
freebsd-ports-graphics-a97b6b8386a46b8543a4a636bad18b3847acd2ac.tar.zst
freebsd-ports-graphics-a97b6b8386a46b8543a4a636bad18b3847acd2ac.zip
- Fix a race condition in the multiple recipient delivery code which can cause message corruption
PR: 136304 Submitted by: Daniel Roethlisberger <daniel@roe.ch> (maintainer)
-rw-r--r--mail/dma/Makefile2
-rw-r--r--mail/dma/files/patch-libexec_dma_dma.c38
2 files changed, 39 insertions, 1 deletions
diff --git a/mail/dma/Makefile b/mail/dma/Makefile
index c6061f04fc4..86fdfccd7a3 100644
--- a/mail/dma/Makefile
+++ b/mail/dma/Makefile
@@ -7,7 +7,7 @@
PORTNAME= dma
PORTVERSION= 20090208
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= mail ipv6
MASTER_SITES= http://mirror.roe.ch/dist/dma/
diff --git a/mail/dma/files/patch-libexec_dma_dma.c b/mail/dma/files/patch-libexec_dma_dma.c
new file mode 100644
index 00000000000..8361f761374
--- /dev/null
+++ b/mail/dma/files/patch-libexec_dma_dma.c
@@ -0,0 +1,38 @@
+--- libexec/dma/dma.c.orig 2009-02-09 01:36:50.000000000 +0100
++++ libexec/dma/dma.c 2009-07-04 00:12:53.000000000 +0200
+@@ -612,6 +612,7 @@
+ const char *errmsg = "unknown bounce reason";
+ struct timeval now;
+ struct stat st;
++ struct flock fl;
+
+ syslog(LOG_INFO, "%s: mail from=<%s> to=<%s>",
+ it->queueid, it->sender, it->addr);
+@@ -620,11 +621,27 @@
+ syslog(LOG_INFO, "%s: trying delivery",
+ it->queueid);
+
++ bzero(&fl, sizeof(fl));
++ fl.l_type = F_WRLCK;
++ fl.l_whence = SEEK_SET;
++ if (fcntl(fileno(it->queuef), F_SETLKW, &fl) == -1) {
++ syslog(LOG_ERR, "%s: failed to lock queue file: %m",
++ it->queueid);
++ }
++
+ if (it->remote)
+ error = deliver_remote(it, &errmsg);
+ else
+ error = deliver_local(it, &errmsg);
+
++ bzero(&fl, sizeof(fl));
++ fl.l_type = F_UNLCK;
++ fl.l_whence = SEEK_SET;
++ if (fcntl(fileno(it->queuef), F_SETLKW, &fl) == -1) {
++ syslog(LOG_ERR, "%s: failed to unlock queue file: %m",
++ it->queueid);
++ }
++
+ switch (error) {
+ case 0:
+ unlink(it->queuefn);