Subject: configuration data

From: Joseph Pingenot <[email-masked]>
Date: Wed, 10 Jan 2001 17:55:40 -0600

Hello.

I'm writing an authentication module for the c-client which needs to read
  in a list of host names from a file.  Although this is easy to do in the
  module itself, is there a good way to get the file read in on server
  startup?  It'd be a whole lot more efficient to do it that way.
Thanks!

                              -Joseph
  
-- 
Joseph Pingenot==========================================[email-masked]
Student Unix Systems Administrator,                  Tel: +1 785 532 3517
Computing and Networking Services,                   Fax: +1 785 532 3515      
Kansas State University
-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Wed, 10 Jan 2001 16:13:04 -0800 (PST)

>   startup?  It'd be a whole lot more efficient to do it that way.

Why do you think that it would be "more efficient"?

If your authentication module is not called by a session, then reading it at
startup would result in a waste of effort.  Sounds like less efficient to me.

If you're worried about reading in the file multiple times, that is easy to
resolve by using once-only code and a static, e.g.:
  static struct hostlist *list = 0;
You would then load the list with something like:
  if (!list) list = read_in_list ();
This guarantees that function read_in_list() is only called once, since in
subsequent calls list will be non-null.