joe a via Postfix-users:
> On 7/7/2023 3:46 PM, joe a via Postfix-users wrote:
> > One hesitates to post this.
> > 
> > Found some oddness when changing a destination in transport_maps 
> > (transport_maps = lmdb:/etc/postfix/transport).
> > 
> > Seems related to pattern matching.
> > 
> > The file /etc/postfix/transport contains entries of this form:
> > 
> > somename-xyz.com     noauth:ipaddress_1
> > somename.xyz               noauth:ipaddress_2
> > *            relay:[someISP]:587
> > 
> > ipaddress_1 is a server of long standing.  ipaddress_2 is a new box, to 
> > eventually replace the older box.
> > 
> > Testing reveals that emails to the first case (translated to real) 
> > address yieldd proper results, as do those to the second case.
> > 
> > However, when I change the first case from ipaddress_1 to ipaddress_2, 
> > after postmap /etc/posfix/transport, test email to the first case 
> > "u...@somename-xyz.com" seem to "fall through" to the relay, resulting 
> > in a bounce.
> > 
> > Will I need to resort to a "reg-ex table" to, hopefully, resolve this?
> > 
> > Perhaps meaningful, found that "grep somename.xyz /etc/postfix/*" for 
> > example resulted in a match for somename.xyz and somename-xyz.com with 
> > somename.xyz and somename-xyz colorized, indicating the "matched" text. 
> > Variations on the form of the search term found that "grep "somename\-" 
> > files", provided an exact match.  That is enclosing the search term in 
> > double quotes with the escape character seemed to "fix" it.
> > 
> > Or, is this just "expected behavior"?
> > 
> > Oh, Nurse, is it time for meds yet?
> 
> Apparently wrong again.
> 
> postmap -q "stuff" /etc/postfix/transport seems to match as expected in 
>      each case.

The need to use "stuff" in the "poatmap -q" command indicates that
the query contained one or more whitespace characters. In the
"postmap -q" command, a query that contains whitespace needs to be
enclosed to prevent the shell (bash) from splitting it into multiple
arguments.

Also note this in the postmap manpage:

    INPUT FILE FORMAT
        The format of a lookup table input file is as follows:

        - A table entry has the form

               key whitespace value

        ... Whitespace in lookup keys is supported in Postfix 3.2 and
        later, by surrounding the key with double quote characters `"'.
        Within the double quotes, double quote `"' and backslash `\'
        characters can be included by quoting them with a preceding
        backslash.

        Wietse
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to