[prev in list] [next in list] [prev in thread] [next in thread] 

List:       qmail-ldap
Subject:    Do you use this patch?
From:       "Jimmy Spam" <spamis () pobladores ! com>
Date:       2008-10-08 11:14:36
Message-ID: 1871.62.81.229.130.1223464476.squirrel () webmail ! pobladores ! com
[Download RAW message or body]

I have doubt about the convenience of apply this patch (attached to this
mail) to my qmail-ldap installation.

Patches with "(OK)" in his file name mean that this patch can be
sucessfully apply over qmail-ldap, but the others fails.

Are the failed patches already included in qmail-ldap (maildir-uniq and
bouncecontrol)?

Is maildir-uniq patch "mandatory" for a new qmail-ldap installation?

Thank you



______________________________________________________________________
Correo gratis de Pobladores.com
Ahora con 25MB de capacidad. 
http://www.pobladores.com/services/webmail
["qmail-doublebounce-trim(OK).patch" (application/octet-stream)]

mail-doublebounce-trim.patch: 
------------------------------
I decided to integrate this patch because I got sick of double bounce messages sitting in 
qmail queue forever. Spammers usually fake the from field with an invalid email address, 
which results in thousands of bounce messages. This patch allows you to complete discard 
all double bounce messages to save server load and traffic

----------------

If you don't want doublebounces to hit your queue a second time
(because you have, say, ten million mailboxes and as much legitimate
email traffic and more spam), the following patch will immediately
discard bouncing bounces.  Note that doublebounceto must start with a
blank line; that is, it must have one newline in it.  A totally empty
file means "use the default of 'posthamster'".

This version was rewritten by Charles Cazabon from my original patch
to include a man page, turn the patch around in the right direction,
and emit its own message for the logfile.

Apply this patch as so:

cd /usr/local/src/qmail-1.03
patch <doublebounce-trim.patch

diff -urN qmail-1.03.orig/qmail-send.9 qmail-1.03.nodoublebounce/qmail-send.9
--- qmail-1.03.orig/qmail-send.9	Mon Jun 15 04:53:16 1998
+++ qmail-1.03.nodoublebounce/qmail-send.9	Tue Sep  9 12:59:04 2003
@@ -115,6 +115,10 @@
 (If that bounces,
 .B qmail-send
 gives up.)
+As a special case, if the first line of
+.IR doublebounceto
+is blank (contains a single linefeed), qmail-send will not queue
+the double-bounce at all.
 .TP 5
 .I envnoathost
 Presumed domain name for addresses without @ signs.
diff -urN qmail-1.03.orig/qmail-send.c qmail-1.03.nodoublebounce/qmail-send.c
--- qmail-1.03.orig/qmail-send.c	Mon Jun 15 04:53:16 1998
+++ qmail-1.03.nodoublebounce/qmail-send.c	Tue Sep  9 13:02:43 2003
@@ -683,6 +683,8 @@
   }
  if (str_equal(sender.s,"#@[]"))
    log3("triple bounce: discarding ",fn2.s,"\n");
