Mihai Ibanescu wrote:
> I am trying to buid support for another type of password databases
> (/etc/passwd and /etc/shadow are _slow_ for >2k users). I am trying to put
> these in a gdbm file. Since I intend to write a thread-safe code (I think
> I know what this means, but I'm not very sure), I'd really like to get rid
> of setpwent, getpwent and endpwend, since accessing gdbm's is pretty
> quick, and because I don't know if these functions wouldn't break the
> safeness of the code. gdbm manages its own locks, at least this
> is what TFM says.
> Is this schema thread-safe:
>
> - setpwent opens the gdbm (in read mode)
> - look for something in the database, sequentially, using some sort of
> getpwent
> - close the database (with endpwent)
>
> IMHO, it should be, since the read would allow other concurrent
> reads (even in other threads, I think), and no write, so no key
> reorganizing.
>
> Any opinion is appreciated.
This isn't really an answer to your question, but libc-6 (glibc-2)
supports the use of db files for password (and other) lookups, via the
NSS facility.
I'm not sure how much point there would be to developing this for
libc-5, as libc-5's multi-threading abilities aren't all that good.
--
Glynn Clements <[EMAIL PROTECTED]>