sorted /etc/passwd?

alb at Mitre-Bedford alb at Mitre-Bedford
Thu Jan 31 07:42:17 AEST 1985


Got just such an animal here.  ~800 users were enough for
us to make this change.

The general idea:

Agree that uid's are unique, define a structure with all the
/etc/passwd information on a line in it, read the password file -
writing a structure in a database for each line.

You now have a binary indexed database, indexed by uid.
Since you know the length of the records, lseek is used
to skip to the entry desired. (very fast)

To get the uid from the name, we hashed the names/uid pairs
and put them in a seperate file, but one could also skip
throuth the db comparing name (or any field for that matter),
to the appropriate field.

You can reply directly to me if you have specific questions.

len
-----------------------------------------------------------------------
A. Leonard Brown   alb at mitre-bedford.arpa   len%tufts.csnet at csnet-relay



More information about the Comp.unix mailing list