[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#3514) back-meta/librewrite searchFilter substn



m.d.t.evans@qmul.ac.uk wrote:

>Full_Name: Martin Evans
>Version: 2.2.20
>OS: Linux
>URL: 
>Submission from: (NULL) (138.37.7.247)
>
>
>The following simplified config:
>
># meta the contacts directory
>database meta
>suffix ou=contacts
>readonly on
>lastmod off
>uri "ldap://ldap-external.qmul.ac.uk/ou=contacts";
>suffixmassage ou=contacts "o=Queen Mary and Westfield College,c=gb"
>
>rewriteEngine on
>rewriteContext searchFilter
>rewriteRule ".*" "(|(cn=m d t evans)(cn=s l sargent))"
>
Rules are applied recursively (see slapd-meta(5)).  In the above case, 
by default the filter is rewritten 100 times (see "rewriteMaxPasses" in 
slapd-meta(5)) into "(|(cn=m d t evans)(cn=s l sargent))".  You need to 
append a ":" flag to make it be processed exactly once.

>which works just fine. However, if I use a substitution in my rewriteRule. i.e.
>one of:
>
>rewriteRule "(.*)" "(|(cn=m d t evans)(%1))"
>or
>rewriteRule ".*" "(|(cn=m d t evans)(%0))"
>
>No results are returned when I search with the filter "(cn=s l sargent)".
>
These rules are broken for two reasons: first, the rule is applied 
recursively, so you need to add the ":" flag.  Second, a valid filter is 
something like "(<stuff>)", so the replacement you're trying to do would 
turn "(cn=s l sargent)" into "(|(cn=m d t evans)((cn=s l sargent)))" 
which is invalid (note the double layer of brackets around "cn=s l 
sargent".  What I suspect be the correct rule is

rewriteRule ".*" "(|(cn=m d t evans)%0)" ":"

>
>The target ldap server indicates that no search was run:
>
In fact, the client library couldn't turn that string

((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t 
evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m 
d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t 
evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m 
d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t 
evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m 
d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t 
evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m 
d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t 
evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m 
d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t 
evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m 
d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t 
evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m 
d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((|(cn=m d t evans)((..."

(log gets truncated...) into a valid filter.

I'd close this ITS.

p.




    SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497