OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
RE: Catch-all in virtual alias table : BUG ?

From: Benjamin Morel (benjamin.morelgmail.com)
Date: Mon Feb 11 2008 - 12:46:27 CST


Thank you very much Victor, it works now.
I did a mistake writing this mail, of course domain names should be enclosed
with slashes and dot escaped.
However I could not find in the doc this way to stop recursion. It's
perfect.

Thanks again and sorry to have thought it was a bug !
Ben

On Mon, Feb 11, 2008 at 04:26:52AM +0100, Benjamin Morel wrote:

[ Subject lines thart start a thread, should omit the word "bug" unless a
  problem has been carefully verified and reported in detail. When reporting
  unexpected behaviour, ask for help. ]

> I set this line in /etc/postfix/main.cf :
>
> virtual_alias_maps = regexp:/etc/postfix/virtual

> Here is my /etc/postfix/virtual :
>
> # BEGIN SNIPPET
>
> ^domain1\.com DOMAIN
> ^domain2\.com DOMAIN

The above lines violate the documented table syntax. In addition, virtual
alias rewriting applies to *ALL* domains, not just virtual alias domains.
So the above is not going to work the way you want, even if expressed
correctly.

> /^tech/ email1otherdomain.com
> // email2otherdomain.com
>
> # END SNIPPET
>
>
>
> My goal is to have a list of domains, where :
>
> - all emails sent to techthesedomains are forwarded to
> email1otherdomain.com
>
> - all emails sent to anythingelsethesedomains (catch-all) are forwarded
to
> email2otherdomain.com.

this will not work as written. And does not even require regexp tables,
which
make this unnecessarily complicated.

> "Patterns are applied in the order as specified in the table, until a
> pattern is found that matches the search string".
>
> So the first matching pattern, and not the second one, should be used (as
> postmap correctly does).
>
> Any idea why ?

Virtual expansion is recursive, and your approach is fundamentally flawed.
With indexed files (hash, btree, ...) use:

        # Catch-all with identity mapping for RHS to terminate recursion
        domain catch-allother-domain
        catch-allother-domain catch-allother-domain

        # Exception with identity mapping for RHS to terminate recursion
        exceptiondomain exceptionother-domain
        exceptionother-domain exceptionother-domain

for each domain in question.

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majordomopostfix.org?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.