On 2011-09-10 at 23:11 +0000, Steffen Heil (Mailinglisten) wrote: > I have a text-file that I use for lookups like this:
> set acl_m1 = ${lookup{a@???}lsearch*@{filename}{$value}fail}
> then I extract some information from this:
> ${extract{key}{$acl_m1}}
> Also, I need to extract a password from this:
> ${extract{pass_key}{${lookup{$1}lsearch{filename}{$value}fail}}}
>
> A sample line of this file would be:
> *@b.de: field="value" pass="abcd"
>
> Now, how do I have to escape in this case?
> Especially do I have to escape once or twice?
>
> Does the lookup unescape what is found? Does extract unescape the value?
$ echo '*@b.de: field="value" pass="abcd" key="foo" pass_key="bar me"' > TEST
$ exim -be > ${lookup{a@???}lsearch*@{TEST}{$value}fail} field="value" pass="abcd" key="foo" pass_key="bar me" > ${extract{pass_key}{${lookup{a@???}lsearch*@{TEST}{$value}fail}}} bar me
Note: if you build Exim with readline support, you have command-history
inside -be mode.
What you need to escape depends upon how you plan to use the value. Is
it to be a key in a database lookup, in which case there are various
quote_* expansion operators? Or is it to be passed directly to an
authenticator?
Your best bet for getting a real feel for what's happening is to embed
"bad" data inside a field, including escapes, single quotes, and more,
and use both "exim -be" for basic testing, and "exim -d+expand -..." for
testing things like delivery. The debugging can also be turned on
inside an ACL with "control = debug/<options>" (for various "<options>")
in sufficiently recent releases of Exim, with output going to filenames
under your control (somewhat; see the "tag" option). The Exim
Specification, "40.21 Use of the control modifier".