This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
NSS DB sequence question
- From: Chris Adams <cmadams at hiwaay dot net>
- To: libc-help at sourceware dot org
- Date: Wed, 20 Jan 2010 08:53:23 -0600
- Subject: NSS DB sequence question
I'm building a new server that will have about 12,000 users. I didn't
want to just dump them in /etc/passwd (I've had performance problems
there before), but I didn't want to have to deal with something like
LDAP (this is a stand-alone system and I wanted to avoid the
complication of LDAP), so I looked at nss_db to store users in a
Berkeley DB file. I also thought that using a DB file would make
adding/deleting users easier (just operating directly on the DB file
instead of regenerating it for every change).
I found that there isn't really any documentation on the required format
of the file, but I figured out that I need 3 entries per user: ".user",
"=uid", and a sequential entry "0<number>". The problem I'm running
into is that the sequential entry numbers must be consecutive; the
nss_db code starts looking with 00 and uses a counter (rather than just
walking the database in sequence).
This is a problem when I delete an entry, because it leaves a hole in
the sequence. I'm looking at a few ways to handle this:
- renumber all entries past the deleted entry (a lot of churn)
- renumber the last entry into the hole (changing order might be a
problem)
- insert an invalid entry (the nss_db code skips unparseable entries)
What do other people do? Are there other options?
Is there any chance the nss_db code could be changed to walk the
sequence differently?
--
Chris Adams <cmadams@hiwaay.net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.