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

Re: modify dn while replication

> hello,
> I would like to replicate to a slave, but I need to change the dn.
> Here's a typical dn from the master:
> dn: uid=test,ou=People,dc=int-evry,dc=fr
> The slave should receive dn like this:
> dn: uid=test-ei0205,ou=People,dc=int-evry,dc=fr
> the "ei0205" appended here comming from the test user entry attribute:
> IntEPersUserPTM: ei0205
> Can you give me clues, docs (I've search openldap site with no success
> on this :-( ), or even better a exemple !
> I suspect there's something to do with ldap or meta backend, but I don't
>  know where to start, and what would be the cleaner solution.

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"


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.


Pierangelo Masarati