Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*
- Module: Nsswitch
- Parses /etc/nsswitch.conf
- Author: Raphael Pinson <raphink@gmail.com>
- About: Reference
- This lens tries to keep as close as possible to `man nsswitch.conf` where possible.
- About: Licence
- This file is licensed under the LGPLv2+, like the rest of Augeas.
- About: Lens Usage
- About: Configuration files
- This lens applies to /etc/nsswitch.conf. See <filter>.
- *)
- module Nsswitch =
- autoload xfm
- (************************************************************************
- * Group: USEFUL PRIMITIVES
- *************************************************************************)
- (* View: comment *)
- let comment = Util.comment
- (* View: empty *)
- let empty = Util.empty
- (* View: sep_colon
- The separator for database entries *)
- let sep_colon = del /:[ \t]*/ ": "
- (* View: service
- The service specification like `files', `db', or `nis' *)
- let service = [ label "service" . store Rx.word ]
- (* View: reaction
- The reaction on lookup result like `[NOTFOUND=return]' *)
- let reaction =
- let status_kw = /success/i
- | /notfound/i
- | /unavail/i
- | /tryagain/i
- in let action_kw = /return/i
- | /continue/i
- 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 "]"
- (* View: database *)
- let database =
- let database_kw = "aliases"
- | "ethers"
- | "group"
- | "hosts"
- | "netgroup"
- | "networks"
- | "passwd"
- | "protocols"
- | "publickey"
- | "rpc"
- | "services"
- | "shadow"
- in [ label "database" . store database_kw
- . sep_colon
- . (Build.opt_list
- (service|reaction)
- Sep.space)
- . Util.eol ]
- (* View: lns *)
- let lns = ( empty | comment | database )*
- (* Variable: filter *)
- let filter = (incl "/etc/resolv.conf")
- . Util.stdexcl
- let xfm = transform lns filter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement