Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define an auto-increment number for LDAP structure?

I have one attribute (groupIDNumber), I want to make it work as auto-increment number?

How can we define that attr?

Thank for your help,

-nm

like image 408
nm. Avatar asked Nov 13 '09 07:11

nm.


2 Answers

This is not part of the LDAP protocol, nor is it a standard thing to do. It is something you would normally do in your client-side logic. However, depending on which LDAP server you are using, it may be possible to achieve using a plugin or extension.

like image 97
Andrew Strong Avatar answered Nov 06 '22 21:11

Andrew Strong


This blog suggests that you can achieve the equivalent by creating a new object that is sort of a sequence. A working implementation in OpenLDAP is reported here. The object is defined as follows (note: not my code, just reproducing what was reported):

----------------------------------------------
objectClass ( 1.3.6.1.4.1.4203.666.599
    NAME 'uidNext'
    SUP top STRUCTURAL
    MUST ( cn $ uidNumber ) )
----------------------------------------------

LDIF entiries are then written as:

--- increment.ldif ------------------------------- 
dn: cn=uidNext,dc=example,dc=com
changetype: modify
increment:uidNumber
uidNumber: 1
-
---- EOF ------------------------------------------

And called with:

$ ldapadd -x -D "cn=Admin,dc=example,dc=com" -wsecret -f ./autoinc.ldif
like image 3
beldaz Avatar answered Nov 06 '22 23:11

beldaz