[Exim] Exim 4 and rewrite rules and LDAP

Inizio della pagina
Delete this message
Reply to this message
Autore: John Dalbec
Data:  
To: Exim Users Mailing List
Oggetto: [Exim] Exim 4 and rewrite rules and LDAP
I have the following rewrite rule in my Exim 3 configuration:

*@^(mail0[1-4]\.cc\.|student\.|mail\.|)ysu\.edu$        "${lookup ldap\
        {ldap:///ou=People,dc=ysu,dc=edu?mail?sub?(mail=$0)}\
        {$0}{${lookup{$1}lsearch{/etc/passwd}\
        {$0}{$1@rewrite-me}}}}"                                 Ffrs


The convert4r4 script didn't change it in any way.

Exim 4 now does string expansion on the left-hand side, so I had to add
a layer of backslashes to it:

*@^(mail0[1-4]\\.cc\\.|student\\.|mail\\.|)ysu\\.edu\$ "${lookup ldap\
        {ldap:///ou=People,dc=ysu,dc=edu?mail?sub?(mail=$0)}\
        {$0}{${lookup{$1}lsearch{/etc/passwd}\
        {$0}{$1@rewrite-me}}}}"                                 Ffrs


I guess I could have used the \N quoting instead. I tried quoting with
"" but of course that didn't prevent the expansion (note to self:
RTFS!).

Then I found that Exim 4 was dropping the right parenthesis at the end
of the LDAP lookup. Perhaps it sees it as part of the argument of $?
Anyway, adding quote_ldap fixed that:

*@^(mail0[1-4]\\.cc\\.|student\\.|mail\\.|)ysu\\.edu\$ "${lookup ldap\

{ldap:///ou=People,dc=ysu,dc=edu?mail?sub?(mail=${quote_ldap:$0})}\
        {$0}{${lookup{$1}lsearch{/etc/passwd}\
        {$0}{$1@rewrite-me}}}}"                                 Ffrs


... and my MUA is wrapping that line now. Is there a good place to
break it in my configuration file? I added quote_ldap throughout and
some of the resulting lines are even longer.

It looks like I still need the "" around the right-hand side since it
has a space in it.
Thanks,
John Dalbec