Re: [EXIM] Exim-1.92: Macro expansion bug with `domain=' in …

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Harald Meland
Dátum:  
Címzett: Jim Knoble
CC: Exim Users
Tárgy: Re: [EXIM] Exim-1.92: Macro expansion bug with `domain=' in routers
[Jim Knoble]

>     # Domain list pattern for remote domains which need to be forwarded
>     # to a smart host.
>     SMART_DOMAINS = *

>
>     # Domain list pattern for remote domains which don't need to be
>     # forwarded to a smart host.
>     SMART_DOMAINS_EXCEPT = *.earth

[...]
>                 # <<< Here's the spot where things get interesting
>             domains = SMART_DOMAINS
>             except_domains = SMART_DOMAINS_EXCEPT
>                 # >>>

[...]
> It actually looks like macros aren't getting expanded for the
> `except_domain' directive in other routers besides domainlist.


My guess: I think it is a bug that just because you happened to define
a macro with a name consisting of a previously defined macro and some
suffix, it's always the first macro that gets expanded. I.e.,

"SMART_DOMAINS_EXCEPT" => "*_EXCEPT"

which obviously isn't what you wanted. One might argue that this is
the behaviour to be expected, as the spec says:

Once a macro is defined, all subsequent lines in the file are scanned
for the macro name; if there are several macros, the line is scanned
for each in turn, in the order in which they are defined.

Bandaid fix: Either define SMART_DOMAINS_EXCEPT above SMART_DOMAINS,
or do something like s/SMART_DOMAINS_EXCEPT/SMART_EXCEPT_DOMAINS/g .

This could be fixed by introducing some explicit "expand this macro
here" syntax. Maybe preserving capitalized variable names for
"quasi-macros" and define global variables instead of macros,
dereferencing them by ${MACRO_NAME}, would be a better solution? Such
a "fix" would break old config files, though...

--
Harald

--
*** Exim information can be found at http://www.exim.org/ ***