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

About rewrite contexts for search operations in meta-backend



Hi all,
I have a doubt about how the rewriting works for search operations, the question is: Is it possible to use the information in the search filter to rewrite the search base? By reading the documentation, it seems it's possible to do this by using variable assignment and dereferencing (with operators &, &&, *, and **), but I've tried to do it without any success. It seems like in a search operation the searchBase rewrite context is evaluated before the searchfilter one, is this the case?
I want to rewrite the search base depending of what is received in the search filter, so I've something like this in my configuration file:


uri "ldap://localhost:30389/ou=subscribers,o=company";
rewriteEngine on
rewriteParam subs1 subscribers1
rewriteParam subs2 subscribers2
rewriteContext searchFilter
rewriteRule "(.*)[0-9]*1" "%{&&therdn(%{$subs1})}%0" ":"
rewriteRule "(.*)[0-9]*2" "%{&&therdn(%{$subs2})}%0" ":"
rewriteContext searchBase
rewriteRule "(.*)ou=subscribers,o=company" "%1ou=%{**therdn},o=company" "@"


   And when I do the search operation, the error I have is:

connection_get(7)
send_ldap_result: err=0 matched="" text=""
connection_get(7)
SRCH "ou=subscribers,o=company" 2 0    0 0 0
   filter: (SearchOn=mms00000000001)
   attrs:
request 1 done
==> rewrite_context_apply error ...
send_ldap_result: err=80 matched="" text="rewrite error"
connection_get(7)

I've seen this error happens in the rewriting rule of the searchBase rewriteContext, and I suspect this is because the "therdn" variable hasn't been initialised, because the searchBase rewriteContext evaluates before the searchFilter one, is this the reason? It's possible to do what I intend in some other way with the meta or ldap back-end, and in that case, what would be the proper way to configure it?

   Thank you very much in advance.
   Kind regards,

   Aníbal Cáceres.