monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[monit-dev] [monit] r325 committed - * Randomize the mail message id to


From: monit
Subject: [monit-dev] [monit] r325 committed - * Randomize the mail message id to prevent duplicates in the case, tha...
Date: Fri, 18 Feb 2011 17:02:16 +0000

Revision: 325
Author: address@hidden
Date: Fri Feb 18 08:59:50 2011
Log: * Randomize the mail message id to prevent duplicates in the case, that
  the same hostname is used on multiple hosts running monit and messages
  are generated in the same second in parallel. Thanks to Sergey B
  Kirpichev.



http://code.google.com/p/monit/source/detail?r=325

Modified:
 /trunk/CHANGES.txt
 /trunk/sendmail.c

=======================================
--- /trunk/CHANGES.txt  Fri Feb 18 08:15:27 2011
+++ /trunk/CHANGES.txt  Fri Feb 18 08:59:50 2011
@@ -38,6 +38,11 @@

 * Spelling fixes. Thanks to Sergey B Kirpichev.

+* Randomize the mail message id to prevent duplicates in the case, that
+  the same hostname is used on multiple hosts running monit and messages
+  are generated in the same second in parallel. Thanks to Sergey B
+  Kirpichev.
+


 Version 5.2.3
=======================================
--- /trunk/sendmail.c   Wed Jan 19 10:40:32 2011
+++ /trunk/sendmail.c   Fri Feb 18 08:59:50 2011
@@ -174,6 +174,7 @@
   }

   for(i = 0, m= mail; m; m= m->next, i++) {
+    srandom(time(NULL) + getpid() + i);
     do_send(&S, "MAIL FROM: <%s>\r\n", m->from);
     do_status(&S);
     do_send(&S, "RCPT TO: <%s>\r\n", m->to);
@@ -190,7 +191,7 @@
     do_send(&S, "Mime-Version: 1.0\r\n");
     do_send(&S, "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n");
     do_send(&S, "Content-Transfer-Encoding: 8bit\r\n");
-    do_send(&S, "Message-id: <address@hidden>\r\n", time(NULL), i, 
S.localhost);
+ do_send(&S, "Message-id: <address@hidden>\r\n", time(NULL), random(), S.localhost);
     do_send(&S, "\r\n");
     do_send(&S, "%s\r\n", m->message);
     do_send(&S, ".\r\n");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]