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

Re: modify dn while replication

Pierangelo Masarati wrote:

It could be possible, but it's going to be rather clumsy;
it depends on whether there's a clear way you can extract
a filtering attribute from the DN, e.g. the "uid=<smtg>"
part, to do:

rewriteMap      ldap uidMap "ldap:///<naming context>?uid?sub"
rewriteRule     "^(uid=[^,]+)(,.*)$$" "%1-%{uidMap(%1)}%2" ":@I"

OK thanks a lot for the example :-), I'll try out, but before one question, where should I put
these rewrite rules, in the replica section of the master ? this way :

replica host=
bindmethod=simple credentials=secret
rewriteMap ldap uidMap "ldap:///ou=People,dc=int-evry,dc=fr?uid?one";
rewriteRule "^(uid=[^,]+)(,.*)$$" "%1-%{uidMap(%1)}%2" ":@I"
replogfile /var/lib/ldap/replica/replogfile

or on a dediceted ldap or meta backend ? sorry for beeing so ignorant, but it's the first time I play with the rewrite engine ! by the way, I suspect I need a " rewriteEngine on" somewhere, in slapd.conf ?

thanks a lot.


rewriteMap      ldap uidMap "ldap:///ou=People,dc=int-evry,dc=fr?uid?one";
rewriteRule     "^(uid=[^,]+)(,.*)$$" "%1-%{uidMap(%1)}%2" ":@I"

so that:

"uid=test,ou=People,dc=int-evry,dc=fr" =>
   "ldap:///ou=People,dc=int-evry,dc=fr?uid?sub?uid=test"; =>

Otherwise, if all you can tell from the DN is the DN itself,
the ldap rewriteMap should be hacked to support using the
filter string in the naming context, to do something like

rewriteMap      ldap uidMap "ldap:///%0?uid?base";
rewriteRule     "^(uid=[^,]+)(,.*)$$" "%1-%{uidMap(%0)}%2" ":@I"

This latter sintax is NOT SUPPORTED YET (AFAIK), but shouldn't
require a tremendous effort; only, the naming context part
of the URI should be rewritten itself.