public-l AT list.denic.de
Subject: Public DENIC mailinglist
List archive
- From: Jakob Hirsch <jh AT plonk.de>
- To: public-l AT denic.de
- Subject: [DENICpublic-l] Re: [exim] server_condition syntax help?
- Date: Fri, 12 Aug 2005 00:44:54 +0200
Joe Kocsis wrote:
> What Im trying to accomplish is something like this..
>
> server_condition = ${if eq{$1}{${lookup mysql{SELECT Account FROM
> UserSession WHERE (Account='$1' or Account='$1 AT domain.com') and
> Password='$2'}{$value}fail}}{1}{0}}
>
> I need to be able to authenticate if the domain is left off and would
> like to supply a default domain.. ex: domain.com
What you wrote above should work, I think, though you can simply it:
${lookup mysql{
SELECT 'yes' FROM UserSession
WHERE (Account='${quote_mysql:$1}'
OR Account='${quote_mysql:$1 AT domain.com}')
AND Password='${quote_mysql:$2}'}
{yes}fail}
You should really use quote_mysql for any remote-given input you send to
mysql.
You can also use two different queries depending on if there is a '@' in
the username. Or oven put ${if !match {$1}{@} {@domain.com}} in the
query. But I don't think it's worth this hassle.
BTW, I'd recommend to allow different separators (e.g. !#%) between
localpart and domain, since there are some MUAs that can't handle @ in
the username.
- [DENICpublic-l] Re: [exim] server_condition syntax help?, Jakob Hirsch, 08/12/2005
- [DENICpublic-l] Re: [exim] server_condition syntax help?, Jakob Hirsch, 08/12/2005
Archive powered by MHonArc 2.6.19.