[Exim] Problem getting 'or' to work in a server_condition

Top Page
Delete this message
Reply to this message
Author: Frysco!
Date:  
To: exim-users
Subject: [Exim] Problem getting 'or' to work in a server_condition
Hi,

I'm using SMTP authentication, pulling data from a mySQL database, and am
trying to do a transition in the way that I was doing it, to a new way. I
need there to be some overlap between the two, as some users will be doing
authentication the old way for a little while.

The old form was to provide a simple username with a password (plaintext
in the database). The form I'm going to new takes a username@domain with a
password that is md5'd and comparing that with what's in the database.

It appears that having two plaintext drivers doesn't seem to work, so I
was trying to combine them into one, and that's where I have the problem.

I now have the following:

fixed_login:
 driver = plaintext
 public_name = LOGIN
 server_prompts = Username:: : Password::
 server_condition = \
   "${if !eq{${domain:$1}}{}\
         {\
           ${if and { {!eq{$1}{}}\
                      {!eq{$2}{}}\
                      {crypteq{$2}{\\{md5\\}$\
                         {lookup mysql{SELECT password FROM user \
                                       WHERE username='${local_part:$1}' \
                                       AND domainname='${domain:$1}'}\
                         {$value}fail}}} }\
                {yes}{no}\
         }\
         {\
           ${if eq{$2}\
                {${lookup mysql{SELECT exim_password FROM user WHERE \
                                username='${local_part:$1}'}}}\
                {yes}{no}}\
         }\
     }"
 server_set_id = $1


I've set my mail client to send the username without the domainname, and
it's failing with "535 Incorrect authentication data (set_id=francisco)"
Running exim with '-v -d' gives:

34567 fixed_login authenticator:
34567 $1 = francisco
34567 $2 = <password>
34567 expanded string:
34567 SMTP>> 535 Incorrect authentication data

I was expecting it to run the expansion at the 'failure' point of the
first ${if}, but it never looks like it's getting there.

Can anyone offer help here?

Thanks,
- --
Frysco!
francisco@???