Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / pam.aug
1 (*
2 Module: Pam
3   Parses /etc/pam.conf and /etc/pam.d/* service files
4
5 Author: David Lutterkort <lutter@redhat.com>
6
7 About: Reference
8   This lens tries to keep as close as possible to `man pam.conf` where
9   possible.
10
11 About: Licence
12   This file is licensed under the LGPL v2+, like the rest of Augeas.
13
14 About: Lens Usage
15
16 About: Configuration files
17   This lens autoloads /etc/pam.d/* for service specific files. See <filter>.
18   It provides a lens for /etc/pam.conf, which is used in the PamConf module.
19 *)
20 module Pam =
21   autoload xfm
22
23   let eol = Util.eol
24   let indent = Util.indent
25   let space = del /([ \t]|\\\\\n)+/ " "
26
27   (* For the control syntax of [key=value ..] we could split the key value *)
28   (* pairs into an array and generate a subtree control/N/KEY = VALUE      *)
29   (* The valid control values if the [...] syntax is not used, is          *)
30   (*   required|requisite|optional|sufficient|include|substack             *)
31   (* We allow more than that because this list is not case sensitive and   *)
32   (* to be more lenient with typos                                         *)
33   let control = /(\[[^]#\n]*\]|[a-zA-Z]+)/
34   let word = /([^# \t\n\\]|\\\\.)+/
35   (* Allowed types *)
36   let types = /(auth|session|account|password)/i
37
38   (* This isn't entirely right: arguments enclosed in [ .. ] can contain  *)
39   (* a ']' if escaped with a '\' and can be on multiple lines ('\')       *)
40   let argument = /(\[[^]#\n]+\]|[^[#\n \t\\][^#\n \t\\]*)/
41
42   let comment = Util.comment
43   let comment_or_eol = Util.comment_or_eol
44   let empty   = Util.empty
45
46
47   (* Not mentioned in the man page, but Debian uses the syntax             *)
48   (*   @include module                                                     *)
49   (* quite a bit                                                           *)
50   let include = [ indent . Util.del_str "@" . key "include" .
51                   space . store word . eol ]
52
53   (* Shared with PamConf *)
54   let record = [ label "optional" . del "-" "-" ]? .
55                [ label "type" . store types ] .
56                space .
57                [ label "control" . store control] .
58                space .
59                [ label "module" . store word ] .
60                [ space . label "argument" . store argument ]* .
61                comment_or_eol
62
63   let record_svc = [ seq "record" . indent . record ]
64
65   let lns = ( empty | comment | include | record_svc ) *
66
67   let filter = incl "/etc/pam.d/*"
68              . excl "/etc/pam.d/allow.pamlist"
69              . excl "/etc/pam.d/README"
70              . Util.stdexcl
71
72   let xfm = transform lns filter
73
74 (* Local Variables: *)
75 (* mode: caml       *)
76 (* End:             *)