3 Parses /etc/master.passwd
5 Author: Matt Dainty <matt@bodgit-n-scarper.com>
10 Each line in the master.passwd file represents a single user record, whose
11 colon-separated attributes correspond to the members of the passwd struct
19 (************************************************************************
20 * Group: USEFUL PRIMITIVES
21 *************************************************************************)
23 (* Group: Comments and empty lines *)
26 let comment = Util.comment
27 let empty = Util.empty
28 let dels = Util.del_str
31 let integer = Rx.integer
35 let sto_to_eol = Passwd.sto_to_eol
36 let sto_to_col = Passwd.sto_to_col
37 (* Store an empty string if nothing matches *)
38 let sto_to_col_or_empty = Passwd.sto_to_col_or_empty
40 (************************************************************************
42 *************************************************************************)
44 let username = /[_.A-Za-z0-9][-_.A-Za-z0-9]*\$?/
48 let password = [ label "password" . sto_to_col? . colon ]
52 let uid = [ label "uid" . store integer . colon ]
56 let gid = [ label "gid" . store integer . colon ]
60 let class = [ label "class" . sto_to_col? . colon ]
64 let change_date = [ label "change_date" . store integer? . colon ]
68 let expire_date = [ label "expire_date" . store integer? . colon ]
71 pw_gecos; the user's full name *)
72 let name = [ label "name" . sto_to_col? . colon ]
76 let home = [ label "home" . sto_to_col? . colon ]
80 let shell = [ label "shell" . sto_to_eol? ]
84 let entry = [ key username
98 let niscommon = [ label "password" . sto_to_col ]? . colon
99 . [ label "uid" . store integer ]? . colon
100 . [ label "gid" . store integer ]? . colon
101 . [ label "class" . sto_to_col ]? . colon
102 . [ label "change_date" . store integer ]? . colon
103 . [ label "expire_date" . store integer ]? . colon
104 . [ label "name" . sto_to_col ]? . colon
105 . [ label "home" . sto_to_col ]? . colon
106 . [ label "shell" . sto_to_eol ]?
112 [ dels "+@" . label "@nis" . store username . overrides . eol ]
118 [ dels "+" . label "@+nisuser" . store username . overrides . eol ]
124 [ dels "-" . label "@-nisuser" . store username . overrides . eol ]
129 . [ label "password" . sto_to_col_or_empty . colon ]
130 . [ label "uid" . store integer? . colon ]
131 . [ label "gid" . store integer? . colon ]
132 . [ label "class" . sto_to_col? . colon ]
133 . [ label "change_date" . store integer? . colon ]
134 . [ label "expire_date" . store integer? . colon ]
135 . [ label "name" . sto_to_col? . colon ]
136 . [ label "home" . sto_to_col? . colon ]
137 . [ label "shell" . sto_to_eol? ] in
138 [ dels "+" . label "@nisdefault" . overrides? . eol ]
140 (************************************************************************
142 *************************************************************************)
144 let lns = (comment|empty|entry|nisentry|nisdefault|nisuserplus|nisuserminus) *
146 let filter = incl "/etc/master.passwd"
148 let xfm = transform lns filter