+++ /dev/null
-Description: Randomize the generated Message-Id field a bit more.
-Origin: other: http://svn.ringlet.net/svn/ringlet/mail/dma/
-Bug-Debian: http://bugs.debian.org/544475
-Forwarded: yes
-Author: Peter Pentchev <roam@ringlet.net>
-Last-Update: 2010-06-21
-
---- a/dma.c
-+++ b/dma.c
-@@ -375,6 +375,15 @@
-
- bzero(&queue, sizeof(queue));
- LIST_INIT(&queue.queue);
-+#ifdef HAVE_RANDOM
-+#ifdef HAVE_SRANDOMDEV
-+ srandomdev();
-+#else
-+ srandom((unsigned long)((time(NULL) ^ getpid()) + ((uintptr_t)argv)));
-+#endif /* SRANDOMDEV */
-+#else
-+ srand((unsigned)((time(NULL) ^ getpid()) + ((uintptr_t)argv)));
-+#endif /* RANDOM */
-
- if (strcmp(argv[0], "mailq") == 0) {
- argv++; argc--;
---- a/mail.c
-+++ b/mail.c
-@@ -37,6 +37,7 @@
-
- #include <err.h>
- #include <errno.h>
-+#include <inttypes.h>
- #include <signal.h>
- #include <syslog.h>
- #include <unistd.h>
-@@ -514,8 +515,15 @@
- } else if (!had_messagid) {
- /* XXX better msgid, assign earlier and log? */
- had_messagid = 1;
-- snprintf(line, sizeof(line), "Message-Id: <%s@%s>\n",
-- queue->id, hostname());
-+ snprintf(line, sizeof(line), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n",
-+ (uintmax_t)time(NULL),
-+ queue->id,
-+#ifdef HAVE_RANDOM
-+ (uintmax_t)random(),
-+#else
-+ (uintmax_t)rand(),
-+#endif
-+ hostname());
- } else if (!had_from) {
- had_from = 1;
- snprintf(line, sizeof(line), "From: <%s>\n", queue->sender);
---- a/Makefile.plain
-+++ b/Makefile.plain
-@@ -8,6 +8,7 @@
- CFLAGS?= -O -pipe
- LDADD?= -lssl -lcrypto -lresolv -llockfile
-
-+CFLAGS+= -DHAVE_RANDOM -DHAVE_SRANDOM
- CFLAGS+= -DHAVE_LIBLOCKFILE
-
- INSTALL?= install -p
---- a/Makefile
-+++ b/Makefile
-@@ -1,7 +1,7 @@
- # $DragonFly: src/libexec/dma/Makefile,v 1.5 2008/09/19 00:36:57 corecode Exp $
- #
-
--CFLAGS+= -DHAVE_LIBLOCKFILE
-+CFLAGS+= -DHAVE_RANDOM -DHAVE_SRANDOM -DHAVE_LIBLOCKFILE
- CFLAGS+= -I${.CURDIR}
-
- DPADD= ${LIBSSL} ${LIBCRYPTO} /usr/lib/liblockfile.a