fetchmail-friends
[Top] [All Lists]

[fetchmail] bug with EXPLICIT_BOUNCE_ON_BAD_ADDRESS?

2003-02-27 07:32:09
Hi there,

there seems to be a bug in fetchmail when you have
EXPLICIT_BOUNCE_ON_BAD_ADDRESS and it needs to create a bounce. In sink.c
there is this part in the function open_smtp_sink() where it collects bad
addresses and the SMTP responses:

#ifdef EXPLICIT_BOUNCE_ON_BAD_ADDRESS
#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);
#endif /* EXPLICIT_BOUNCE_ON_BAD_ADDRESS */

This part will put the id followed by a colon in front of the smtp response.
So the string might be "walter: 550 unknown user walter(_at_)localhost". Later,
when it creates the bounce, it calls

#ifdef EXPLICIT_BOUNCE_ON_BAD_ADDRESS
    /*
     * This should not be necessary, because the SMTP listener itself
     * should genrate a bounce for the bad address.
     */
    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);
#endif /* EXPLICIT_BOUNCE_ON_BAD_ADDRESS */

and finally, in send_bouncemail(), when it creates the delivery report, it
encodes the "Status:" header:

                if (strlen(error) > 9 && isdigit(error[4])
                        && error[5] == '.' && isdigit(error[6])
                        && error[7] == '.' && isdigit(error[8]))
                    /* Enhanced status code available, use it */
                    SockPrintf(sock, "Status: %5.5s\r\n", &(error[4]));
                else
                    /* Enhanced status code not available, fake one */
                    SockPrintf(sock, "Status: %c.0.0\r\n", error[0]);
                SockPrintf(sock, "Diagnostic-Code: %s\r\n", error);

Here, error will contain one of the from_responses from earlier.
Unfortunately, this code will never be able to fake a proper enhanced status
code, because the first letter in the error string (which is %c'ed) will be
the first character of the id and not the SMTP error number. Also, it would
never actually correctly figure out if there is an enhanced status code.

BTW, I am using fetchmail on a debian linux system running exim as the local
MTA. Strangely enough, I need this EXPLICIT_BOUNCE_ON_BAD_ADDRESS or else I
will get no bounces when mail is sent to users which do not exist locally.
(I am collecting mail from a multidrop mailbox.)

Does this also happen with sendmail or is this an exim-specific behaviour?

kind regards
Max

P.S. I compiled fetchmail from the source -- here's version info of
fetchmail and gcc

mail:~# bin/fetchmail -V
This is fetchmail release 5.9.11+NLS
Linux mail 2.4.20 #1 Tue Dec 17 12:28:36 CET 2002 i686 unknown
Taking options from command line and /root/.fetchmailrc
Idfile is /root/.fetchids
Fetchmail will forward misaddressed multidrop messages to postmaster.
Options for retrieving from bad_admin(_at_)mail(_dot_)mehrweb(_dot_)at:
  True name of server is mail.mehrweb.at.
  Protocol is POP3.
  All available authentication methods will be tried.
  Server nonresponse timeout is 300 seconds (default).
  Default mailbox selected.
  Only new messages will be retrieved (--all off).
  Fetched messages will not be kept on the server (--keep off).
  Old messages will not be flushed before message retrieval (--flush off).
  Rewrite of server-local addresses is enabled (--norewrite off).
  Carriage-return stripping is disabled (stripcr off).
  Carriage-return forcing is disabled (forcecr off).
  Interpretation of Content-Transfer-Encoding is disabled (pass8bits on).
  MIME decoding is disabled (mimedecode off).
  Idle after poll is disabled (idle off).
  Nonempty Status lines will be kept (dropstatus off)
  Delivered-To lines will be kept (dropdelivered off)
  Messages will be SMTP-forwarded to: localhost (default)
  Recognized listener spam block responses are: 571 550 501 554
  Multi-drop mode: 1 local name(s) recognized.
  DNS lookup for multidrop addresses is enabled.
  Server aliases will be compared with multidrop addresses by name.
  Envelope header is assumed to be: Received
  Predeclared mailserver aliases: schwimmbecken.at
  No UIDs saved from this host.

mail:~# gcc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20011002 (Debian prerelease)


<Prev in Thread] Current Thread [Next in Thread>
  • [fetchmail] bug with EXPLICIT_BOUNCE_ON_BAD_ADDRESS?, Maximilian Hantsch <=