Re: [Exim] RFC 2821 and "headers_sender_verify"/"headers_che…

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Exim Users Mailing List
日付:  
To: Exim Users Mailing List
題目: Re: [Exim] RFC 2821 and "headers_sender_verify"/"headers_checks_
[ On Wednesday, May 16, 2001 at 14:40:42 (+0300), Vadim Vygonets wrote: ]
> Subject: Re: [Exim] RFC 2821 and "headers_sender_verify"/"headers_checks_
>
> Quoth Nigel Metheringham on Wed, May 16, 2001:
> > mallet@??? said:
> > > Which is not an argument against using home-cooked headers (X-Loop in
> > > several procmail based autoacks, X-Been-There in Mailman, etc). And
> > > in such cases, all you have to do is to suppress bounces on your side
> > > when you see the header.
> >
> > I see a lot of autoreplies with *no* trace of the original message in
> > them, let alone unscathed headers.
>
> Indeed, that was exactly the assumption behind my point. Most
> autoreply mechanism *reply* to the message (possibly, but not
> necessarily, copying some headers and parts of body into the
> reply message), and not forward (bounce) the message back
> (possibly with some headers added).
>
> And this is a normal behavior, IMO. Consider vacation
> mechanisms, which should not send back anything from the original
> message except possibly date and subject.


I think you're all missing an important point here.

First off remember that e-mail autoresponders are MUAs! They act only
on behalf of a user (even if it's a virtual user). They must act only
in the way any user agent may! For example "vacation" programs should
follow RFC-822 rules for choosing the reply address!

Autoresponders rarely set their reply address to be themselves, but when
they do they are the only ones that need to avoid self-looping. Eg. if
there are two users with vacation programs configured to set the reply
address in their message to be their own mailboxes then you don't want
them to auto-answer each other. The manual page for the vacation
program shows the use of the "Precedence" header field in its example
message as a way to avoid this.

Most e-mail autoresponder user agents also use several common de facto
standard mechanisms to further avoid interacting with dissimilar agents,
such as filtering on various well-known reply addresses, keeping a
database of addresses responses have been sent to and only sending one
message (perhaps per intervale) to each address, and with such shared
mechanisms like the "Precedence" field. See for example these two
fairly self-obvious functions from my version of vacation.c. While
reading this take care to remember what the "sender:" field is actually
for as defined by RFCx822!

/*
 * isjunkmail() --
 *
 * return (1) if mail contains a precedence header that indicates it
 * should not recieve a personal response, or seems to be from an
 * auto-responder (by calling isautoresponer() on from and sender).
 */
int
isjunkmail(sender, from, precedence)
        char *sender;                           /* return-path: contents */
        char *from;                             /* from: contents */
        char *precedence;                       /* precedence: contents */
{
        if (!precedence || !*precedence) {
                if (!strncasecmp(precedence, "junk", 4) ||
                    !strncasecmp(precedence, "bulk", 4) ||
                    !strncasecmp(precedence, "list", 4)) {
                        if (debug)
                                syslog(LOG_DEBUG, "ignoring precedence %s mail.\n", precedence);
                        return 1;
                }
        }
        if (sender && isautoresponder(sender))
                return 1;
        if (from && strchr(from, ','))
                return 1;               /* multiple addresses are never
                                         * junk if sender is OK */
        if (from && isautoresponder(from))
                return 1;


        return 0;
}


/*
 * isautoresponder() --
 *
 * Test an address to see if it's from a well-known auto-responder address,
 * i.e. something that is in effect generating a response to us, such as a
 * bounce message or mailing list administrative reply, etc....
 */
int
isautoresponder(from)
        char *from;                     /* address to test */
{
        static struct ignore {
                char    *name;
                int     len;
        } ignore_senders[] = {
                { "-request", 8 },      /* usually mailing lists */
                { "mailer-daemon", 13 }, /* usually a bounce */
                { "listserv", 6 },      /* mailing list manager program */
                { "mailer", 6 },        /* XXX ???? */
                { "-relay", 6 },        /* XXX ???? */
                { "-outgoing", 6 },     /* XXX some mailing lists */
                {NULL, 0 }
        };
        struct ignore *cur;
        int len;
        char *p;


        /*
         * Check if the *prefix* of the address matches...  some mailing lists
         * use this more arcane owner address format, particularly that most
         * broken MLM, LISTSERV
         */
        if (strncmp(from, "owner-", 6))
                return 1;
        /*
         * Try finding a pointer to the *END* of the sender's mailbox name.
         *
         * This is mildly amusing, and I'm not positive it's right; trying
         * to find the "real" name of the sender, assuming that addresses
         * will be some variant of:
         *
         *      site!site!SENDER%site.domain%site.domain@???
         */
        if (!(p = strchr(from, '%'))) {
                if (!(p = strchr(from, '@'))) {
                        if ((p = strrchr(from, '!')))
                                ++p;
                        else
                                p = from;
                        for (; *p; ++p)
                                ;
                }
        }
        len = p - from;
        /*
         * now test to see if the suffix of the mailbox name matches any of the
         * strings given in ignore_senders
         */
        for (cur = ignore_senders; cur->name; ++cur) {
                if (len >= cur->len && !strncasecmp(cur->name, p - cur->len, cur->len))
                        return 1;
        }
        return 0;
}



-- 
                            Greg A. Woods


+1 416 218-0098      VE3TCP      <gwoods@???>     <woods@???>
Planix, Inc. <woods@???>;   Secrets of the Weird <woods@???>