1 (* Slapd module for Augeas
2 Author: Free Ekanayaka <free@64studio.com>
4 Reference: man slapd.conf(5), man slapd.access (5)
11 (************************************************************************
13 *************************************************************************)
16 let spc = Util.del_ws_spc
17 let sep = del /[ \t\n]+/ " "
19 let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/
20 let sto_to_spc = store /[^\\# \t\n]+/
22 let comment = Util.comment
23 let empty = Util.empty
25 (************************************************************************
27 *************************************************************************)
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)) ]
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
39 let access = [ key access_re . spc. sto_to_spc . by+ . eol ]
41 (************************************************************************
43 *************************************************************************)
45 (* TODO: parse special field separately, see man slapd.conf (5) *)
46 let global_re = "allow"
55 | "conn_max_pending_auth"
62 | "index_substr_if_minlen"
63 | "index_substr_if_maxlen"
64 | "index_substr_any_len"
65 | "index_substr_any_step"
73 | "password-crypt-salt-format"
78 | "replicationinterval"
88 | "sockbuf_max_incoming "
89 | "sockbuf_max_incoming_auth"
94 | "TLSCACertificateFile"
95 | "TLSCACertificatePath"
96 | "TLSCertificateFile"
97 | "TLSCertificateKeyFile"
104 let global = Build.key_ws_value global_re
106 (************************************************************************
108 *************************************************************************)
110 (* TODO: support all types of database backend *)
111 let database_hdb = "cachesize"
126 let database_re = "suffix"
144 let val = Quote.double_opt
145 in Build.key_value_line database_re Sep.space val
147 let database = [ key "database"
151 . (comment|empty|database_entry|access)* ]
153 (************************************************************************
155 *************************************************************************)
157 let lns = (comment|empty|global|access)* . (database)*
159 let filter = incl "/etc/ldap/slapd.conf"
160 . incl "/etc/openldap/slapd.conf"
162 let xfm = transform lns filter