Re: [exim] Handling double commas in LDAP lookup results

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Heiko Schlittermann
Date:  
À: exim-users
Sujet: Re: [exim] Handling double commas in LDAP lookup results
Marten Lehmann <lehmann@???> (Di 26 Aug 2014 19:18:04 CEST):
> Hello,
>
> >You need to use ${sg} to replace ,, with ,:
> >
> >text = ${sg{${lookup ldap {ldap:///cn=$local_part@$domain,ou=users,dc=mail?autoresponder}}{,,}{,}}
>
> this is our poor man's workaround already. Yet, I don't understand
> the situation, where double commas are needed. What was broken so
> double commas seemed like a solution?


If one directory entry (object) contains a multivalued attribute
and if the value is allowed to contain a comma:

    foo = there, not here
    foo = over there


the query ldap:///<base>?foo?sub?<filter>
formerly returned the string

    there, not here, over there


That's ambigous.
Current versions return the string

    there,, not here,over there


That's clearly a list, using ',' as the separator.
If the lists values contain the separator, it has to be doubled.

E.g.

    hostslist relay_from_hosts = 127.0.0.1 : ::::1
or
    hostlist relay_from_hosts = <; 127.0.0.1 ; ::1


The last host list changes the list separator with the '<…' syntax.

I think, for your purpose, changing ,, to , would suffice. But the
perfect way would be using "reduce" to concat the values of a
multivalued attribute

    text = ${reduce{<, ${lookup ldap{…}}}{}{$value$item}}


    Best regards from Dresden/Germany
    Viele Grüße aus Dresden
    Heiko Schlittermann
-- 
 SCHLITTERMANN.de ---------------------------- internet & unix support -
 Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} -
 gnupg encrypted messages are welcome --------------- key ID: 7CBF764A -
 gnupg fingerprint: 9288 F17D BBF9 9625 5ABC  285C 26A9 687E 7CBF 764A -
(gnupg fingerprint: 3061 CFBF 2D88 F034 E8D2  7E92 EE4E AC98 48D0 359B)-