On Thu, Jan 29, 2009 at 02:24:15AM -0500, Aaron Wolfe wrote:

> Case in point, the regex solution I suggested earlier is not the best
> way to return a single result for all inputs

Important limitation, generally "static" is limited to a result that
contains no white-space or "," characters. Not because "static"
tables can't do that, but because the context in which static
tables are used generally allows for multiple tables separated
by white-space or commas.

    $ postmap -q ignored "static:a b c"
    a b c

The main.cf parser is brutaly simple, there is no support for quotes
(and thus no "escapes" to make quotes literal, ...) of any sort. So
it is not possible to use:

        transport_maps = "static:error:This is an error"
    OR
        transport_maps = static:"error:This is an error"
    OR
        transport_maps = static:{error:This is an error}
    OR
        transport_maps = {static:error:This is an error}
    NOR EVEN:
        # Parsing happens after expansion, so this is no better
        transport_maps = static:${xyzzy:error:This is an error}

Rather you stuck with a trade-off between simple easy to read syntax and
expressive power. This is why sometimes regexp tables are needed where
static would otherwise suffice:

    my.pcre:
        /^/     error:This is an error

    main.cf:
        transport_maps = pcre:${config_directory}/my.pcre

One could implement a new table type:

        varstatic:<varname>

which returns the expansion of main.cf "varname" parameter, allowing
almost arbitrary text (no newlines, leading or trailing white-space),
but this does not seem compelling.

A more comprehensive approach is Michael Tokarev's "fnmatch" table
type. This has not gained enough traction to be included in the official
release.

    http://www.irbs.net/internet/postfix/0110/1077.html

It is not clear whethe it is better to expand Postfix in this direction,
rather than bite the bullet and introduce a more complex configuration
parser.

-- 
        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:majord...@postfix.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.

Reply via email to