Hi to all,
today I tried to set up the new overlay variant with OpenLDAP 2.6
(symas-packages) on a Debian 11 system
First step I loaded the module:
I added the Attribute "postaladdress" to an OU (ou=firma,dc=example,dc=net)
and the "mobile" attribute to (ou=firma,dc=example,dc=net)
Then I added the module
------------
dn: cn=module{0},cn=config
changetype: modify
add: olcModuleLoad
olcModuleLoad: variant.la
------------
Then I created the following configuration:
------------
dn: olcOverlay={5}variant,olcDatabase={2}mdb,cn=config
objectClass: olcVariantConfig
olcVariantPassReplication: TRUE
dn: name=example,olcOverlay={5}variant,olcDatabase={2}mdb,cn=config
objectClass: olcVariantVariant
olcVariantEntry: dc=example,dc=net
dn:
olcVariantVariantAttribute=postaladdress,name={0}example,olcOverlay={5}variant,olcDatabase={2}mdb,cn=config
objectClass: olcVariantAttribute
olcVariantVariantAttribute: postaladdress
olcVariantAlternativeAttribute: postaladdress
olcVariantAlternativeEntry: ou=firma,dc=example,dc=net
dn: name=firma
telefon,name={0}example,olcOverlay={5}variant,olcDatabase={2}mdb,cn=config
objectClass: olcVariantAttribute
olcVariantVariantAttribute: telephonenumber
olcVariantAlternativeAttribute: mobile
olcVariantAlternativeEntry:
cn=Verw-al,ou=users,ou=Verwaltung,ou=firma,dc=example,dc=net
------------
That works fine. dc=example,dc=net has the "postaladdress" from ou=firma
and
dc=example,dc=net has the "mobile" as "telephonenumber" from "cn=verw-al"
But now I like to set the attribute "telephonenumber" for all users in
ou=users,ou=verwaltung,ou=firma,dc=example,dc=net" to the
"telephonenumber" of "ou=firma,dc=example,dc=net". So I have to deal
with RegEx here.
I took a look at the example in the manpage and I'm even more confused.
I tried the following:
--------------------------
dn: name=verw-tel,olcOverlay={5}variant,olcDatabase={2}mdb,cn=config
objectClass: olcVariantRegex
olcVariantEntryRegex:
cn=.+,ou=users,ou=verwaltung,ou=firma,dc=example,dc=net
dn:
olcVariantVariantAttribute=telephonNumber,name={1}verw-tel,olcOverlay={5}variant,olcDatabase={2}mdb,cn=config
objectClass: olcVariantAttributePattern
olcVariantVariantAttribute: telephoneNumber
olcVariantAlternativeAttribute: telephoneNumber
olcVariantAlternativeEntryPattern: ou=Verwaltung,ou=firma,dc=example,dc=net
--------------------------
The first entry:
dn: name=verw-tel,olcOverlay={5}variant,olcDatabase={2}mdb,cn=config
Is telling me who should get the value from the shared attribute. Right?
That's the way it works without RegEx.
The second entry should point to the object and it's attribute to share.
Right?
So in "ou=verwaltung,...." I have the attribute "telephoneNumber" set
and this should be shared.
But If I try to add the entries. The first entry works. But the second
entry gives the following error message:
---------------
adding new entry
"olcVariantVariantAttribute=telephonNumber,name={1}verw-tel,olcOverlay={5}variant,olcDatabase={2}mdb,cn=config"
ldapadd: update failed:
olcVariantVariantAttribute=telephonNumber,name={1}verw-tel,olcOverlay={5}variant,olcDatabase={2}mdb,cn=config
ldap_add: Can't contact LDAP server (-1)
---------------
And as you can see, adding the entry crashes the slapd. Can someone tell
me the right way to use variant with regex?