From 30884a491e4fca0ade13b594565beef2136bb1e8 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 10 Oct 2003 10:55:46 +0000 Subject: Close a Debian bug. svn path=/trunk/; revision=3840 --- NEWS | 2 ++ fetchmail.man | 4 +++- sink.c | 34 +++++++++++++++++++++++++++++++++- todo.html | 15 +++++++++++++-- 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 10ae4ded..1d9bb62f 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ flushing if both "flush" and "limit" were specified. * rfc822.c fixes for CAN-2003-0790 and CAN-2003-0792 potential remote DOS attack vulnerabilities. +* Benjamin Drieu's patch for Debian bug #156592, incorrect handing of host/port + option. fetchmail-6.2.4 (Wed Aug 13 04:27:35 EDT 2003), 22625 lines: diff --git a/fetchmail.man b/fetchmail.man index 522de040..06dc9b41 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -418,7 +418,9 @@ after removing any single quotes they may contain, before the MDA command is passed to the shell. Do \fInot\fR use an MDA invocation like "sendmail -i -t" that dispatches on the contents of To/Cc/Bcc, it will create mail loops and bring the just wrath of many postmasters -down upon your head. +down upon your head. Also, do \fInot\fR try to combine multidrop +mode with an MDA such as procmail that can only accept one addressee; +you will lose. .TP .B \-\-lmtp (Keyword: lmtp) diff --git a/sink.c b/sink.c index 6f437532..fd69c5ad 100644 --- a/sink.c +++ b/sink.c @@ -211,7 +211,39 @@ int smtp_open(struct query *ctl) ctl->destaddr = (ctl->smtphost && ctl->smtphost[0] != '/') ? ctl->smtphost : "localhost"; } else - ctl->destaddr = ctl->smtpaddress ? ctl->smtpaddress : ( ctl->smtphost && ctl->smtphost[0] != '/' ? ctl->smtphost : "localhost"); + { + /* + * Here we try to find a correct domain name part for the RCPT + * TO address. If smtpaddress is set, no need to guestimate + * it. Otherwise, using ctl->smtphost as a base is a good + * base, although we may have to strip any port appended to + * communicate with SMTP servers that do not listen on the + * SMTP port. (benj) */ + if (ctl->smtpaddress) + ctl->destaddr = ctl->smtpaddress; + else if (ctl->smtphost && ctl->smtphost[0] != '/') + { + char * cp; + if (cp = strchr (ctl->smtphost, '/')) + { + /* As an alternate port for smtphost is specified, we + need to strip it from domain name. */ + char *smtpname; + xalloca(smtpname, char *, cp - ctl->smtphost + 1); + strncpy(smtpname, ctl->smtphost, cp - ctl->smtphost +1); + cp = strchr(smtpname, '/'); + *cp = 0; + ctl->destaddr = smtpname; + } + else + /* No need to strip port, domain name is smtphost. */ + ctl->destaddr = ctl->smtphost; + } + /* No smtphost is specified or it is a UNIX socket, then use + localhost as a domain part. */ + else + ctl->destaddr = "localhost"; + } if (outlevel >= O_DEBUG && ctl->smtp_socket != -1) report(stdout, GT_("forwarding to %s\n"), ctl->smtphost); diff --git a/todo.html b/todo.html index 5d695b55..0ce5014a 100644 --- a/todo.html +++ b/todo.html @@ -19,7 +19,7 @@ content="Known bugs and to-do items in fetchmail" /> Back to Eric's Home Page Up to Site Map -$Date: 2003/07/17 00:55:18 $ +$Date: 2003/10/10 10:55:46 $ @@ -72,6 +72,17 @@ SockOpen (this will get rid of the kluge in rcfile_y.y).

@ ought to be treated as an smtpname option, with the domain part removed for other purposes such as local-address matching.

+

Maybe refuse multidrop configuration unless "envelope" is _explicitly_ +configured (and tell the user he needs to configure the envelope +option) and change the envelope default to nil. This would +prevent a significant class of shoot-self-in-foot problems.

+ +

Given the above change, perhaps treat a delivery as "temporarily +failed" (leaving the message on the server, not putting it into +.fetchids) when the header listed in the "envelope" option is not +found. (This is so you don't lose mail if you configure the wrong +envelope header.)

+

The Debian bug-tracking page for fetchmail lists other bug @@ -82,7 +93,7 @@ reports.

Back to Eric's Home Page Up to Site Map -$Date: 2003/07/17 00:55:18 $ +$Date: 2003/10/10 10:55:46 $ -- cgit v1.2.3