[exim] Problem with lookup and $header_from:

Top Page
Delete this message
Reply to this message
Author: Rolf Unger
Date:  
To: exim-users
Subject: [exim] Problem with lookup and $header_from:
Hi list,

I have a problem with my exim4 configuration file and a key lookup, that
I use in the authentication block:

plain:
  driver = plaintext
  public_name = PLAIN
  client_send = "${lookup{$sender_address}\
      lsearch{CONFDIR/plain_passwd}{$value}}"


The above configuration is working, but I don't want to use the envelope
sender as key for the lookup, but the From: header. (or to be precise the
address in the From: header)
So I replace $sender_address with ${address:$header_from:} to:

  client_send = "${lookup{${address:$header_from:}}\
      lsearch{CONFDIR/plain_passwd}{$value}}"


But I get an error:

expansion of "${lookup{${address" failed in plain authenticator:
"${address" is not a known operator (or a } is missing in a variable
reference)

To add the closing bracket doesn't make sense to me, because then the
parathesis would be unbalanced.
I thought the ${address ...} operator might be wrong and used the plain
$header_from instead and get a similar error message:

expansion of "${lookup{$header_from" failed in plain authenticator:
missing } at end of string

Strange enough the log message looks like the evaluation processor
doesn't see the complete line but instead stops at the first colon.
So I thought the colon is the problem and tried to make it work without:

  client_send = "${lookup{$header_from}\
        lsearch{CONFDIR/plain_passwd}{$value}}"


But this doesn't work either. At least it sees the complete configuration
line:

expansion of
"${lookup{$header_from}lsearch{/etc/exim4/plain_passwd}{$value}}" failed
in plain authenticator: missing } at end of string - could be header
name not terminated by colon

Oh, yes, I know that the precise syntax for the $header_... variables has
a colon at the end. but this bastard doesn't let me add one. Instead he
is laughing at me and asking for the colon, if I don't use it. That's
sick.

Though I saw dozens of sample configurations with lookup and
$header_from: and none of the authors mentioned any problems I thought
maybe it is the "lookup" and I better try it with something different:

"${if eq{${address:$header_from:}}{rz.unger@???}}..."

expansion of "${if eq{${address" failed in plain authenticator:
"${address" is not a known operator (or a } is missing in a variable
reference)

The strange thing is that I can run the lookup in test mode and I get the
correct login/password combination from the file:

$ exim4 -bem test.mail \
'${lookup{${address:$header_from:}}lsearch{/etc/exim4/plain_passwd}{$value}}'

It seems that I need to escape the colon in the configuration file. Or
at least if I am in the authentication context.

Any ideas? Thanks in advance, Rolf.

--
() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments