Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / postfix_passwordmap.aug
1 (*
2 Module: Postfix_Passwordmap
3   Parses /etc/postfix/*passwd
4
5 Author: Anton Baranov <abaranov@linuxfoundation.org>
6
7 About: Reference
8   This lens tries to keep as close as possible to `man 5 postconf` and
9   http://www.postfix.org/SASL_README.html#client_sasl_enable where possible.
10
11 About: License
12    This file is licenced under the LGPL v2+, like the rest of Augeas.
13
14 About: Configuration files
15    This lens applies to /etc/postfix/*passwd. See <filter>.
16
17 About: Examples
18    The <Test_Postfix_Passwordmap> file contains various examples and tests.
19 *)
20
21 module Postfix_Passwordmap =
22
23 autoload xfm
24
25 (* View: space_or_eol *)
26 let space_or_eol = del /([ \t]*\n)?[ \t]+/ " "
27
28 (* View: word *)
29 let word = store /[A-Za-z0-9@_\+\*.-]+/
30
31 (* View: colon *)
32 let colon = Sep.colon
33
34 (* View: username *)
35 let username = [ label "username" . word ]
36
37 (* View: password *)
38 let password = [ label "password" . (store Rx.space_in)? ]
39
40 (* View: record *)
41 let record = [ label "pattern" . store /\[?[A-Za-z0-9@\*.-]+\]?(:?[A-Za-z0-9]*)*/
42              . space_or_eol . username . colon . password
43              . Util.eol ]
44
45 (* View: lns *)
46 let lns = (Util.empty | Util.comment | record)*
47
48 (* Variable: filter *)
49 let filter = incl "/etc/postfix/*passwd"
50            . incl "/usr/local/etc/postfix/*passwd"
51
52 let xfm = transform lns filter