+ else if (!*sender.s && *doublebounceto.s == '@')
+   log3("double bounce: discarding ",fn2.s,"\n");
  else
   {
    if (qmail_open(&qqt) == -1)

--9jxsPFA5p3P2qPhR--

["qmail-date-localtime(OK).patch" (application/octet-stream)]

I'm not sure who originally wrote this patch, or why qmail.org decided
to link to an old URL of this copy of it on my server, since they don't
seem interested in adding any links to any of the other patches I've
actually done.

John Simpson <jms1@jms1.net> 2007-01-03

==============================================================================

This patch causes the various qmail programs to generate date stamps in
the local timezone. I find GMT too annoying to convert from/to. I make
no warranties that it will work in your timezone, however it works for me.

Works with qmail 1.01 to 1.03.

To apply this patch, cd into the qmail source directory and type...
	patch -s -p1 < patch-to-patch-file

--- qmail-1.03.orig/date822fmt.c	Tue Apr 15 15:05:23 1997
+++ qmail-1.03/date822fmt.c	Fri Apr 18 00:39:41 1997
@@ -1,3 +1,4 @@
+#include <time.h>
 #include "datetime.h"
 #include "fmt.h"
 #include "date822fmt.h"
@@ -12,18 +13,51 @@
 {
   unsigned int i;
   unsigned int len;
+  time_t now;
+  datetime_sec utc;
+  datetime_sec local;
+  struct tm *tm;
+  struct datetime new_dt;
+  int minutes;
+
+  utc = datetime_untai(dt);
+  now = (time_t)utc;
+  tm = localtime(&now);
+  new_dt.year = tm->tm_year;
+  new_dt.mon = tm->tm_mon;
+  new_dt.mday = tm->tm_mday;
+  new_dt.hour = tm->tm_hour;
+  new_dt.min = tm->tm_min;
+  new_dt.sec = tm->tm_sec;
+  local = datetime_untai(&new_dt);
+
   len = 0;
-  i = fmt_uint(s,dt->mday); len += i; if (s) s += i;
+  i = fmt_uint(s,new_dt.mday); len += i; if (s) s += i;
   i = fmt_str(s," "); len += i; if (s) s += i;
-  i = fmt_str(s,montab[dt->mon]); len += i; if (s) s += i;
+  i = fmt_str(s,montab[new_dt.mon]); len += i; if (s) s += i;
   i = fmt_str(s," "); len += i; if (s) s += i;
-  i = fmt_uint(s,dt->year + 1900); len += i; if (s) s += i;
+  i = fmt_uint(s,new_dt.year + 1900); len += i; if (s) s += i;
   i = fmt_str(s," "); len += i; if (s) s += i;
-  i = fmt_uint0(s,dt->hour,2); len += i; if (s) s += i;
+  i = fmt_uint0(s,new_dt.hour,2); len += i; if (s) s += i;
   i = fmt_str(s,":"); len += i; if (s) s += i;
-  i = fmt_uint0(s,dt->min,2); len += i; if (s) s += i;
+  i = fmt_uint0(s,new_dt.min,2); len += i; if (s) s += i;
   i = fmt_str(s,":"); len += i; if (s) s += i;
-  i = fmt_uint0(s,dt->sec,2); len += i; if (s) s += i;
-  i = fmt_str(s," -0000\n"); len += i; if (s) s += i;
+  i = fmt_uint0(s,new_dt.sec,2); len += i; if (s) s += i;
+
+  if (local < utc) {
+    minutes = (utc - local + 30) / 60;
+    i = fmt_str(s," -"); len += i; if (s) s += i;
+    i = fmt_uint0(s,minutes / 60,2); len += i; if (s) s += i;
+    i = fmt_uint0(s,minutes % 60,2); len += i; if (s) s += i;
+  }
+  else {
+    minutes = (local - utc + 30) / 60;
+    i = fmt_str(s," +"); len += i; if (s) s += i;
+    i = fmt_uint0(s,minutes / 60,2); len += i; if (s) s += i;
+    i = fmt_uint0(s,minutes % 60,2); len += i; if (s) s += i;
+  }
+
+  i = fmt_str(s,"\n"); len += i; if (s) s += i;
+
   return len;
 }

["qmail-1.03-maildir-uniq.patch" (application/octet-stream)]

Some operating systems quickly recycle PIDs, which can lead 
to collisions between Maildir-style filenames, which must 
be unique and non-repeatable within one second.

This patch is just a means of updating qmail-local to use 
the format of the revised Maildir protocol, available at:

http://cr.yp.to/proto/maildir.html

It uses four unique identifiers:
* inode number of the file written to Maildir/tmp
* device number of the file written to Maildir/tmp
* time in microseconds
* the PID of the writing process

A Maildir-style filename would look like the following:

In Maildir/tmp:
  time.MmicrosecondsPpid.host
In Maildir/new:
  time.IinodeVdeviceMmicrosecondsPpid.host

Additionally, this patch further conforms to the revised 
Maildir protocol by looking through the hostname for 
instances of '/' and ':', replacing them with "057" and 
"072", respectively, when writing it to disk.

Special thanks go to Matthias Andree for design and 
sanity-checking.

  --Toby Betts <tmb2@po.cwru.edu>


--- ./qmail-local.c.orig	Mon Jun 15 06:52:55 1998
+++ ./qmail-local.c	Mon Jun 16 16:09:05 2003
@@ -1,4 +1,5 @@
 #include <sys/types.h>
+#include <sys/time.h>
 #include <sys/stat.h>
 #include "readwrite.h"
 #include "sig.h"
@@ -41,6 +42,20 @@
 void temp_qmail(fn) char *fn;
 { strerr_die5x(111,"Unable to open ",fn,": ",error_str(errno),". (#4.3.0)"); }
 
+/* writes ulong u in hex to char *s, does not NULL-terminate */
+unsigned int fmt_xlong(s,u) char *s; unsigned long u;
+{
+ unsigned int len; unsigned long q; unsigned long c;
+ len = 1; q = u;
+ while (q > 15) { ++len; q /= 16; }
+ if (s)
+  {
+   s += len;
+   do { c = u & 15; *--s = (c > 9 ? 'a' - 10 : '0') + c; u /= 16; } while(u);
+  }
+ return len;
+}
+
 int flagdoit;
 int flag99;
 
@@ -63,6 +78,7 @@
 stralloc cmds = {0};
 stralloc messline = {0};
 stralloc foo = {0};
+stralloc hostname = {0};
 
 char buf[1024];
 char outbuf[1024];
@@ -78,7 +94,7 @@
 char *dir;
 {
  unsigned long pid;
- unsigned long time;
+ struct timeval time;
  char host[64];
  char *s;
  int loop;
@@ -92,21 +108,37 @@
  pid = getpid();
  host[0] = 0;
  gethostname(host,sizeof(host));
+
+ s = host;
+ for (loop = 0; loop < str_len(host); ++loop)
+  {
+   if (host[loop] == '/')
+    {
+     if (!stralloc_cats(&hostname,"057")) temp_nomem();
+     continue;
+    }
+   if (host[loop] == ':')
+    {
+     if (!stralloc_cats(&hostname,"072")) temp_nomem();
+     continue;
+    }
+   if (!stralloc_append(&hostname,s+loop)) temp_nomem();
+  }
+
  for (loop = 0;;++loop)
   {
-   time = now();
+   gettimeofday(&time, 0);
    s = fntmptph;
    s += fmt_str(s,"tmp/");
-   s += fmt_ulong(s,time); *s++ = '.';
-   s += fmt_ulong(s,pid); *s++ = '.';
-   s += fmt_strn(s,host,sizeof(host)); *s++ = 0;
+   s += fmt_ulong(s,time.tv_sec); *s++ = '.';
+   *s++ = 'M'; s += fmt_ulong(s,time.tv_usec);
+   *s++ = 'P'; s += fmt_ulong(s,pid); *s++ = '.';
+   s += fmt_strn(s,hostname.s,hostname.len); *s++ = 0;
    if (stat(fntmptph,&st) == -1) if (errno == error_noent) break;
    /* really should never get to this point */
    if (loop == 2) _exit(1);
    sleep(2);
   }
- str_copy(fnnewtph,fntmptph);
- byte_copy(fnnewtph,3,"new");
 
  alarm(86400);
  fd = open_excl(fntmptph);
@@ -124,8 +156,23 @@
   }
 
  if (substdio_flush(&ssout) == -1) goto fail;
+ if (fstat(fd, &st) == -1) goto fail;
  if (fsync(fd) == -1) goto fail;
  if (close(fd) == -1) goto fail; /* NFS dorks */
+
+ s = fnnewtph;
+ s += fmt_str(s,"new/");
+ s += fmt_ulong(s,time.tv_sec); *s++ = '.';
+
+ /* in hexadecimal */
+ *s++ = 'I'; s += fmt_xlong(s,st.st_ino);
+ *s++ = 'V'; s += fmt_xlong(s,st.st_dev);
+
+ /* in decimal */
+ *s++ = 'M'; s += fmt_ulong(s,time.tv_usec);
+ *s++ = 'P'; s += fmt_ulong(s,pid); *s++ = '.';
+
+ s += fmt_strn(s,hostname.s,hostname.len); *s++ = 0;
 
  if (link(fntmptph,fnnewtph) == -1) goto fail;
    /* if it was error_exist, almost certainly successful; i hate NFS */

["qmail-bouncecontrol-1.03.patch" (application/octet-stream)]

qmail-bouncecontrol-1.03.patch: 
----------------------------------

Allows you to control the appearance of bounce messages. 
Very handy if you want to change the default bounce message or add a message in \
another language.



# ------------------------------------------------------------------------
Patch: bouncecontrol
For: qmail-1.03
From: Klaus Reimer <kay@debian.org>
Date: 09 Feb 2001

This patch modifies qmail-send to give the admin the chance to control
the look of bounce and doublebounce messages. This feature can be 
controlled by these new qmail control files:

  bouncesubject       - Contains one line for the bounce message subject
  bouncemessage       - Contains the text for the bounce message
  doublebouncesubject - Contains one line for the double bounce message 
                        subject
  doublebouncemessage - Contains the text for the double bounce message
  
The message text is displayed at the top of the bounce message instead
of the default "Hi. This is...."

If you have problems with this patch or questions or comments please
contact me: kay@debian.org
# ------------------------------------------------------------------------

diff -u qmail-1.03.orig/control.c qmail-1.03/control.c
--- qmail-1.03.orig/control.c	Mon Jun 15 12:53:16 1998
+++ qmail-1.03/control.c	Fri Feb  9 15:39:31 2001
@@ -85,6 +85,40 @@
  return 1;
 }
 
