Re: [exim] smtp authentication using default domain

Top Page
Delete this message
Reply to this message
Author: Ted Cooper
Date:  
To: exim-users
Subject: Re: [exim] smtp authentication using default domain
alexis wrote:
> How many "and" conditions can be inside an if?
>
>
> Look
>
> 5133 failed to expand:
> ${if and { {!eq{$1}{}} {!eq{$2}{}}
> {eq{${domain:$1}}{}{defaultnone}{${domain:$1}}}
> {crypteq{$2}{\{md5\}${lookup mysql{SELECT password FROM users WHERE
> username='${local_part:$1}' AND domain='${domain:$1}'}{$value}fail}}}
> } {yes}{no}}
>
>  5133    error message: missing } at end of condition inside "and" group
>  5133 expansion failed: missing } at end of condition inside "and" group

>
> i cannot realize where's missing that bracket.


Now quite how I meant you to use it ;)
No idea what's wrong with your brackets, but I didn't look hard :P

The following is very poorly indented so I could try to find bracket
problems but it probably needs to put into one line as I put breaks in
the middle of strings from the expansion. I also don't use "and" :P

${if \
  crypteq\
    {$2}\
    {\{md5\}\
      ${lookup mysql{SELECT password FROM users WHERE \
        username='${local_part:$1}' AND \
        domain='${if eq{${domain:$1}}{}{none}{${domain:$1}}}'}\
      }\
    }
}


That looks about right but is completely untested ;) I don't use MySQL
at any of my sites as yet so I'd be hard pressed to try it.

Anyway, that's how I would use that little expansion in the SQL query,
rather then just another nested if. So long as there's not a NULL user
in the domain "none" then it will return false, or in your case fail.

Ted.


--
The Exim Manual
http://www.exim.org/docs.html
http://www.exim.org/exim-html-current/doc/html/spec_html/index.html