From 873de9b9e6309f4ee55c535e9824d013a5a9f252 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 16 Jun 1997 14:35:09 +0000 Subject: Handle multiple To: headers. svn path=/trunk/; revision=1102 --- NEWS | 6 +++--- driver.c | 38 ++++++++++++++++++++++++-------------- fetchmail-FAQ.html | 18 +++--------------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/NEWS b/NEWS index c8e8c44e..dcf647e0 100644 --- a/NEWS +++ b/NEWS @@ -4,9 +4,6 @@ form "foo"@bar.com are not parsed correctly, even though they are technically RFC822 legal. The general problem is mentioned on the man page. -* If a message has more than two destination headers of the same kind (such - as To, or Cc), only the last one will be checked for multidrop addresses. - Features To Consider * Generate bounce messages when delivery is refused. See RFC1891, RFC1894. @@ -18,6 +15,9 @@ Release Notes: ------------------------------------------------------------------------------ +pl 3.9.9 (): +* We can now process multiple To headers a la Microsoft Exchange Server. + pl 3.9.8 (Sat Jun 14 14:19:32 EDT 1997): * Fetchmail is now normally built with optimization. * POP2 support is no longer compiled by default, but you can configure diff --git a/driver.c b/driver.c index d5bb5650..908ad4fd 100644 --- a/driver.c +++ b/driver.c @@ -439,7 +439,7 @@ struct query *ctl; /* query control record */ char *realname; /* real name of host */ { char buf[MSGBUFSIZE+1], return_path[MSGBUFSIZE+1]; - int from_offs, to_offs, cc_offs, bcc_offs, ctt_offs, env_offs; + int from_offs, ctt_offs, env_offs, addressoffs[128], next_address; char *headers, *received_for; int n, linelen, oldlen, ch, remaining; char *cp; @@ -450,14 +450,14 @@ char *realname; /* real name of host */ #endif /* HAVE_RES_SEARCH */ int olderrs; - sizeticker = 0; + next_address = sizeticker = 0; has_nuls = FALSE; return_path[0] = '\0'; olderrs = ctl->errcount; /* read message headers */ headers = received_for = NULL; - from_offs = to_offs = cc_offs = bcc_offs = ctt_offs = env_offs = -1; + from_offs = ctt_offs = env_offs = -1; oldlen = 0; for (remaining = len; remaining > 0; remaining -= linelen) { @@ -592,20 +592,32 @@ char *realname; /* real name of host */ else if (from_offs == -1 && !strncasecmp("Apparently-From:", line, 16)) from_offs = (line - headers); - else if (!strncasecmp("To:", line, 3)) - to_offs = (line - headers); - else if (ctl->server.envelope != STRING_DISABLED && env_offs == -1 && !strncasecmp(ctl->server.envelope, line, strlen(ctl->server.envelope))) env_offs = (line - headers); + else if (!strncasecmp("To:", line, 3)) + { + if (next_address >= sizeof(addressoffs)/sizeof(addressoffs[0])) + error(PS_UNDEFINED, errno, "too many destination headers"); + addressoffs[next_address++] = (line - headers); + } + else if (!strncasecmp("Cc:", line, 3)) - cc_offs = (line - headers); + { + if (next_address >= sizeof(addressoffs)/sizeof(addressoffs[0])) + error(PS_UNDEFINED, errno, "too many destination headers"); + addressoffs[next_address++] = (line - headers); + } else if (!strncasecmp("Bcc:", line, 4)) - bcc_offs = (line - headers); + { + if (next_address >= sizeof(addressoffs)/sizeof(addressoffs[0])) + error(PS_UNDEFINED, errno, "too many destination headers"); + addressoffs[next_address++] = (line - headers); + } else if (!strncasecmp("Content-Transfer-Encoding:", line, 26)) ctt_offs = (line - headers); @@ -656,16 +668,14 @@ char *realname; /* real name of host */ map_name(received_for, ctl, &xmit_names); else { + int i; + /* * We haven't extracted the envelope address. * So check all the header addresses. */ - if (to_offs > -1) - find_server_names(headers + to_offs, ctl, &xmit_names); - if (cc_offs > -1) - find_server_names(headers + cc_offs, ctl, &xmit_names); - if (bcc_offs > -1) - find_server_names(headers + bcc_offs, ctl, &xmit_names); + for (i = 0; i < next_address; i++) + find_server_names(headers + addressoffs[i], ctl, &xmit_names); } if (!accept_count) { diff --git a/fetchmail-FAQ.html b/fetchmail-FAQ.html index 4666593b..0bfe71da 100644 --- a/fetchmail-FAQ.html +++ b/fetchmail-FAQ.html @@ -9,8 +9,7 @@

Frequently Asked Questions About Fetchmail

-The current version of fetchmail is 3.9.8. New in the FAQ: T5; Using fetchmail with the Microsoft Exchange Server.

+The current version of fetchmail is 3.9.8.

Before reporting any bug, please read G3 for advice on how to include diagnostic information that will get your bug fixed @@ -20,7 +19,7 @@ If you have a question or answer you think ought to be added to this FAQ list, mail it to fetchmail's maintainer, Eric S. Raymond, at esr@snark.thyrsus.com.

-Rob Funk is fetchmail's designated +Rob Funk is fetchmail's designated backup maintainer. Other backup maintainers may be added in the future, in order to ensure continued support should Eric S. Raymond and/or Rob Funk drop permanently off the net for any reason.

@@ -66,7 +65,6 @@ when I may have multiple login sessions going?
T2. How can I use fetchmail with exim?
T3. How can I use fetchmail with smail?
T4. How can I use fetchmail with Lotus Notes?
-T5. How can I use fetchmail with Microsoft Exchange Server?

Runtime fatal errors:

@@ -699,16 +697,6 @@ as a bug.

The Lotus Notes SMTP gateway tries to deduce when it should convert \n to \r\n, but its rules are not intuitive. Use `forcecr'.

-


-

T5. How can I use fetchmail with Microsoft Exchange Server?

- -Only single-drop mode is reliable; multi-drop is likely to give you -problems with mailing-list mail.

- -The problem is that Microsoft Exchange Server seems to like to break -up long To lists into multiple headers, and the multi-drop code only -sees the last one.

-


R1. I think I've set up fetchmail correctly, but I'm not getting any mail.

@@ -1014,7 +1002,7 @@ without hacking potentially fragile startup scripts. To get around it, just touch(1) the logfile before you run fetchmail (this will have no effect on the contents of the logfile if it already exists).

-$Id: fetchmail-FAQ.html,v 1.33 1997/06/14 19:00:28 esr Exp $

+$Id: fetchmail-FAQ.html,v 1.34 1997/06/16 14:35:09 esr Exp $


Eric S. Raymond <esr@snark.thyrsus.com>
-- cgit v1.2.3