]> git.ipfire.org Git - people/ms/dma.git/commitdiff
Randomize the generated Message-Id a bit more.
authorPeter Pentchev <roam@ringlet.net>
Tue, 1 Sep 2009 09:09:34 +0000 (09:09 +0000)
committerPeter Pentchev <roam@ringlet.net>
Tue, 1 Sep 2009 09:09:34 +0000 (09:09 +0000)
Debian: #544475
Reported by: Tino Keitel <tino.keitel+debbugs@tikei.de>

changelog
patches/24-random-message-id.patch [new file with mode: 0644]
patches/series

index 14e6c5b6a938d38cc1ef44e4f7382c318917f5a5..5cd6d73c7e14bcc3ef50173bf993231501ddb7e8 100644 (file)
--- a/changelog
+++ b/changelog
@@ -3,6 +3,7 @@ dma (0.0.2009.07.17-2) unstable; urgency=low
   * Allow the spool directory to live on a filesystem that does not
     set the d_type member of the dirent structure, like XFS.
     Closes: #544357
+  * Randomize the Message-Id a bit more.  Closes: #544475
 
  -- Peter Pentchev <roam@ringlet.net>  Tue, 01 Sep 2009 11:50:03 +0300
 
diff --git a/patches/24-random-message-id.patch b/patches/24-random-message-id.patch
new file mode 100644 (file)
index 0000000..d3d1b2a
--- /dev/null
@@ -0,0 +1,50 @@
+Randomize the generated Message-Id field a bit more.
+
+Debian:                #544475
+
+--- a/Makefile
++++ b/Makefile
+@@ -3,6 +3,7 @@
+ SUBDIR=       etc
++CFLAGS+= -DHAVE_RANDOM
+ CFLAGS+= -DHAVE_LIBLOCKFILE
+ CFLAGS+= -I${.CURDIR}
+--- a/dma.c
++++ b/dma.c
+@@ -786,8 +786,15 @@
+                               } else if (!had_messagid) {
+                                       /* XXX better msgid, assign earlier and log? */
+                                       had_messagid = 1;
+-                                      snprintf(line, sizeof(line), "Message-Id: <%"PRIxMAX"@%s>\n",
+-                                               queue->id, hostname());
++                                      snprintf(line, sizeof(line), "Message-Id: <%"PRIxMAX".%"PRIxMAX".%"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", sender);
+@@ -1589,6 +1596,15 @@
+       atexit(deltmp);
+       LIST_INIT(&queue.queue);
+       snprintf(tag, 254, "dma");
++#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--;
index ac2c366f0775987ee375998635ce838b47c44587..b329ae3f1032580640550438c5823da64c7f1bcf 100644 (file)
@@ -9,3 +9,4 @@
 20-parse-recipient.patch
 22-openfiles.patch
 23-dirent-d_type.patch
+24-random-message-id.patch