+int control_readnativefile(sa,fn)
+stralloc *sa;
+char *fn;
+{
+ substdio ss;
+ int fd;
+ int match;
+
+ if (!stralloc_copys(sa,"")) return -1;
+
+ fd = open_read(fn);
+ if (fd == -1) 
+  {
+   if (errno == error_noent)
+    {
+     if (!stralloc_0(sa)) return -1;
+     return 1;
+    }
+   return -1;
+  }
+
+ substdio_fdbuf(&ss,read,fd,inbuf,sizeof(inbuf));
+
+ for (;;)
+  {
+   if (getln(&ss,&line,&match,'\n') == -1) break;
+   if (!match && !line.len) { close(fd); return 1; }
+   if (!stralloc_cat(sa,&line)) break;
+   if (!match) { close(fd); return 1; }
+  }
+ close(fd);
+ return -1;
+}
+
 int control_readfile(sa,fn,flagme)
 stralloc *sa;
 char *fn;
diff -u qmail-1.03.orig/control.h qmail-1.03/control.h
--- qmail-1.03.orig/control.h	Mon Jun 15 12:53:16 1998
+++ qmail-1.03/control.h	Fri Feb  9 15:39:44 2001
@@ -5,6 +5,7 @@
 extern int control_readline();
 extern int control_rldef();
 extern int control_readint();
+extern int control_readnativefile();
 extern int control_readfile();
 
 #endif
diff -u qmail-1.03.orig/qmail-send.c qmail-1.03/qmail-send.c
--- qmail-1.03.orig/qmail-send.c	Mon Jun 15 12:53:16 1998
+++ qmail-1.03/qmail-send.c	Fri Feb  9 15:26:45 2001
@@ -47,6 +47,10 @@
 stralloc percenthack = {0};
 struct constmap mappercenthack;
 stralloc locals = {0};
+stralloc bouncemessage = {0};
+stralloc bouncesubject = {0};
+stralloc doublebouncemessage = {0};
+stralloc doublebouncesubject = {0};
 struct constmap maplocals;
 stralloc vdoms = {0};
 struct constmap mapvdoms;
@@ -702,12 +706,23 @@
    qmail_puts(&qqt,"\nTo: ");
    while (!quote2(&quoted,bouncerecip)) nomem();
    qmail_put(&qqt,quoted.s,quoted.len);
-   qmail_puts(&qqt,"\n\
-Subject: failure notice\n\
-\n\
-Hi. This is the qmail-send program at ");
-   qmail_put(&qqt,bouncehost.s,bouncehost.len);
-   qmail_puts(&qqt,*sender.s ? ".\n\
+   qmail_puts(&qqt,"\nSubject: ");
+   if (*sender.s)
+     qmail_put(&qqt,bouncesubject.s,bouncesubject.len);
+   else
+     qmail_put(&qqt,doublebouncesubject.s,doublebouncesubject.len);
+   qmail_puts(&qqt,"\n\n");
+   if (*sender.s && bouncemessage.s[0]) {
+     qmail_put(&qqt,bouncemessage.s,bouncemessage.len);
+     qmail_puts(&qqt,"\n");
+   } else if (!*sender.s && doublebouncemessage.s[0]) {
+     qmail_put(&qqt,doublebouncemessage.s,doublebouncemessage.len);
+     qmail_puts(&qqt,"\n");
+   }
+   else {
+     qmail_puts(&qqt,"Hi. This is the qmail-send program at ");
+     qmail_put(&qqt,bouncehost.s,bouncehost.len);
+     qmail_puts(&qqt,*sender.s ? ".\n\
 I'm afraid I wasn't able to deliver your message to the following addresses.\n\
 This is a permanent error; I've given up. Sorry it didn't work out.\n\
 \n\
@@ -715,7 +730,7 @@
 I tried to deliver a bounce message to this address, but the bounce bounced!\n\
 \n\
 ");
-
+   }
    fd = open_read(fn2.s);
    if (fd == -1)
      qmail_fail(&qqt);
@@ -1454,6 +1469,10 @@
  if (!stralloc_cat(&doublebounceto,&doublebouncehost)) return 0;
  if (!stralloc_0(&doublebounceto)) return 0;
  if (control_readfile(&locals,"control/locals",1) != 1) return 0;
+ if (control_readnativefile(&bouncemessage,"control/bouncemessage") != 1) return 0;
+ if (control_readnativefile(&doublebouncemessage,"control/doublebouncemessage") != \
1) return 0; + if (control_rldef(&bouncesubject,"control/bouncesubject",0,"failure \
notice") != 1) return 0; + if \
(control_rldef(&doublebouncesubject,"control/doublebouncesubject",0,"failure notice") \
!= 1) return 0;  if (!constmap_init(&maplocals,locals.s,locals.len,0)) return 0;
  switch(control_readfile(&percenthack,"control/percenthack",0))
   {



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic