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

back_meta problem

    Hi All!

I have a problem with back_meta.  I have a silly client, which
wants to see DNs in the form "cn=Bill Gates 1234, ou=People, ...",
where the 1234 is the uid attribute of the entry, "Bill Gates" is
the name (normally the cn attribute) of the person.  My database
is organized in the form

dn: uid=1234, ou=People, ...
uid: 1234
cn: Bill Gates
cn: Bill Gates 1234

I want to use back_meta to replace the DNs in requests from the
"cn=X Y 123, ou=People, ..." form to the normal "uid=123, ..."
form, and vice versa.  This is relative simple, at the moment I
use an ldap proxy (back_ldap) with the following back_meta lines:

rewriteEngine   on
rewriteMap      ldap attr2dn "ldap://localhost/<MY-ROOT>?dn?sub"
#rewriteContext  default
#rewriteRule     "(.*),[ ](.*)" "%1,%2"
rewriteContext  searchBase
rewriteRule     "^cn=([^,]+[ ][0-9]+)" "%{attr2dn(cn=%1)}" "@"

I have more problems:

-  I want to perform this rule olny in searches with scop=BASE,
	(when the silly client wants to read a persons entry)
	but I can't access that information.

-  I want to replace the DNs in the search result back to the
	baseDN in the search request, bat only in the that cases,
	if I have used the "cn=.." -> "uid=.." replacement.
	I tried this way:

	rewriteContext  searchBase
	rewriteRule    ".*" "%{&&distingName(%0)}%0" ":"

	rewriteContext searchResult
	rewriteRule    "" "%{**distingName}" ":"

	This works, but it replaces the good DNs in a normal
	search. For example under "ou=People, ..." with scope=SUB
	all the entries DNs are replaced with "ou=People, ..."

	I don't know how to change back only the needed DNs.  I
	think it is possible to use conditions with "@" and "G"
	flags, but I need help.

Could somebony help me to solve any of my problems?