OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: Postfix behavior

Victor.Duchovnimorganstanley.com
Date: Tue Mar 02 2004 - 08:29:31 CST


On Tue, 2 Mar 2004, Wietse Venema wrote:

> Victor.Duchovnimorganstanley.com:
> > On Tue, 2 Mar 2004, Mike Futerko wrote:
> >
> > > For example you send me mail, so why I have to check YOUR address in MY ALIAS
> > > tables, while I don't accept mail for YOUR domain nor your IP match mynetworks?!
> > >
> >
> > Only "local", "virtual alias", "virtual mailbox" and "relay" addresses are
> > checked. See ADDRESS_CLASS_README. Please make accurate observations.
>
> In addition, every MAIL FROM or RCPT TO address is run through the
> virtual alias table, regardless of its address class.
>

This should be optimized out when the address class is "default" and the
transport is not the error transport. Later, when validation is applied to
the *output* of canonical, the canonical mapping will have to be brought
back. By then Liviu's "domain" patch should be available for all the
"expensive" map types.

--
        Viktor.

Index: src/smtpd/smtpd_check.c
--- src/smtpd/smtpd_check.c 5 Feb 2004 20:59:24 -0000 1.1.1.36.4.1
+++ src/smtpd/smtpd_check.c 2 Mar 2004 14:25:19 -0000
-3865,6 +3865,7
                                    const char *reply_class)
 {
     const RESOLVE_REPLY *reply;
+ int error_rcpt;

     if (msg_verbose)
         msg_info(">>> CHECKING RECIPIENT MAPS <<<");
-3893,7 +3894,10
      * stream. See also the next comment block on recipients in virtual alias
      * domains.
      */
- if (MATCH(rcpt_canon_maps, CONST_STR(reply->recipient))
+ error_rcpt = (strcmp(STR(reply->transport), MAIL_SERVICE_ERROR) == 0);
+ if ((error_rcpt == 0
+ && (reply->flags & RESOLVE_CLASS_MASK) == RESOLVE_CLASS_DEFAULT)
+ || MATCH(rcpt_canon_maps, CONST_STR(reply->recipient))
         || MATCH(canonical_maps, CONST_STR(reply->recipient))
         || MATCH(virt_alias_maps, CONST_STR(reply->recipient)))
         return (0);
-3906,7 +3910,7
      * unknown recipients in virtual alias domains will both resolve to
      * "error:user unknown".
      */
- if (strcmp(STR(reply->transport), MAIL_SERVICE_ERROR) == 0)
+ if (error_rcpt)
         return (smtpd_check_reject(state, MAIL_ERROR_BOUNCE,
                                    "%d <%s>: %s rejected: %s",
                                    (reply->flags & RESOLVE_CLASS_ALIAS) ?