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


On Sun, Sep 12, Andreas Jaeger wrote:

> >>>>> 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.

But we do. All network information services (NIS, NIS+, LDAP?) return 
them in random order.

  Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/       kukuk@suse.de
SuSE GmbH            Schanzaeckerstr. 10            90443 Nuernberg
Linux is like a Vorlon.  It is incredibly powerful, gives terse,
cryptic answers and has a lot of things going on in the background.

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