Re: [exim] server_condition not honoured in authenticators?

Página Inicial
Delete this message
Reply to this message
Autor: persson
Data:  
Para: exim-users
Assunto: Re: [exim] server_condition not honoured in authenticators?
On Monday 12 October 2009, Phil Pennock wrote:

> On 2009-10-11 at 17:03 +0100, persson wrote:
> > This is probably due to my newbieness, but anyway.
>
> No, it's a subtle mistake and the debugging could be doing more to
> highlight it.
>
> You don't note the version of Exim -- please do note it, since this
> logic has changed in 4.64 and a major Linux OS still ships 4.63 and
> various downstreams of that project are still on 4.63. In this case, I
> don't think it matters.


It's 4.69-9, debian lenny.

> >   734 lookup yielded: blah
> >   734 expanding:
> > ${lookup{${local_part:$auth1}}lsearch{/etc/special/${domain: $auth1}}}
> >   734    result: blah
> >   734 condition: eq{$auth2}{${lookup{${local_part:
> > $auth1}}lsearch{/etc/special/${domain:$auth1}}}}
> >   734    result: true
> >   734 expanding: 1
> >   734    result: 1

> >
> >   734 skipping: result is not used
> >   734 expanding: ${if match_domain{${domain:$auth1}}{+special_domains}
> > {${if
> > eq{$auth2}{${lookup{${local_part:$auth1}}lsearch{/etc/special/${domain:
> > $auth1}}}}{1}{0}} } {${if eq{$auth2}{a}{1}{0}}} }
> >   734    result: 1
> >   734 expanded string: 1
> >   734 expanding: $auth1
> >   734    result: user2@???
> >   734 SMTP>> 435 Unable to authenticate at present: 1

>
> I think that this is the string "1 " instead of "1".
>
> When reading the configuration file, Exim strips off leading and
> trailing whitespace. But if you explicitly include whitespace in an
> expansion, it's preserved -- you've defined it as part of the data. And
> "1 " != "1".
>
> It's unfortunate that this is not made clear in the debugging output.
>
> Looking again at your two server_condition rules, we see:
>
> ----------------------------8< cut here >8------------------------------
> server_condition = ${if match_domain{${domain:$auth1}}{+special_domains} \
>         {${if
> eq{$auth2}{${lookup{${local_part:$auth1}}lsearch{/etc/special/${domain:$aut
>h1}}}}{1}{0}} } \ {${if eq{$auth2}{a}{1}{0}}} \
>         }

>
> server_condition = ${if match_domain{${domain:$auth1}}{+special_domains} \
>
> {${lookup{${local_part:$auth1}}lsearch{/etc/special/${domain:$auth1}} \
> {${if eq {$auth2}{$value}{1}{0}}}{0}} } \
>         { ${if  eq{$auth2}{a}{1}{0}} } \
>         }
> ----------------------------8< cut here >8------------------------------

>
> Note that the form is:
> ${if CONDITION {TRUTH_TEXT}{FALSEHOOD_TEXT}}
>
> So you have a {TRUTH_TEXT} for the first case of:
> {${if
> eq{$auth2}{${lookup{${local_part:$auth1}}lsearch{/etc/special/${domain:$aut
>h1}}}}{1}{0}} } and similarly for the second case.
>
> So you have:
> {${if .....} }
> and so you've explicitly added a space into the text after the ${if ...}
> expansion.
>
> Remove the space, all should be well.


Dang! That was it. Thank you VERY MUCH!
If I'm allowed to suggest, I would add an option to make debugging output
clearer, eg something like

734 expanding: **1 **
734    result: **1 **


or other similar ways of delimiting which would make immediately clear what
the value of the expansion is.

Thank you again.