From: Timothy L. <tim...@si...> - 2005-09-22 02:19:36
|
Dear Matthias, I discovered the need for this patch under the follownig circumstances: * ISP uses postfix for mail delivery * ISP mail server delivers all e-mails to "catchall" mailbox. Postfix prepends two "Delivered-To" headers to the e-mail, like so: Delivered-To: catchall Delivered-To: actual-recipient * In order to use multidrop with fetchmail, the following line in fetchmailrc is used to obtain actual recipient for incoming e-mail: envelope 1 "Delivered-To" * The original handling of "Delivered-To" in transact.c discards all "Delivered-To" lines, so the actual recipient is never found. Regards, Timothy Lee Matthias Andree wrote: >Timothy Lee <tim...@si...> writes: > > >>Current version of fetchmail fails to extract the recipient address if >>"Delivered-To" is used as envelope header. This patch fixes the >>problem. >> >> >Can anyone please demonstrate or describe in detail the problem that is >supposed to be fixed with this patch? > > >>diff -Naur fetchmail-6.2.5/transact.c fetchmail-6.2.5.new/transact.c >>--- fetchmail-6.2.5/transact.c 2003-10-11 04:55:05.000000000 +0800 >>+++ fetchmail-6.2.5.new/transact.c 2005-03-02 16:41:50.000000000 +0800 >>@@ -380,6 +380,7 @@ >> char *received_for, *rcv, *cp; >> static char *delivered_to = NULL; >> int n, linelen, oldlen, ch, remaining, skipcount; >>+ int delivered_to_count; >> struct idlist *idp; >> flag no_local_matches = FALSE; >> flag has_nuls; >>@@ -416,6 +417,7 @@ >> oldlen = 0; >> msgblk.msglen = 0; >> skipcount = 0; >>+ delivered_to_count = 0; >> ctl->mimemsg = 0; >> >> for (remaining = fetchlen; remaining > 0 || protocol->delimited; ) >>@@ -665,10 +667,15 @@ >> */ >> if (ctl->dropdelivered && !strncasecmp(line, "Delivered-To:", 13)) >> { >>- if (delivered_to) >>+ if (delivered_to || >>+ ctl->server.envelope == STRING_DISABLED || >>+ !ctl->server.envelope || >>+ strcasecmp(ctl->server.envelope, "Delivered-To") || >>+ delivered_to_count != ctl->server.envskip) >> free(line); >> else >> delivered_to = line; >>+ delivered_to_count++; >> continue; >> } >> >> |