Re: [exim] How to rewrite ${filter ...} expressions for olde…

Top Page
Delete this message
Reply to this message
Author: W B Hacker
Date:  
To: exim users
Subject: Re: [exim] How to rewrite ${filter ...} expressions for older exims?
Michael Lampe wrote:
> Ben Allen wrote:
>
>> Without seeing what the macros actually expand to, it's impossible to say how
>> to reformulate the expansion without a filter command.
>
> The whole thing is this:


This does looks to be amenable to considerable simplification, but
anyone LDAP-aware will also need, in order to assist you:

- sight of the code of the transport being called

- the schema, and perhaps some examples (with/without suffix) records of the
LDAP dataset this is being run against.

- optionally, awareness of OTHER LDAP-driven router/transports. EG: where does
this one sit?

WHEN you get the solution(s), I'd suggest leaving this in place, adding the
'new' code after an 'unseen' and putting a qualifier on the 'new' code to only
trigger on a set of testing accounts.

Normal traffic should be unaffected, but test accounts see two copies.

Debug until they do, then comment-out the qualifier, comment-out the old code
and the 'unseen', restart, and tail the logs for a while before final clean-up.

Speaking only as to what I'd need to sort the simple one-line SQL equivalent -
I'm not au fait with LDAP.

HTH,

Bill


> -----
>
> # LDAP Router
>
> LDAP_USER="uid=mail,ou=System-User,dc=localhost"
> LDAP_PASS=xxxxxxxxxxxxxxxxxxxx
> LDAP_URL=ldapi://${quote_ldap_dn:/var/run/ldapi}
> LDAP_LOCALPART_ATT=mailLocalAddress
> LDAP_MAIL_GROUP=E-Mail
> LDAP_UID_QUERY=${lookup ldapm {user=LDAP_USER pass=LDAP_PASS \
>
> LDAP_URL/ou=People,dc=localhost?uid?sub?(LDAP_LOCALPART_ATT=${quote_ldap_dn:$local_part})}}
> LDAP_GROUP_QUERY=${lookup ldapm {user=LDAP_USER pass=LDAP_PASS \
>           LDAP_URL/cn=LDAP_MAIL_GROUP,ou=Groups,dc=localhost?cn?base?\
>                   (uniqueMember=uid=$item,ou=People,dc=localhost)}}

>
> ldap_user:
>     debug_print = "R: ldap_user for $local_part@$domain"
>     driver = accept
>     domains = +local_domains
>     local_parts = ! root
>     local_part_suffix = +*
>     local_part_suffix_optional
>     address_data = ${filter {<\n
> LDAP_UID_QUERY}{eq{LDAP_GROUP_QUERY}{LDAP_MAIL_GROUP}}}
>     condition = ${if>{${strlen:${filter {<\n
> LDAP_UID_QUERY}{eq{LDAP_GROUP_QUERY}{LDAP_MAIL_GROUP}}}} }{0}}
>     transport = pipe_delivery_cyrus
>     cannot_route_message = ldap_user: mail address $local_part does not exist

>
> ----
>
>> You could also try passing the data through a perl function (${perl}) which
>> can do anything you want it to.
>>
>> Hope that helps.
>
> I'm anything but intimate with exim. This whole mess is the leftover of
> someone who considered RHEL5 exim too old, copied a manually compiled
> version over it, disabled exim updates, and finally managed to leave
> before I could get my hands on him.
>
> Now that I have to deal with it (the big hole in<= 4.69 especially),
> I'm trying to make it work with "upstream" again.
>
> I guess it's easier to implement my own 'filter' in perl than to
> understand the whole mess above. :(
>
> Thanks,
>     Michael

>