Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / slapd.aug
1 (* Slapd module for Augeas
2    Author: Free Ekanayaka <free@64studio.com>
3
4    Reference: man slapd.conf(5), man slapd.access (5)
5
6 *)
7
8 module Slapd =
9   autoload xfm
10
11 (************************************************************************
12  *                           USEFUL PRIMITIVES
13  *************************************************************************)
14
15 let eol         = Util.eol
16 let spc         = Util.del_ws_spc
17 let sep         = del /[ \t\n]+/ " "
18
19 let sto_to_eol  = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/
20 let sto_to_spc  = store /[^\\# \t\n]+/
21
22 let comment     = Util.comment
23 let empty       = Util.empty
24
25 (************************************************************************
26  *                           ACCESS TO
27  *************************************************************************)
28
29 let access_re   = "access to"
30 let control_re  = "stop" | "continue" | "break"
31 let what        = [ spc . label "access"
32                   . store (/[^\\# \t\n]+/ - ("by" | control_re)) ]
33
34 (* TODO: parse the control field, see man slapd.access (5) *)
35 let control     = [ spc . label "control" . store control_re ]
36 let by          = [ sep . key "by" . spc . sto_to_spc
37                   . what? . control? ]
38
39 let access      = [ key access_re . spc. sto_to_spc . by+ . eol ]
40
41 (************************************************************************
42  *                             GLOBAL
43  *************************************************************************)
44
45 (* TODO: parse special field separately, see man slapd.conf (5) *)
46 let global_re   = "allow"
47                 | "argsfile"
48                 | "attributeoptions"
49                 | "attributetype"
50                 | "authz-policy"
51                 | "ldap"
52                 | "dn"
53                 | "concurrency"
54                 | "cron_max_pending"
55                 | "conn_max_pending_auth"
56                 | "defaultsearchbase"
57                 | "disallow"
58                 | "ditcontentrule"
59                 | "gentlehup"
60                 | "idletimeout"
61                 | "include"
62                 | "index_substr_if_minlen"
63                 | "index_substr_if_maxlen"
64                 | "index_substr_any_len"
65                 | "index_substr_any_step"
66                 | "localSSF"
67                 | "loglevel"
68                 | "moduleload"
69                 | "modulepath"
70                 | "objectclass"
71                 | "objectidentifier"
72                 | "password-hash"
73                 | "password-crypt-salt-format"
74                 | "pidfile"
75                 | "referral"
76                 | "replica-argsfile"
77                 | "replica-pidfile"
78                 | "replicationinterval"
79                 | "require"
80                 | "reverse-lookup"
81                 | "rootDSE"
82                 | "sasl-host"
83                 | "sasl-realm"
84                 | "sasl-secprops"
85                 | "schemadn"
86                 | "security"
87                 | "sizelimit"
88                 | "sockbuf_max_incoming "
89                 | "sockbuf_max_incoming_auth"
90                 | "threads"
91                 | "timelimit time"
92                 | "tool-threads"
93                 | "TLSCipherSuite"
94                 | "TLSCACertificateFile"
95                 | "TLSCACertificatePath"
96                 | "TLSCertificateFile"
97                 | "TLSCertificateKeyFile"
98                 | "TLSDHParamFile"
99                 | "TLSRandFile"
100                 | "TLSVerifyClient"
101                 | "TLSCRLCheck"
102                 | "backend"
103
104 let global     = Build.key_ws_value global_re
105
106 (************************************************************************
107  *                             DATABASE
108  *************************************************************************)
109
110 (* TODO: support all types of database backend *)
111 let database_hdb = "cachesize"
112                 | "cachefree"
113                 | "checkpoint"
114                 | "dbconfig"
115                 | "dbnosync"
116                 | "directory"
117                 | "dirtyread"
118                 | "idlcachesize"
119                 | "index"
120                 | "linearindex"
121                 | "lockdetect"
122                 | "mode"
123                 | "searchstack"
124                 | "shm_key"
125
126 let database_re = "suffix"
127                 | "lastmod"
128                 | "limits"
129                 | "maxderefdepth"
130                 | "overlay"
131                 | "readonly"
132                 | "replica uri"
133                 | "replogfile"
134                 | "restrict"
135                 | "rootdn"
136                 | "rootpw"
137                 | "subordinate"
138                 | "syncrepl rid"
139                 | "updatedn"
140                 | "updateref"
141                 | database_hdb
142
143 let database_entry =
144      let val = Quote.double_opt
145   in Build.key_value_line database_re Sep.space val
146
147 let database    = [ key "database"
148                   . spc
149                   . sto_to_eol
150                   . eol
151                   . (comment|empty|database_entry|access)* ]
152
153 (************************************************************************
154  *                              LENS
155  *************************************************************************)
156
157 let lns         = (comment|empty|global|access)* . (database)*
158
159 let filter      = incl "/etc/ldap/slapd.conf"
160                 . incl "/etc/openldap/slapd.conf"
161
162 let xfm         = transform lns filter