Xinetd

Parses xinetd configuration files

The structure of the lens and allowed attributes are ripped directly from xinetd’s parser in xinetd/parse.c in xinetd’s source checkout The downside of being so precise here is that if attributes are added they need to be added here, too.  Writing a catchall entry, and getting to typecheck correctly would be a huge pain.

A really enterprising soul could tighten this down even further by restricting the acceptable values for each attribute.

Author: David Lutterkort

Summary
XinetdParses xinetd configuration files
Augeas Variables
service_attrIt is much faster to combine, for example, all the attr_one attributes into one regexp and pass that to a lens instead of using lens union (attr_one “a” | attr_one “b”|..)
Augeas Lenses
bodyWe would really like to say “the body can contain any of a list of a list of attributes, each of them at most once”; but that would require that we build a lens that matches the permutation of all attributes; with around 40 individual attributes, that’s not computationally feasible, even if we didn’t have to worry about how to write that down.
includesIt would be nice if we could use the directories given in include and includedir directives to parse additional files instead of hardcoding all the places where xinetd config files can be found; but that is currently not possible, and implementing that has a good amount of hairy corner cases to consider.

Augeas Variables

service_attr

let service_attr = attr_one (/socket_type|protocol|wait|user|group|server|instances/i |/rpc_version|rpc_number|id|port|nice|banner|bind|interface/i |/per_source|groups|banner_success|banner_fail|disable|max_load/i |/rlimit_as|rlimit_cpu|rlimit_data|rlimit_rss|rlimit_stack|v6only/i |/deny_time|umask|mdns|libwrap/i)

Note

It is much faster to combine, for example, all the attr_one attributes into one regexp and pass that to a lens instead of using lens union (attr_one “a” | attr_one “b”|..) because the latter causes the type checker to work very hard.

Augeas Lenses

body

let body (attr:lens) = Build.block_newlines_spc (indent . attr . Util.eol) Util.comment

Note

We would really like to say “the body can contain any of a list of a list of attributes, each of them at most once”; but that would require that we build a lens that matches the permutation of all attributes; with around 40 individual attributes, that’s not computationally feasible, even if we didn’t have to worry about how to write that down.  The resulting regular expressions would simply be prohibitively large.

includes

let includes = Build.key_value_line /include(dir)?/ Sep.space (store Rx.no_spaces)

Note

It would be nice if we could use the directories given in include and includedir directives to parse additional files instead of hardcoding all the places where xinetd config files can be found; but that is currently not possible, and implementing that has a good amount of hairy corner cases to consider.

let service_attr = attr_one (/socket_type|protocol|wait|user|group|server|instances/i |/rpc_version|rpc_number|id|port|nice|banner|bind|interface/i |/per_source|groups|banner_success|banner_fail|disable|max_load/i |/rlimit_as|rlimit_cpu|rlimit_data|rlimit_rss|rlimit_stack|v6only/i |/deny_time|umask|mdns|libwrap/i)
It is much faster to combine, for example, all the attr_one attributes into one regexp and pass that to a lens instead of using lens union (attr_one “a” | attr_one “b”|..)
let body (attr:lens) = Build.block_newlines_spc (indent . attr . Util.eol) Util.comment
We would really like to say “the body can contain any of a list of a list of attributes, each of them at most once”; but that would require that we build a lens that matches the permutation of all attributes; with around 40 individual attributes, that’s not computationally feasible, even if we didn’t have to worry about how to write that down.
let includes = Build.key_value_line /include(dir)?/ Sep.space (store Rx.no_spaces)
It would be nice if we could use the directories given in include and includedir directives to parse additional files instead of hardcoding all the places where xinetd config files can be found; but that is currently not possible, and implementing that has a good amount of hairy corner cases to consider.
Close