Subject: Re: nsswitch implementation questions...
To: None <>
From: Jason Thorpe <>
List: current-users
Date: 01/16/1996 17:05:02
On Tue, 16 Jan 1996 12:26:39 -0500 
 "Perry E. Metzger" <> wrote:

 > I prefer simplicity myself. Apps should read the file on startup, once
 > in all likelyhood. If you are worried that you might have edited the
 > file and that something might read it partially, move the file into
 > place (though I doubt this is going to be much of aproblem.)

So, you'd have to keep this state around somewhere ... I certainly 
wouldn't want to teach every app how to use nsswitch ... it should Just 
Work.  Given that, maybe the best way is to read it as soon as it's 
needed, i.e. on the first call to getpwent() (which calls the underlying 
nsswitch goo), for example.  The "have read nsswitch.conf" state would be 
kept in the hidden goo.

Of course, there might also be something to be said for being able to 
change the contents of the file while the application runs and have those 
changes reflected in the behavior of the system (like, say, if you fix a 
configuration error in nsswitch.conf after having run mountd or 

So, perhaps:

	- "nsswitch.conf has been read" state kept as a
	  struct timeval *.

	- Call to getpwent()->nsswitch pointer NULL?  Yes,
	  allocate storage for timestamp, stat file, read file.

	- next call to getpwent()->nsswitch pointer NULL?  No,
	  stat file.  updated time?  Yes, update timestamp, read file.

	- etc, etc, etc.

Well, that's a quick brainstorm while I'm reading the last bits of mail.  
Do what you will with it :-)

Jason R. Thorpe                             
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939