aboutsummaryrefslogtreecommitdiffstats
path: root/mail/dma/files
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 /mail/dma/files
parent0fe541b53268bd87d6c2194e6760c7b45f469423 (diff)
downloadfreebsd-ports-gnome-a97b6b8386a46b8543a4a636bad18b3847acd2ac.tar.gz
freebsd-ports-gnome-a97b6b8386a46b8543a4a636bad18b3847acd2ac.tar.zst
freebsd-ports-gnome-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)
Diffstat (limited to 'mail/dma/files')
-rw-r--r--mail/dma/files/patch-libexec_dma_dma.c38
1 files changed, 38 insertions, 0 deletions
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 000000000000..8361f7613744
--- /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);