Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / gshadow.aug
1 (*
2  Module: Gshadow
3  Parses /etc/gshadow
4
5  Author: Lorenzo M. Catucci <catucci@ccd.uniroma2.it>
6
7  Original Author: Free Ekanayaka <free@64studio.com>
8
9  About: Reference
10    - man 5 gshadow
11
12  About: License
13    This file is licensed under the LGPL v2+, like the rest of Augeas.
14
15  About:
16
17  Each line in the gshadow files represents the additional shadow-defined
18  attributes for the corresponding group, as defined in the group file.
19
20 *)
21
22 module Gshadow =
23
24    autoload xfm
25
26 (************************************************************************
27  *                           USEFUL PRIMITIVES
28  *************************************************************************)
29
30 let eol        = Util.eol
31 let comment    = Util.comment
32 let empty      = Util.empty
33
34 let colon      = Sep.colon
35 let comma      = Sep.comma
36
37 let sto_to_spc = store Rx.space_in
38
39 let word    = Rx.word
40 let password = /[A-Za-z0-9_.!*-]*/
41 let integer = Rx.integer
42
43 (************************************************************************
44  * Group:                        ENTRIES
45  *************************************************************************)
46
47 (* View: member *)
48 let member       = [ label "member" . store word ]
49 (* View: member_list
50          the member list is a comma separated list of
51          users allowed to chgrp to the group without
52          being prompted for the group's password *)
53 let member_list  = Build.opt_list member comma
54
55 (* View: admin *)
56 let admin      = [ label "admin" . store word ]
57 (* View: admin_list
58          the admin_list is a comma separated list of
59          users allowed to change the group's password
60          and the member_list *)
61 let admin_list = Build.opt_list admin comma
62
63 (* View: params *)
64 let params     = [ label "password"  . store password  . colon ]
65                  .  admin_list?     . colon
66                  .  member_list?
67
68 let entry      = Build.key_value_line word colon params
69
70 (************************************************************************
71  *                                LENS
72  *************************************************************************)
73
74 let lns        = (comment|empty|entry) *
75
76 let filter
77                = incl "/etc/gshadow"
78                . Util.stdexcl
79
80 let xfm        = transform lns filter