Parses /etc/nsswitch.conf
Author: Raphael Pinson rap@gmai l.com hink
Nsswitch | Parses /etc/nsswitch.conf |
Reference | This lens tries to keep as close as possible to `man nsswitch.conf` where possible. |
Licence | This file is licensed under the LGPL v2+, like the rest of Augeas. |
Lens Usage | |
Configuration files | This lens applies to /etc/nsswitch.conf. |
USEFUL PRIMITIVES | |
comment | |
empty | |
sep_colon | The separator for database entries |
database_kw | The database specification like `passwd’, `shadow’, or `hosts’ |
service | The service specification like `files’, `db’, or `nis’ |
reaction | The reaction on lookup result like `[NOTFOUND=return]’ TODO: Use case-insensitive regexps when ticket #147 is fixed. |
database | |
lns | |
filter |
This lens applies to /etc/nsswitch.conf. See filter.
let reaction = let status_kw = /[Ss][Uu][Cc][Cc][Ee][Ss][Ss]/ | /[Nn][Oo][Tt][Ff][Oo][Uu][Nn][Dd]/ | /[Uu][Nn][Aa][Vv][Aa][Ii][Ll]/ | /[Tt][Rr][Yy][Aa][Gg][Aa][Ii][Nn]/ in let action_kw = /[Rr][Ee][Tt][Uu][Rr][Nn]/ | /[Cc][Oo][Nn][Tt][Ii][Nn][Uu][Ee]/ in let negate = [ Util.del_str "!" . label "negate" ] in let reaction_entry = [ label "status" . negate? . store status_kw . Util.del_str "=" . [ label "action" . store action_kw ] ] in Util.del_str "[" . [ label "reaction" . (Build.opt_list reaction_entry Sep.space) ] . Util.del_str "]"
The reaction on lookup result like `[NOTFOUND=return]’ TODO: Use case-insensitive regexps when ticket #147 is fixed.
let comment = Util.comment
let empty = Util.empty
The separator for database entries
let sep_colon = del /:[ \t]*/ ": "
The database specification like `passwd’, `shadow’, or `hosts’
let database_kw = Rx.word
The service specification like `files’, `db’, or `nis’
let service = [ label "service" . store Rx.word ]
The reaction on lookup result like `[NOTFOUND=return]’ TODO: Use case-insensitive regexps when ticket #147 is fixed.
let reaction = let status_kw = /[Ss][Uu][Cc][Cc][Ee][Ss][Ss]/ | /[Nn][Oo][Tt][Ff][Oo][Uu][Nn][Dd]/ | /[Uu][Nn][Aa][Vv][Aa][Ii][Ll]/ | /[Tt][Rr][Yy][Aa][Gg][Aa][Ii][Nn]/ in let action_kw = /[Rr][Ee][Tt][Uu][Rr][Nn]/ | /[Cc][Oo][Nn][Tt][Ii][Nn][Uu][Ee]/ in let negate = [ Util.del_str "!" . label "negate" ] in let reaction_entry = [ label "status" . negate? . store status_kw . Util.del_str "=" . [ label "action" . store action_kw ] ] in Util.del_str "[" . [ label "reaction" . (Build.opt_list reaction_entry Sep.space) ] . Util.del_str "]"
let database = [ label "database" . store database_kw . sep_colon . (Build.opt_list (service|reaction) Sep.space) . Util.eol ]
let lns = ( empty | comment | database )*