This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: NSS and db


> > I see. What's wrong with dbm_firstkey/dbm_nextkey?
> 
> Beside that they don't exist for the db interface?

Is that documented somewhere? My /usr/include/db.h has

#define	nextkey(a)	__db_dbm_nextkey(a)

In db2/dbm/dbm.c, this is implemented as a call to dbm_nextkey, which
in turn is __db_ndbm_nextkey. So what exactly means 'not supported for
the db interface'? I see this takes a DBM*, whereas the nss code uses
DB*, but I also see

typedef DB DBM;

in db1/ndbm.h

> How would you implement the behaviour that each entry is returned
> exactly once?

I would expect dbm_firstkey and dbm_nextkey to do exactly that. As the
Solaris man page says:

# dbm_firstkey() will return the first key in the data
# base. dbm_nextkey() will return the next key in the data base. This
# code will traverse the data base:
#
# for (key = dbm_firstkey(db); key.dptr != NULL; key = dbm_nextkey(db))

> And it must be possible to have other lookups at the same time (on
> the same descriptor) 

Well, that may be a problem. But then, performing lookups destroys the
enumerating process, as the Solaris man page explains:

# Calls to getpwnam() and getpwuid() leave the enumeration position in
# an indeterminate state.

If you want to provide stronger guarantees, you still can do this: You
control both the db implementation, and the nss_db implementation. So
if you want to, you can extend the interface for internal use.

> and and and

What else? :-)

Good night,
Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]