Re: [Exim] Exim+LDAP,Can't contact LDAP server

Top Page
Delete this message
Reply to this message
Author: Daniel Tiefnig
Date:  
To: exim-users
Subject: Re: [Exim] Exim+LDAP,Can't contact LDAP server
Alexander G. Jerjomin wrote:
> acl_check_rcpt:
>
>   deny  message = DISABLED!!!
>     domains = +protected_domains
>     condition = ${lookup ldap \
 >     {ldap://SERVER/dc=test,dc=test??sub?(uid=$local_part)}{0}{1}}

>
>
> If LDAP is down on SERVER exim returns
> 451 Temporary local problem - please try later
>
>
> but I want to accept mail if LDAP is down.


Well, you could do a lookup for a "static" address before trying the
actual one, and if LDAP doesn't return something assume the server is
down, and accept the mail:

accept domains = +protected_domains
        condition = ${lookup ldap {ldap:[...](uid=test)}{0}{1}}


(LDAP stuff snipped out.)

Or combine both lookups:

deny  message = DISABLED!!!
       domains = +protected_domains
       condition = if{ and {{${lookup ldap "uid=test"}{1}{0}}\
                            {${lookup ldap "uid=$local_part"}{0}{1}}}\
                     }


(Pseudo syntax, and I'm never sure where to put curly brackets...)

The latter one might save you the second LDAP lookup, if exim conditions
are "short circuit" operations. (Meaning: If two conditions are combined
with and{}, the second is not tested if the first evaluates "false".)
Don't know that, though.


lg,
daniel

PS: no need to send messages twice...