exim -be '${extract{$received_ip_address}{10.0.0.1=hosta
127.0.0.1=local4 ::1=local6}{$value}fail}'
Failed: first argument of "extract" must not be empty
That was somewhat expected, the docs say the key must not consist of all
digits. There's no hint on what happens if the key is empty.
Anyhow using such an expansion on smtp_active_hostname yields a panic,
while a forced fail (second example) will result in smtp_active_hostname
being set to $primary_hostname (as documented)
Question is: Why do different failures yield different behavior? Does
exim assume that an empty key is an error state and thus handles the
expansion for smtp_active_hostname differently (as some type of hinting
for the user).
But let's go on, actually something else struck me in the first place.
Let's safeguard the extract:
exim -be '${if
def:received_ip_address{${extract{$received_ip_address}{10.0.0.1=hosta
127.0.0.1=local4 ::1=local6}{$value}fail}}fail}'
Failed: missing or misplaced { or }
Wait! What? Why?
I can not fail in the <true> branch of an if, or rather, if I make use
of forced fails in a <true> branch the <false> branch produces a syntax
error? This looks a little unreasonable, but let's look at a different case:
It does make a difference what type of expansion I use in the <true>
branch of an if when forcing failure in <true> with respect to the
result of the <false> branch's forced fail?