NIS+ enumeration of all database entries

Luke Kenneth Casson Leighton lkcl at switchboard.net
Mon May 18 13:49:18 GMT 1998


On Mon, 18 May 1998, Benny Holmgren wrote:

> On Mon, 18 May 1998, Luke Kenneth Casson Leighton wrote:
> 
> > how, in NIS+, do you enumerate all the entries in a database table?
> 
> The nis_list() function does that. It can be used in two ways, either
> passing a function pointer to a callback routine which is called for each
> entry or without a callback routine which returns all the entries in one
> result structure. The first way is better for large tables ofcourse.

hm...  thanks.

ok, how do you enumerate a (large) list, efficiently, one at a time, but
not with a callback?

i would like to implement:

startnisppwent()
nextnisppwent()
endnisppwent().

but sadly i am informed that nis_first_entry() and nis_next_entry() are
slow.  these would be the preferred option, however, to fit this
interface.

the alternative is to do a nis_list() of absolutely everything in
startnispwent(), have a struct which contains the result, an int of the
size and an enumeration int.  on each call to nextnispwent() you return
result[enum_int++] until enum_int == max_size.  in endnispwent() you call
nis_freeresult().

luke


More information about the samba-technical mailing list