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


>>>>> Marcus Harnisch writes:

 > Hi everybody,
 > Andreas Jaeger just sent me to this list with my question.

 > I am in a discussion on another mailing list concerning the NSS
 > databases.

 > db-Makefile generates Berkeley-DB files from the standard passwd,
 > group, etc. files. I the following will stick to the passwd database.

 > Apparently the awk-script to generate the makedb input stream creates
 > three key-types to describe an entry in /etc/passwd:
 >   1. '.<username>'
 >   2. '=<uid>'
 >   3. '0<serial number>'

 > I wonder what the serial number is used for. I guessed that there is a
 > convention that getXXXent() has to return entries in the same order as
 > they appear in /etc/passwd, which would IMHO not be a very good idea.

 > Leaving out the serial number entry could reduce the size of the DB by
 > about one third!
And would break the API :-(

I checked the documentation in the mean time.  Unix98 explictly states
for getpwent: 

  getpwent() function returns a pointer to a structure containing the
  broken-out fields of an entry in the user database.  Each entry in
  the user database contains a passwd structure.  When
  first called, getpwent() returns a pointer to a passwd structure
  containing the first entry in the user database.  Thereafter, it
  returns a pointer to a passwd structure containing the next entry in
  the user database.  Successive calls can be used to search the entire
  user database.

Please note the words "first" and "next".  I don't think we can return 
them in random order.

Andreas
-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de

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