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