Subject: pkg/14031: Fetchmail 5.8.17 does not bounce
To: None <gnats-bugs@gnats.netbsd.org>
From: Xavier HUMBERT <xavier@xavhome.fr.eu.org>
List: netbsd-bugs
Date: 09/21/2001 11:38:52
>Number:         14031
>Category:       pkg
>Synopsis:       Fetchmail 5.8.17 does not bounce when SMTP forwarding refused
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 21 02:39:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Xavier HUMBERT <xavier@xavhome.fr.eu.org>
>Release:        NetBSD 1.5X (XAVIER) #12: Mon Sep 10 16:14:19 CEST 2001
>Organization:
		Xavier HUMBERT <xavier@xavhome.fr.eu.org>
>Environment:
		PowerMacintosh 8500/120
System: NetBSD moria 1.5X NetBSD 1.5X (XAVIER) #12: Mon Sep 10 16:14:19 CEST 2001 root@moria:/usr/src/sys/arch/macppc/compile/XAVIER macppc
Architecture: powerpc
Machine: macppc
Description:
	When fetchmeil is set up to forward mail to a smtp host, if the hosts refuses
	for any reason, even with antispam -a, the bounce is not generated.

How-To-Repeat:
	Use this config :
	| set spambounce
	| defaults protocol pop3 smtphost smtp.here.net antispam -1
	| poll pop.there.com
	|
	|        user "humbert"  pass "pass"  is "xavier" here
	Then send an emeil containing something filtered out (Well known virus pattern in headers for example)
	to humbert@there.com. No bounce. Look at the transcript :
fetchmail: SMTP> MAIL FROM:<xavier.humbert@jeunesse-sports.gouv.fr> SIZE=364
fetchmail: SMTP< 250 2.1.5 sender OK
fetchmail: SMTP> RCPT TO:<labo-info@valinor.injep.fr>
fetchmail: SMTP< 250 2.1.5 user labo-info@valinor.injep.fr known
fetchmail: SMTP> DATA
fetchmail: SMTP< 354 send your message
#*fetchmail: SMTP>. (EOM)
fetchmail: SMTP< 550 5.7.0 This message may contain the Kak worm.
fetchmail: SMTP error: 550 5.7.0 This message may contain the Kak worm.
fetchmail: SMTP> RSET
fetchmail: SMTP< 250 2.0.0 connection reset
 not flushed
 fetchmail: POP3> QUIT

 Fix: 
	Since it is not fixed in 5.9.0, in fechtmail's mailing-list,
	Sunil Shetye <shetye@bombay.retortsoft.com> proposed a patch :
	in article <20010905130320.A26152@mcdonald.bombay.retortsoft.com>

| =================================================================
| --- fetchmail-5.9.0.orig/sink.c Mon Aug  6 13:32:53 2001
| +++ fetchmail-5.9.0/sink.c  Wed Sep  5 12:52:15 2001
| @@ -586,6 +586,7 @@
|     const char  *ap;
|     char        options[MSGBUFSIZE]; 
|     char        addr[HOSTLEN+USERNAMELEN+1];
| +   char        **from_responses;
|     int     total_addresses;
|  
|     /*
| @@ -665,6 +666,7 @@
|     total_addresses = 0;
|     for (idp = msg->recipients; idp; idp = idp->next)
|         total_addresses++;
| +   xalloca(from_responses, char **, sizeof(char *) * total_addresses);
|     for (idp = msg->recipients; idp; idp = idp->next)
|         if (idp->val.status.mark == XMIT_ACCEPT)
|         {
| @@ -694,6 +696,20 @@
|  
|             handle_smtp_report(ctl, msg);
|  
| +#ifdef HAVE_SNPRINTF
| +           snprintf(errbuf, sizeof(errbuf), "%s: %s",
| +                   idp->id, smtp_response);
| +#else
| +           strncpy(errbuf, idp->id, sizeof(errbuf));
| +           strcat(errbuf, ": ");
| +           strcat(errbuf, smtp_response);
| +#endif /* HAVE_SNPRINTF */
| +
| +           xalloca(from_responses[*bad_addresses], 
| +               char *, 
| +               strlen(errbuf)+1);
| +           strcpy(from_responses[*bad_addresses], errbuf);
| +
|             (*bad_addresses)++;
|             idp->val.status.mark = XMIT_RCPTBAD;
|             if (outlevel >= O_VERBOSE)
| @@ -702,7 +718,10 @@
|                   ctl->listener, addr);
|         }
|         }
| -
| +   if (*bad_addresses)
| +       send_bouncemail(ctl, msg, XMIT_RCPTBAD,
| +                            "Some addresses were rejected by the MDA fetchmail forwards to.\r\n",
| +                            *bad_addresses, from_responses);
|     /*
|      * It's tempting to do local notification only if bouncemail was
|      * insufficient -- that is, to add && total_addresses > *bad_addresses
| =================================================================
|

Regards,

-- 
Xavier HUMBERT  -  Systemes et Reseaux     |     labo-info@injep.fr
INJEP                                      |     humbert@injep.fr

>Description:
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: