1 (* Passwd module for Augeas
2 Author: Free Ekanayaka <free@64studio.com>
4 Reference: man 5 passwd
12 (************************************************************************
14 *************************************************************************)
17 let comment = Util.comment
18 let empty = Util.empty
19 let dels = Util.del_str
21 let colon = del /:/ ":"
23 let sto_to_col = store /[^:\n]+/
24 let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/
26 let word = /[A-Za-z0-9_.-]+/
27 let integer = /[0-9]+/
29 (************************************************************************
31 *************************************************************************)
33 let entry = [ key word
35 . [ label "password" . store word . colon ]
36 . [ label "uid" . store integer . colon ]
37 . [ label "gid" . store integer . colon ]
38 . [ label "name" . sto_to_col? . colon ]
39 . [ label "home" . sto_to_col? . colon ]
40 . [ label "shell" . sto_to_eol? ]
43 (* A NIS entry has nothing bar the +@:::::: bits. *)
45 let nisuser = /\+\@[A-Za-z0-9_.-]+/ in
46 let colons = "::::::" in
47 [ dels "+@" . label "@nis" . store word . dels colons . eol ]
52 . [ label "password" . store word? . colon ]
53 . [ label "uid" . store integer? . colon ]
54 . [ label "gid" . store integer? . colon ]
55 . [ label "name" . sto_to_col? . colon ]
56 . [ label "home" . sto_to_col? . colon ]
57 . [ label "shell" . sto_to_eol? ] in
58 [ dels "+" . label "@nisdefault" . overrides? . eol ]
60 (************************************************************************
62 *************************************************************************)
64 let lns = (comment|empty|entry|nisentry|nisdefault) *
70 let xfm = transform lns filter