tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: inetd enhancements - config syntax

On Fri, Jan 15, 2021 at 05:43:45PM -0800, John Nemeth wrote:
 > } We like the idea of being able to include files along with
 > } directories. Our current plan is to implement directories first,
 > } along with files if time permits us. If we don't have time to
 > } implement include-a-file, then we will make sure our include-a-directory
 > } implementation can easily be extended to support fies in the future.
 >      You should really start by implementing functionality to
 > include files as that is your base.  The way to implement including
 > directories is to stat the item being included to see if it is a
 > directory, and if it is, then branch to a routine that will scan
 > the directory and call the file inclusion routine on each file
 > found (skipping . and .. of course).

...and also, for your own and the operator's sanity, skip anything
else beginning with '.', names that don't end in ".conf" (or ".inetd"
or whatever you think the proper suffix should be), and anything that
isn't a regular file (DT_REG).

(If you get DT_UNKNOWN it's reasonable to call stat to get the real
type rather than just skipping it, and you might want to allow
symlinks, but definitely skip directories, devices, named pipes, etc.)

...also I strongly recommend against having global settings that are
meant to change around as things are included (such that the order
includes are processed in matters) -- you wouldn't write code that
used global variables that way, don't do it in configs...

David A. Holland

Home | Main Index | Thread Index | Old Index