Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!tgr!alb@Mitre-Bedford From: alb@Mitre-Bedford Newsgroups: net.unix Subject: Re: sorted /etc/passwd? Message-ID: <7864@brl-tgr.ARPA> Date: Wed, 30-Jan-85 16:42:17 EST Article-I.D.: brl-tgr.7864 Posted: Wed Jan 30 16:42:17 1985 Date-Received: Sun, 3-Feb-85 02:02:48 EST Sender: news@brl-tgr.ARPA Organization: Ballistic Research Lab Lines: 24 Xref: seismo net.unix:3687 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@mitre-bedford.arpa len%tufts.csnet@csnet-relay