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

Re: Search for the last gidNumber/uidNumber

On 12/08/2012 01:11 PM, Michael Ströder wrote:
cbulist wrote:
  I would like to do a search using  ldapsearh in order to get the last
gidNumber/uidNumber assigned.
"Last" depends on the way you assign numbers. You could randomly generate ID
numbers. But you probably asked how to determine the highest stored ID.

An interesting approach was proposed by Kurt to use the server-side-sorting
control to let the server return LDAP results in reverse order and use
searchlimit=1. Of course your server has to support that control.

The caveat is that you cannot (re-)assign IDs if you have some gaps. It works
good when you have continously assigned IDs.

Don't forget to use slapo-unique to enforce unique IDs within the LDAP server.

Ciao, Michael.

Thanks Michael!...it's useful information.