1 /* bconfig.c - the config backend */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2005 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
17 * This work was originally developed by Howard Chu for inclusion
18 * in OpenLDAP Software.
24 #include <ac/string.h>
31 #include "slapi/slapi.h"
38 #define CONFIG_DN "cn=config"
41 typedef struct modpath_s {
42 struct modpath_s *mp_next;
43 struct berval mp_path;
48 typedef struct ConfigFile {
49 struct ConfigFile *c_sibs;
50 struct ConfigFile *c_kids;
59 typedef struct CfEntryInfo {
60 struct CfEntryInfo *ce_sibs;
61 struct CfEntryInfo *ce_kids;
68 ConfigFile *cb_config;
72 /* These do nothing in slapd, they're kept only to make them
75 static char *replica_pidFile, *replica_argsFile;
76 static int replicationInterval;
78 static char *passwd_salt;
79 static char *logfileName;
80 static BerVarray authz_rewrites;
82 static AttributeDescription *cfAd_backend, *cfAd_database, *cfAd_overlay,
85 static ObjectClass *cfOc_global, *cfOc_backend, *cfOc_database,
86 *cfOc_include, *cfOc_overlay;
88 static ConfigFile cf_prv, *cfn = &cf_prv;
90 static int add_syncrepl LDAP_P(( Backend *, char **, int ));
91 static int parse_syncrepl_line LDAP_P(( char **, int, syncinfo_t *));
92 static void syncrepl_unparse LDAP_P (( syncinfo_t *, struct berval *));
94 static ConfigDriver config_fname;
95 static ConfigDriver config_generic;
96 static ConfigDriver config_search_base;
97 static ConfigDriver config_passwd_hash;
98 static ConfigDriver config_schema_dn;
99 static ConfigDriver config_sizelimit;
100 static ConfigDriver config_timelimit;
101 static ConfigDriver config_limits;
102 static ConfigDriver config_overlay;
103 static ConfigDriver config_suffix;
104 static ConfigDriver config_deref_depth;
105 static ConfigDriver config_rootdn;
106 static ConfigDriver config_rootpw;
107 static ConfigDriver config_restrict;
108 static ConfigDriver config_allows;
109 static ConfigDriver config_disallows;
110 static ConfigDriver config_requires;
111 static ConfigDriver config_security;
112 static ConfigDriver config_referral;
113 static ConfigDriver config_loglevel;
114 static ConfigDriver config_syncrepl;
115 static ConfigDriver config_replica;
116 static ConfigDriver config_updatedn;
117 static ConfigDriver config_updateref;
118 static ConfigDriver config_include;
120 static ConfigDriver config_tls_option;
121 static ConfigDriver config_tls_config;
170 static OidRec OidMacros[] = {
171 /* OpenLDAProot:666.11.1 */
172 { "OLcfg", "1.3.6.1.4.1.4203.666.11.1" },
173 { "OLcfgAt", "OLcfg:3" },
174 { "OLcfgOc", "OLcfg:4" },
175 { "OMsyn", "1.3.6.1.4.1.1466.115.121.1" },
176 { "OMsInteger", "OMsyn:2" },
177 { "OMsBoolean", "OMsyn:7" },
178 { "OMsDN", "OMsyn:12" },
179 { "OMsDirectoryString", "OMsyn:15" },
180 { "OMsOctetString", "OMsyn:40" },
184 /* alphabetical ordering */
186 ConfigTable config_back_cf_table[] = {
187 /* This attr is read-only */
188 { "", "", 0, 0, 0, ARG_MAGIC,
189 &config_fname, "( OLcfgAt:78 NAME 'olcConfigFile' "
190 "DESC 'File for slapd configuration directives' "
191 "EQUALITY caseIgnoreMatch "
192 "SYNTAX OMsDirectoryString )", NULL, NULL },
193 { "access", NULL, 0, 0, 0, ARG_MAY_DB|ARG_MAGIC|CFG_ACL,
194 &config_generic, "( OLcfgAt:1 NAME 'olcAccess' "
195 "DESC 'Access Control List' "
196 "EQUALITY caseIgnoreMatch "
197 "SYNTAX OMsDirectoryString X-ORDERED 'VALUES' )", NULL, NULL },
198 { "allows", "features", 2, 0, 5, ARG_PRE_DB|ARG_MAGIC,
199 &config_allows, "( OLcfgAt:2 NAME 'olcAllows' "
200 "DESC 'Allowed set of deprecated features' "
201 "EQUALITY caseIgnoreMatch "
202 "SYNTAX OMsDirectoryString )", NULL, NULL },
203 { "argsfile", "file", 2, 2, 0, ARG_STRING,
204 &slapd_args_file, "( OLcfgAt:3 NAME 'olcArgsFile' "
205 "DESC 'File for slapd command line options' "
206 "EQUALITY caseIgnoreMatch "
207 "SYNTAX OMsDirectoryString )", NULL, NULL },
208 /* Use standard 'attributeTypes' attr */
209 { "attribute", "attribute", 2, 0, 9, ARG_PAREN|ARG_MAGIC|CFG_ATTR,
210 &config_generic, NULL, NULL, NULL },
211 { "attributeoptions", NULL, 0, 0, 0, ARG_MAGIC|CFG_ATOPT,
212 &config_generic, "( OLcfgAt:5 NAME 'olcAttributeOptions' "
213 "EQUALITY caseIgnoreMatch "
214 "SYNTAX OMsDirectoryString )", NULL, NULL },
215 { "authid-rewrite", NULL, 2, 0, 0,
216 #ifdef SLAP_AUTH_REWRITE
217 ARG_MAGIC|CFG_REWRITE, &config_generic,
221 "( OLcfgAt:6 NAME 'olcAuthIDRewrite' "
222 "EQUALITY caseIgnoreMatch "
223 "SYNTAX OMsDirectoryString )", NULL, NULL },
224 { "authz-policy", "policy", 2, 2, 0, ARG_STRING|ARG_MAGIC|CFG_AZPOLICY,
225 &config_generic, "( OLcfgAt:7 NAME 'olcAuthzPolicy' "
226 "EQUALITY caseIgnoreMatch "
227 "SYNTAX OMsDirectoryString )", NULL, NULL },
228 { "authz-regexp", NULL, 3, 3, 0, ARG_MAGIC|CFG_AZREGEXP,
229 &config_generic, "( OLcfgAt:8 NAME 'olcAuthzRegexp' "
230 "EQUALITY caseIgnoreMatch "
231 "SYNTAX OMsDirectoryString X-ORDERED 'VALUES' )", NULL, NULL },
232 { "backend", "type", 2, 2, 0, ARG_PRE_DB|ARG_MAGIC|CFG_BACKEND,
233 &config_generic, "( OLcfgAt:9 NAME 'olcBackend' "
234 "DESC 'A type of backend' "
235 "EQUALITY caseIgnoreMatch "
236 "SYNTAX OMsDirectoryString )", NULL, NULL },
237 { "concurrency", "level", 2, 2, 0, ARG_INT|ARG_NONZERO|ARG_MAGIC|CFG_CONCUR,
238 &config_generic, "( OLcfgAt:10 NAME 'olcConcurrency' "
239 "SYNTAX OMsInteger )", NULL, NULL },
240 { "conn_max_pending", "max", 2, 2, 0, ARG_LONG,
241 &slap_conn_max_pending, "( OLcfgAt:11 NAME 'olcConnMaxPending' "
242 "SYNTAX OMsInteger )", NULL, NULL },
243 { "conn_max_pending_auth", "max", 2, 2, 0, ARG_LONG,
244 &slap_conn_max_pending_auth, "( OLcfgAt:12 NAME 'olcConnMaxPendingAuth' "
245 "SYNTAX OMsInteger )", NULL, NULL },
246 { "database", "type", 2, 2, 0, ARG_MAGIC|CFG_DATABASE,
247 &config_generic, "( OLcfgAt:13 NAME 'olcDatabase' "
248 "DESC 'The backend type for a database instance' "
249 "SUP olcBackend )", NULL, NULL },
250 { "defaultSearchBase", "dn", 2, 2, 0, ARG_PRE_BI|ARG_PRE_DB|ARG_DN|ARG_MAGIC,
251 &config_search_base, "( OLcfgAt:14 NAME 'olcDefaultSearchBase' "
252 "SYNTAX OMsDN )", NULL, NULL },
253 { "disallows", "features", 2, 0, 8, ARG_PRE_DB|ARG_MAGIC,
254 &config_disallows, "( OLcfgAt:15 NAME 'olcDisallows' "
255 "EQUALITY caseIgnoreMatch "
256 "SYNTAX OMsDirectoryString )", NULL, NULL },
257 /* use standard schema */
258 { "ditcontentrule", NULL, 0, 0, 0, ARG_MAGIC|CFG_DIT,
259 &config_generic, NULL, NULL, NULL },
260 { "gentlehup", "on|off", 2, 2, 0,
262 ARG_ON_OFF, &global_gentlehup,
266 "( OLcfgAt:17 NAME 'olcGentleHUP' "
267 "SYNTAX OMsBoolean )", NULL, NULL },
268 { "idletimeout", "timeout", 2, 2, 0, ARG_INT,
269 &global_idletimeout, "( OLcfgAt:18 NAME 'olcIdleTimeout' "
270 "SYNTAX OMsInteger )", NULL, NULL },
271 /* XXX -- special case? */
272 { "include", "file", 2, 2, 0, ARG_MAGIC,
273 &config_include, "( OLcfgAt:19 NAME 'olcInclude' "
274 "SUP labeledURI )", NULL, NULL },
275 { "index_substr_if_minlen", "min", 2, 2, 0, ARG_INT|ARG_NONZERO|ARG_MAGIC|CFG_SSTR_IF_MIN,
276 &config_generic, "( OLcfgAt:20 NAME 'olcIndexSubstrIfMinLen' "
277 "SYNTAX OMsInteger )", NULL, NULL },
278 { "index_substr_if_maxlen", "max", 2, 2, 0, ARG_INT|ARG_NONZERO|ARG_MAGIC|CFG_SSTR_IF_MAX,
279 &config_generic, "( OLcfgAt:21 NAME 'olcIndexSubstrIfMaxLen' "
280 "SYNTAX OMsInteger )", NULL, NULL },
281 { "index_substr_any_len", "len", 2, 2, 0, ARG_INT|ARG_NONZERO,
282 &index_substr_any_len, "( OLcfgAt:22 NAME 'olcIndexSubstrAnyLen' "
283 "SYNTAX OMsInteger )", NULL, NULL },
284 { "index_substr_step", "step", 2, 2, 0, ARG_INT|ARG_NONZERO,
285 &index_substr_any_step, "( OLcfgAt:23 NAME 'olcIndexSubstrAnyStep' "
286 "SYNTAX OMsInteger )", NULL, NULL },
287 { "lastmod", "on|off", 2, 2, 0, ARG_DB|ARG_ON_OFF|ARG_MAGIC|CFG_LASTMOD,
288 &config_generic, "( OLcfgAt:24 NAME 'olcLastMod' "
289 "SYNTAX OMsBoolean )", NULL, NULL },
290 { "limits", "limits", 2, 0, 0, ARG_DB|ARG_MAGIC|CFG_LIMITS,
291 &config_generic, "( OLcfgAt:25 NAME 'olcLimits' "
292 "SYNTAX OMsDirectoryString )", NULL, NULL },
293 { "localSSF", "ssf", 2, 2, 0, ARG_LONG,
294 &local_ssf, "( OLcfgAt:26 NAME 'olcLocalSSF' "
295 "SYNTAX OMsInteger )", NULL, NULL },
296 { "logfile", "file", 2, 2, 0, ARG_STRING|ARG_MAGIC|CFG_LOGFILE,
297 &config_generic, "( OLcfgAt:27 NAME 'olcLogFile' "
298 "SYNTAX OMsDirectoryString )", NULL, NULL },
299 { "loglevel", "level", 2, 0, 0, ARG_MAGIC,
300 &config_loglevel, "( OLcfgAt:28 NAME 'olcLogLevel' "
301 "SYNTAX OMsDirectoryString )", NULL, NULL },
302 { "maxDerefDepth", "depth", 2, 2, 0, ARG_DB|ARG_INT|ARG_MAGIC|CFG_DEPTH,
303 &config_generic, "( OLcfgAt:29 NAME 'olcMaxDerefDepth' "
304 "SYNTAX OMsInteger )", NULL, NULL },
305 { "moduleload", "file", 2, 0, 0,
307 ARG_MAGIC|CFG_MODLOAD, &config_generic,
311 "( OLcfgAt:30 NAME 'olcModuleLoad' "
312 "SYNTAX OMsDirectoryString )", NULL, NULL },
313 { "modulepath", "path", 2, 2, 0,
315 ARG_MAGIC|CFG_MODPATH, &config_generic,
319 "( OLcfgAt:31 NAME 'olcModulePath' "
320 "SYNTAX OMsDirectoryString )", NULL, NULL },
321 /* use standard schema */
322 { "objectclass", "objectclass", 2, 0, 0, ARG_PAREN|ARG_MAGIC|CFG_OC,
323 &config_generic, NULL, NULL, NULL },
324 { "objectidentifier", NULL, 0, 0, 0, ARG_MAGIC|CFG_OID,
325 &config_generic, "( OLcfgAt:33 NAME 'olcObjectIdentifier' "
326 "SYNTAX OMsDirectoryString )", NULL, NULL },
327 { "overlay", "overlay", 2, 2, 0, ARG_MAGIC,
328 &config_overlay, "( OLcfgAt:34 NAME 'olcOverlay' "
329 "SUP olcDatabase )", NULL, NULL },
330 { "password-crypt-salt-format", "salt", 2, 2, 0, ARG_STRING|ARG_MAGIC|CFG_SALT,
331 &config_generic, "( OLcfgAt:35 NAME 'olcPasswordCryptSaltFormat' "
332 "SYNTAX OMsDirectoryString )", NULL, NULL },
333 { "password-hash", "hash", 2, 2, 0, ARG_MAGIC,
334 &config_passwd_hash, "( OLcfgAt:36 NAME 'olcPasswordHash' "
335 "SYNTAX OMsDirectoryString )", NULL, NULL },
336 { "pidfile", "file", 2, 2, 0, ARG_STRING,
337 &slapd_pid_file, "( OLcfgAt:37 NAME 'olcPidFile' "
338 "SYNTAX OMsDirectoryString )", NULL, NULL },
339 { "plugin", NULL, 0, 0, 0,
341 ARG_MAGIC|CFG_PLUGIN, &config_generic,
345 "( OLcfgAt:38 NAME 'olcPlugin' "
346 "SYNTAX OMsDirectoryString )", NULL, NULL },
347 { "pluginlog", "filename", 2, 2, 0,
349 ARG_STRING, &slapi_log_file,
353 "( OLcfgAt:39 NAME 'olcPluginLogFile' "
354 "SYNTAX OMsDirectoryString )", NULL, NULL },
355 { "readonly", "on|off", 2, 2, 0, ARG_MAY_DB|ARG_ON_OFF|ARG_MAGIC|CFG_RO,
356 &config_generic, "( OLcfgAt:40 NAME 'olcReadOnly' "
357 "SYNTAX OMsBoolean )", NULL, NULL },
358 { "referral", "url", 2, 2, 0, ARG_MAGIC,
359 &config_referral, "( OLcfgAt:41 NAME 'olcReferral' "
360 "SUP labeledURI )", NULL, NULL },
361 { "replica", "host or uri", 2, 0, 0, ARG_DB|ARG_MAGIC,
362 &config_replica, "( OLcfgAt:42 NAME 'olcReplica' "
363 "SUP labeledURI )", NULL, NULL },
364 { "replica-argsfile", NULL, 0, 0, 0, ARG_STRING,
365 &replica_argsFile, "( OLcfgAt:43 NAME 'olcReplicaArgsFile' "
366 "SYNTAX OMsDirectoryString )", NULL, NULL },
367 { "replica-pidfile", NULL, 0, 0, 0, ARG_STRING,
368 &replica_pidFile, "( OLcfgAt:44 NAME 'olcReplicaPidFile' "
369 "SYNTAX OMsDirectoryString )", NULL, NULL },
370 { "replicationInterval", NULL, 0, 0, 0, ARG_INT,
371 &replicationInterval, "( OLcfgAt:45 NAME 'olcReplicationInterval' "
372 "SYNTAX OMsInteger )", NULL, NULL },
373 { "replogfile", "filename", 2, 2, 0, ARG_MAY_DB|ARG_MAGIC|ARG_STRING|CFG_REPLOG,
374 &config_generic, "( OLcfgAt:46 NAME 'olcReplogFile' "
375 "SYNTAX OMsDirectoryString )", NULL, NULL },
376 { "require", "features", 2, 0, 7, ARG_MAY_DB|ARG_MAGIC,
377 &config_requires, "( OLcfgAt:47 NAME 'olcRequires' "
378 "SYNTAX OMsDirectoryString )", NULL, NULL },
379 { "restrict", "op_list", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC,
380 &config_restrict, "( OLcfgAt:48 NAME 'olcRestrict' "
381 "SYNTAX OMsDirectoryString )", NULL, NULL },
382 { "reverse-lookup", "on|off", 2, 2, 0,
383 #ifdef SLAPD_RLOOKUPS
384 ARG_ON_OFF, &use_reverse_lookup,
388 "( OLcfgAt:49 NAME 'olcReverseLookup' "
389 "SYNTAX OMsBoolean )", NULL, NULL },
390 { "rootdn", "dn", 2, 2, 0, ARG_DB|ARG_DN|ARG_MAGIC,
391 &config_rootdn, "( OLcfgAt:50 NAME 'olcRootDN' "
392 "SYNTAX OMsDN )", NULL, NULL },
393 { "rootDSE", "file", 2, 2, 0, ARG_MAGIC|CFG_ROOTDSE,
394 &config_generic, "( OLcfgAt:51 NAME 'olcRootDSE' "
395 "SYNTAX OMsDirectoryString )", NULL, NULL },
396 { "rootpw", "password", 2, 2, 0, ARG_STRING|ARG_DB|ARG_MAGIC,
397 &config_rootpw, "( OLcfgAt:52 NAME 'olcRootPW' "
398 "SYNTAX OMsOctetString )", NULL, NULL },
399 { "sasl-authz-policy", NULL, 2, 2, 0, ARG_MAGIC|CFG_AZPOLICY,
400 &config_generic, NULL, NULL, NULL },
401 { "sasl-host", "host", 2, 2, 0,
402 #ifdef HAVE_CYRUS_SASL
403 ARG_STRING|ARG_UNIQUE, &global_host,
407 "( OLcfgAt:53 NAME 'olcSaslHost' "
408 "SYNTAX OMsDirectoryString )", NULL, NULL },
409 { "sasl-realm", "realm", 2, 2, 0,
410 #ifdef HAVE_CYRUS_SASL
411 ARG_STRING|ARG_UNIQUE, &global_realm,
415 "( OLcfgAt:54 NAME 'olcSaslRealm' "
416 "SYNTAX OMsDirectoryString )", NULL, NULL },
417 { "sasl-regexp", NULL, 3, 3, 0, ARG_MAGIC|CFG_AZREGEXP,
418 &config_generic, NULL, NULL, NULL },
419 { "sasl-secprops", "properties", 2, 2, 0,
420 #ifdef HAVE_CYRUS_SASL
421 ARG_MAGIC|CFG_SASLSECP, &config_generic,
425 "( OLcfgAt:56 NAME 'olcSaslSecProps' "
426 "SYNTAX OMsDirectoryString )", NULL, NULL },
427 { "saslRegexp", NULL, 3, 3, 0, ARG_MAGIC|CFG_AZREGEXP,
428 &config_generic, NULL, NULL, NULL },
429 { "schemacheck", "on|off", 2, 2, 0, ARG_ON_OFF|ARG_MAGIC|CFG_CHECK,
430 &config_generic, "( OLcfgAt:57 NAME 'olcSchemaCheck' "
431 "SYNTAX OMsBoolean )", NULL, NULL },
432 { "schemadn", "dn", 2, 2, 0, ARG_MAY_DB|ARG_DN|ARG_MAGIC,
433 &config_schema_dn, "( OLcfgAt:58 NAME 'olcSchemaDN' "
434 "SYNTAX OMsDN )", NULL, NULL },
435 { "security", "factors", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC,
436 &config_security, "( OLcfgAt:59 NAME 'olcSecurity' "
437 "SYNTAX OMsDirectoryString )", NULL, NULL },
438 { "sizelimit", "limit", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC|CFG_SIZE,
439 &config_sizelimit, "( OLcfgAt:60 NAME 'olcSizeLimit' "
440 "SYNTAX OMsInteger )", NULL, NULL },
441 { "sockbuf_max_incoming", "max", 2, 2, 0, ARG_LONG,
442 &sockbuf_max_incoming, "( OLcfgAt:61 NAME 'olcSockbufMaxIncoming' "
443 "SYNTAX OMsInteger )", NULL, NULL },
444 { "sockbuf_max_incoming_auth", "max", 2, 2, 0, ARG_LONG,
445 &sockbuf_max_incoming_auth, "( OLcfgAt:62 NAME 'olcSockbufMaxIncomingAuth' "
446 "SYNTAX OMsInteger )", NULL, NULL },
447 { "srvtab", "file", 2, 2, 0,
448 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
449 ARG_STRING, &ldap_srvtab,
453 "( OLcfgAt:63 NAME 'olcSrvtab' "
454 "SYNTAX OMsDirectoryString )", NULL, NULL },
455 { "suffix", "suffix", 2, 2, 0, ARG_DB|ARG_DN|ARG_MAGIC,
456 &config_suffix, "( OLcfgAt:64 NAME 'olcSuffix' "
457 "SYNTAX OMsDN )", NULL, NULL },
458 { "syncrepl", NULL, 0, 0, 0, ARG_DB|ARG_MAGIC,
459 &config_syncrepl, "( OLcfgAt:65 NAME 'olcSyncrepl' "
460 "SYNTAX OMsDirectoryString )", NULL, NULL },
461 { "threads", "count", 2, 2, 0, ARG_INT|ARG_MAGIC|CFG_THREADS,
462 &config_generic, "( OLcfgAt:66 NAME 'olcThreads' "
463 "SYNTAX OMsInteger )", NULL, NULL },
464 { "timelimit", "limit", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC|CFG_TIME,
465 &config_timelimit, "( OLcfgAt:67 NAME 'olcTimeLimit' "
466 "SYNTAX OMsInteger )", NULL, NULL },
467 { "TLSCACertificateFile", NULL, 0, 0, 0,
469 CFG_TLS_CA_FILE|ARG_STRING|ARG_MAGIC, &config_tls_option,
473 "( OLcfgAt:68 NAME 'olcTLSCACertificateFile' "
474 "SYNTAX OMsDirectoryString )", NULL, NULL },
475 { "TLSCACertificatePath", NULL, 0, 0, 0,
477 CFG_TLS_CA_PATH|ARG_STRING|ARG_MAGIC, &config_tls_option,
481 "( OLcfgAt:69 NAME 'olcTLSCACertificatePath' "
482 "SYNTAX OMsDirectoryString )", NULL, NULL },
483 { "TLSCertificateFile", NULL, 0, 0, 0,
485 CFG_TLS_CERT_FILE|ARG_STRING|ARG_MAGIC, &config_tls_option,
489 "( OLcfgAt:70 NAME 'olcTLSCertificateFile' "
490 "SYNTAX OMsDirectoryString )", NULL, NULL },
491 { "TLSCertificateKeyFile", NULL, 0, 0, 0,
493 CFG_TLS_CERT_KEY|ARG_STRING|ARG_MAGIC, &config_tls_option,
497 "( OLcfgAt:71 NAME 'olcTLSCertificateKeyFile' "
498 "SYNTAX OMsDirectoryString )", NULL, NULL },
499 { "TLSCipherSuite", NULL, 0, 0, 0,
501 CFG_TLS_CIPHER|ARG_STRING|ARG_MAGIC, &config_tls_option,
505 "( OLcfgAt:72 NAME 'olcTLSCipherSuite' "
506 "SYNTAX OMsDirectoryString )", NULL, NULL },
507 { "TLSCRLCheck", NULL, 0, 0, 0,
509 CFG_TLS_CRLCHECK|ARG_STRING|ARG_MAGIC, &config_tls_config,
513 "( OLcfgAt:73 NAME 'olcTLSCRLCheck' "
514 "SYNTAX OMsDirectoryString )", NULL, NULL },
515 { "TLSRandFile", NULL, 0, 0, 0,
517 CFG_TLS_RAND|ARG_STRING|ARG_MAGIC, &config_tls_option,
521 "( OLcfgAt:74 NAME 'olcTLSRandFile' "
522 "SYNTAX OMsDirectoryString )", NULL, NULL },
523 { "TLSVerifyClient", NULL, 0, 0, 0,
525 CFG_TLS_VERIFY|ARG_STRING|ARG_MAGIC, &config_tls_config,
529 "( OLcfgAt:75 NAME 'olcTLSVerifyClient' "
530 "SYNTAX OMsDirectoryString )", NULL, NULL },
531 { "ucdata-path", "path", 2, 2, 0, ARG_IGNORED,
532 NULL, NULL, NULL, NULL },
533 { "updatedn", "dn", 2, 2, 0, ARG_DB|ARG_MAGIC,
534 &config_updatedn, "( OLcfgAt:76 NAME 'olcUpdateDN' "
535 "SYNTAX OMsDN )", NULL, NULL },
536 { "updateref", "url", 2, 2, 0, ARG_DB|ARG_MAGIC,
537 &config_updateref, "( OLcfgAt:77 NAME 'olcUpdateRef' "
538 "SUP labeledURI )", NULL, NULL },
539 { NULL, NULL, 0, 0, 0, ARG_IGNORED,
540 NULL, NULL, NULL, NULL }
543 static ConfigOCs cf_ocs[] = {
546 "DESC 'OpenLDAP configuration object' "
548 "MAY ( cn $ olcConfigFile ) )", NULL },
551 "DESC 'OpenLDAP Global configuration options' "
552 "SUP olcConfig STRUCTURAL "
553 "MAY ( olcAccess $ olcAllows $ olcArgsFile $ olcAttributeOptions $ "
554 "olcAuthIDRewrite $ olcAuthzPolicy $ olcAuthzRegexp $ "
555 "olcConcurrency $ olcConnMaxPending $ olcConnMaxPendingAuth $ "
556 "olcDefaultSearchBase $ olcDisallows $ olcGentleHUP $ "
557 "olcIdleTimeout $ olcIndexSubstrIfMaxLen $ olcIndexSubstrIfMinLen $ "
558 "olcIndexSubstrAnyLen $ olcIndexSubstrAnyStep $ olcLocalSSF $ "
559 "olcLogLevel $ olcModuleLoad $ olcModulePath $ olcObjectIdentifier $ "
560 "olcPasswordCryptSaltFormat $ olcPasswordHash $ olcPidFile $ "
561 "olcPlugin $ olcPluginLogFile $ olcReadOnly $ olcReferral $ "
562 "olcReplicaPidFile $ olcReplicaArgsFile $ olcReplicationInterval $ "
563 "olcReplogFile $ olcRequires $ olcRestrict $ olcReverseLookup $ "
564 "olcRootDSE $ olcSaslHost $ olcSaslRealm $ olcSaslSecProps $ "
565 "olcSchemaCheck $ olcSchemaDN $ olcSecurity $ olcSizeLimit $ "
566 "olcSockbufMaxIncoming $ olcSockbufMaxIncomingAuth $ olcSrvtab $ "
567 "olcThreads $ olcTimeLimit $ olcTLSCACertificateFile $ "
568 "olcTLSCACertificatePath $ olcTLSCertificateFile $ "
569 "olcTLSCertificateKeyFile $ olcTLSCipherSuite $ olcTLSCRLCheck $ "
570 "olcTLSRandFile $ olcTLSVerifyClient ) )", &cfOc_global },
572 "NAME 'olcBackendConfig' "
573 "DESC 'OpenLDAP Backend-specific options' "
574 "SUP olcConfig STRUCTURAL "
575 "MAY ( olcBackend ) )", &cfOc_backend },
577 "NAME 'olcDatabaseConfig' "
578 "DESC 'OpenLDAP Database-specific options' "
579 "SUP olcConfig STRUCTURAL "
580 "MAY ( olcAccess $ olcDatabase $ olcLastMod $ olcLimits $ "
581 "olcMaxDerefDepth $ olcPlugin $ olcReadOnly $ olcReplica $ "
582 "olcReplogFile $ olcRequires $ olcRestrict $ olcRootDN $ olcRootPW $ "
583 "olcSchemaDN $ olcSecurity $ olcSizeLimit $ olcSuffix $ olcSyncrepl $ "
584 "olcTimeLimit $ olcUpdateDN $ olcUpdateRef ) )", &cfOc_database },
586 "NAME 'olcIncludeFile' "
587 "DESC 'OpenLDAP configuration include file' "
588 "SUP olcConfig STRUCTURAL "
589 "MAY ( olcInclude $ olcModuleLoad $ olcModulePath $ olcRootDSE ) )",
592 "NAME 'olcOverlayConfig' "
593 "DESC 'OpenLDAP Overlay-specific options' "
594 "SUP olcConfig STRUCTURAL "
595 "MAY ( olcOverlay ) )", &cfOc_overlay },
600 config_generic(ConfigArgs *c) {
608 c->value_int = ldap_pvt_thread_get_concurrency();
611 c->value_int = connection_pool_max;
615 c->value_string = ch_strdup( passwd_salt );
620 if ( c->be->be_limits ) {
625 for ( i=0; c->be->be_limits[i]; i++ ) {
626 bv.bv_len = sprintf( buf, "{%d}", i );
627 bv.bv_val = buf+bv.bv_len;
628 limits_unparse( c->be->be_limits[i], &bv );
629 bv.bv_len += bv.bv_val - buf;
631 value_add_one( &c->rvalue_vals, &bv );
634 if ( !c->rvalue_vals ) rc = 1;
637 c->value_int = (c->be->be_restrictops & SLAP_RESTRICT_OP_WRITES) != 0;
640 c->value_string = ch_strdup( slap_sasl_getpolicy());
643 slap_sasl_regexp_unparse( &c->rvalue_vals );
644 if ( !c->rvalue_vals ) rc = 1;
646 #ifdef HAVE_CYRUS_SASL
648 struct berval bv = BER_BVNULL;
649 slap_sasl_secprops_unparse( &bv );
650 if ( !BER_BVISNULL( &bv )) {
651 ber_bvarray_add( &c->rvalue_vals, &bv );
659 c->value_int = c->be->be_max_deref_depth;
662 oidm_unparse( &c->rvalue_vals );
663 if ( !c->rvalue_vals )
667 c->value_int = global_schemacheck;
671 char *src, *dst, ibuf[11];
672 struct berval bv, abv;
673 for (i=0, a=c->be->be_acl; a; i++,a=a->acl_next) {
674 abv.bv_len = sprintf( ibuf, "{%x}", i );
675 acl_unparse( a, &bv );
676 abv.bv_val = ch_malloc( abv.bv_len + bv.bv_len + 1 );
677 AC_MEMCPY( abv.bv_val, ibuf, abv.bv_len );
678 /* Turn TAB / EOL into plain space */
679 for (src=bv.bv_val,dst=abv.bv_val+abv.bv_len; *src; src++) {
680 if (isspace(*src)) *dst++ = ' ';
684 if (dst[-1] == ' ') {
688 abv.bv_len = dst - abv.bv_val;
689 ber_bvarray_add( &c->rvalue_vals, &abv );
695 if ( c->be->be_replogfile )
696 c->value_string = ch_strdup( c->be->be_replogfile );
699 ConfigFile *cf = (ConfigFile *)c->line;
700 if ( cf->c_dseFiles ) {
701 value_add( &c->rvalue_vals, cf->c_dseFiles );
709 c->value_string = ch_strdup( logfileName );
714 c->value_int = (SLAP_NOLASTMOD(c->be) == 0);
716 case CFG_SSTR_IF_MAX:
717 c->value_int = index_substr_if_maxlen;
719 case CFG_SSTR_IF_MIN:
720 c->value_int = index_substr_if_minlen;
724 ConfigFile *cf = (ConfigFile *)c->line;
726 for (i=0, mp=&cf->c_modpaths; mp; mp=mp->mp_next, i++) {
728 if (!mp->mp_loads) continue;
729 for (j=0; !BER_BVISNULL(&mp->mp_loads[j]); j++) {
732 bv.bv_len = sprintf( bv.bv_val, "{%d}{%d}%s", i, j,
733 mp->mp_loads[j].bv_val );
734 value_add_one( &c->rvalue_vals, &bv );
737 rc = c->rvalue_vals ? 0 : 1;
741 ConfigFile *cf = (ConfigFile *)c->line;
743 for (i=0, mp=&cf->c_modpaths; mp; mp=mp->mp_next, i++) {
745 if ( BER_BVISNULL( &mp->mp_path ) && !mp->mp_loads )
748 bv.bv_len = sprintf( bv.bv_val, "{%d}%s", i,
749 mp->mp_path.bv_val );
750 value_add_one( &c->rvalue_vals, &bv );
752 rc = c->rvalue_vals ? 0 : 1;
758 slapi_int_plugin_unparse( c->be, &c->rvalue_vals );
759 if ( !c->rvalue_vals ) rc = 1;
762 #ifdef SLAP_AUTH_REWRITE
764 if ( authz_rewrites ) {
765 struct berval bv, idx;
770 for ( i=0; !BER_BVISNULL( &authz_rewrites[i] ); i++ ) {
771 idx.bv_len = sprintf( idx.bv_val, "{%d}", i );
772 bv.bv_len = idx.bv_len + authz_rewrites[i].bv_len;
773 bv.bv_val = ch_malloc( bv.bv_len + 1 );
774 strcpy( bv.bv_val, idx.bv_val );
775 strcpy( bv.bv_val+idx.bv_len, authz_rewrites[i].bv_val );
776 ber_bvarray_add( &c->rvalue_vals, &bv );
779 if ( !c->rvalue_vals ) rc = 1;
788 p = strchr(c->line,'(' /*')'*/);
791 if(!(c->bi = backend_info(c->argv[1]))) {
792 Debug(LDAP_DEBUG_ANY, "%s: "
793 "backend %s failed init!\n", c->log, c->argv[1], 0);
800 /* NOTE: config is always the first backend!
802 if ( !strcasecmp( c->argv[1], "config" )) {
804 } else if(!(c->be = backend_db_init(c->argv[1]))) {
805 Debug(LDAP_DEBUG_ANY, "%s: "
806 "database %s failed init!\n", c->log, c->argv[1], 0);
812 ldap_pvt_thread_set_concurrency(c->value_int);
816 ldap_pvt_thread_pool_maxthreads(&connection_pool, c->value_int);
817 connection_pool_max = c->value_int; /* save for reference */
821 if ( passwd_salt ) ch_free( passwd_salt );
822 passwd_salt = c->value_string;
823 lutil_salt_format(passwd_salt);
827 if(limits_parse(c->be, c->fname, c->lineno, c->argc, c->argv))
833 c->be->be_restrictops |= SLAP_RESTRICT_OP_WRITES;
835 c->be->be_restrictops &= ~SLAP_RESTRICT_OP_WRITES;
839 ch_free(c->value_string);
840 if (slap_sasl_setpolicy( c->argv[1] )) {
841 Debug(LDAP_DEBUG_ANY, "%s: unable to parse value \"%s\" in"
842 " \"authz-policy <policy>\"\n",
843 c->log, c->argv[1], 0 );
849 if (slap_sasl_regexp_config( c->argv[1], c->argv[2] ))
853 #ifdef HAVE_CYRUS_SASL
856 char *txt = slap_sasl_secprops( c->argv[1] );
858 Debug(LDAP_DEBUG_ANY, "%s: sasl-secprops: %s\n",
867 c->be->be_max_deref_depth = c->value_int;
871 if(parse_oidm(c->fname, c->lineno, c->argc, c->argv)) return(1);
875 if(parse_oc(c->fname, c->lineno, p, c->argv)) return(1);
879 if(parse_cr(c->fname, c->lineno, p, c->argv)) return(1);
883 if(parse_at(c->fname, c->lineno, p, c->argv)) return(1);
887 ad_define_option(NULL, NULL, 0);
888 for(i = 1; i < c->argc; i++)
889 if(ad_define_option(c->argv[i], c->fname, c->lineno))
894 global_schemacheck = c->value_int;
895 if(!global_schemacheck) Debug(LDAP_DEBUG_ANY, "%s: "
896 "schema checking disabled! your mileage may vary!\n",
901 parse_acl(c->be, c->fname, c->lineno, c->argc, c->argv);
905 if(SLAP_MONITOR(c->be)) {
906 Debug(LDAP_DEBUG_ANY, "%s: "
907 "\"replogfile\" should not be used "
908 "inside monitor database\n",
910 return(0); /* FIXME: should this be an error? */
913 c->be->be_replogfile = c->value_string;
917 if(read_root_dse_file(c->argv[1])) {
918 Debug(LDAP_DEBUG_ANY, "%s: "
919 "could not read \"rootDSE <filename>\" line\n",
925 ber_str2bv( c->argv[1], 0, 1, &bv );
926 ber_bvarray_add( &cfn->c_dseFiles, &bv );
932 if ( logfileName ) ch_free( logfileName );
933 logfileName = c->value_string;
934 logfile = fopen(logfileName, "w");
935 if(logfile) lutil_debug_file(logfile);
939 if(SLAP_NOLASTMODCMD(c->be)) {
940 Debug(LDAP_DEBUG_ANY, "%s: "
941 "lastmod not available for %s databases\n",
942 c->log, c->be->bd_info->bi_type, 0);
946 SLAP_DBFLAGS(c->be) &= ~SLAP_DBFLAG_NOLASTMOD;
948 SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_NOLASTMOD;
951 case CFG_SSTR_IF_MAX:
952 if (c->value_int < index_substr_if_minlen) {
953 Debug(LDAP_DEBUG_ANY, "%s: "
954 "invalid max value (%d)\n",
955 c->log, c->value_int, 0 );
958 index_substr_if_maxlen = c->value_int;
961 case CFG_SSTR_IF_MIN:
962 if (c->value_int > index_substr_if_maxlen) {
963 Debug(LDAP_DEBUG_ANY, "%s: "
964 "invalid min value (%d)\n",
965 c->log, c->value_int, 0 );
968 index_substr_if_minlen = c->value_int;
973 if(module_load(c->argv[1], c->argc - 2, (c->argc > 2) ? c->argv + 2 : NULL))
975 /* Record this load on the current path */
978 ber_str2bv(c->line, 0, 1, &bv);
979 ber_bvarray_add( &cfn->c_modlast->mp_loads, &bv );
984 if(module_path(c->argv[1])) return(1);
985 /* Record which path was used with each module */
989 if (!cfn->c_modpaths.mp_loads) {
990 mp = &cfn->c_modpaths;
992 mp = ch_malloc( sizeof( ModPaths ));
993 cfn->c_modlast->mp_next = mp;
995 ber_str2bv(c->argv[1], 0, 1, &mp->mp_path);
1006 if(slapi_int_read_config(c->be, c->fname, c->lineno, c->argc, c->argv) != LDAP_SUCCESS)
1008 slapi_plugins_used++;
1012 #ifdef SLAP_AUTH_REWRITE
1015 if(slap_sasl_rewrite_config(c->fname, c->lineno, c->argc, c->argv))
1017 ber_str2bv( c->line, 0, 1, &bv );
1018 ber_bvarray_add( &authz_rewrites, &bv );
1025 Debug(LDAP_DEBUG_ANY, "%s: unknown CFG_TYPE %d"
1026 "(ignored)\n", c->log, c->type, 0);
1034 config_fname(ConfigArgs *c) {
1035 if(c->emit && c->line) {
1036 ConfigFile *cf = (ConfigFile *)c->line;
1037 value_add_one( &c->rvalue_vals, &cf->c_file );
1044 config_search_base(ConfigArgs *c) {
1049 if (!BER_BVISEMPTY(&default_search_base)) {
1050 value_add_one(&c->rvalue_vals, &default_search_base);
1051 value_add_one(&c->rvalue_nvals, &default_search_nbase);
1057 if(c->bi || c->be != frontendDB) {
1058 Debug(LDAP_DEBUG_ANY, "%s: defaultSearchBase line must appear "
1059 "prior to any backend or database definition\n",
1064 if(default_search_nbase.bv_len) {
1065 Debug(LDAP_DEBUG_ANY, "%s: "
1066 "default search base \"%s\" already defined "
1067 "(discarding old)\n",
1068 c->log, default_search_base.bv_val, 0);
1069 free(default_search_base.bv_val);
1070 free(default_search_nbase.bv_val);
1073 default_search_base = c->value_dn;
1074 default_search_nbase = c->value_ndn;
1079 config_passwd_hash(ConfigArgs *c) {
1083 for (i=0; default_passwd_hash && default_passwd_hash[i]; i++) {
1084 ber_str2bv(default_passwd_hash[i], 0, 0, &bv);
1085 value_add_one(&c->rvalue_vals, &bv);
1089 if(default_passwd_hash) {
1090 Debug(LDAP_DEBUG_ANY, "%s: "
1091 "already set default password_hash\n",
1095 for(i = 1; i < c->argc; i++) {
1096 if(!lutil_passwd_scheme(c->argv[i])) {
1097 Debug(LDAP_DEBUG_ANY, "%s: "
1098 "password scheme \"%s\" not available\n",
1099 c->log, c->argv[i], 0);
1101 ldap_charray_add(&default_passwd_hash, c->argv[i]);
1103 if(!default_passwd_hash) {
1104 Debug(LDAP_DEBUG_ANY, "%s: no valid hashes found\n",
1113 config_schema_dn(ConfigArgs *c) {
1117 value_add_one(&c->rvalue_vals, &c->be->be_schemadn);
1118 value_add_one(&c->rvalue_nvals, &c->be->be_schemandn);
1121 c->be->be_schemadn = c->value_dn;
1122 c->be->be_schemandn = c->value_ndn;
1127 config_sizelimit(ConfigArgs *c) {
1130 struct slap_limits_set *lim = &c->be->be_def_limit;
1136 limits_unparse_one( lim, SLAP_LIMIT_SIZE, &bv );
1137 if ( !BER_BVISEMPTY( &bv ))
1138 value_add_one( &c->rvalue_vals, &bv );
1143 for(i = 1; i < c->argc; i++) {
1144 if(!strncasecmp(c->argv[i], "size", 4)) {
1145 rc = limits_parse_one(c->argv[i], lim);
1147 Debug(LDAP_DEBUG_ANY, "%s: "
1148 "unable to parse value \"%s\" in \"sizelimit <limit>\" line\n",
1149 c->log, c->argv[i], 0);
1153 if(!strcasecmp(c->argv[i], "unlimited")) {
1154 lim->lms_s_soft = -1;
1156 lim->lms_s_soft = strtol(c->argv[i], &next, 0);
1157 if(next == c->argv[i]) {
1158 Debug(LDAP_DEBUG_ANY, "%s: "
1159 "unable to parse limit \"%s\" in \"sizelimit <limit>\" line\n",
1160 c->log, c->argv[i], 0);
1162 } else if(next[0] != '\0') {
1163 Debug(LDAP_DEBUG_ANY, "%s: "
1164 "trailing chars \"%s\" in \"sizelimit <limit>\" line (ignored)\n",
1168 lim->lms_s_hard = 0;
1175 config_timelimit(ConfigArgs *c) {
1178 struct slap_limits_set *lim = &c->be->be_def_limit;
1184 limits_unparse_one( lim, SLAP_LIMIT_TIME, &bv );
1185 if ( !BER_BVISEMPTY( &bv ))
1186 value_add_one( &c->rvalue_vals, &bv );
1191 for(i = 1; i < c->argc; i++) {
1192 if(!strncasecmp(c->argv[i], "time", 4)) {
1193 rc = limits_parse_one(c->argv[i], lim);
1195 Debug(LDAP_DEBUG_ANY, "%s: "
1196 "unable to parse value \"%s\" in \"timelimit <limit>\" line\n",
1197 c->log, c->argv[i], 0);
1201 if(!strcasecmp(c->argv[i], "unlimited")) {
1202 lim->lms_t_soft = -1;
1204 lim->lms_t_soft = strtol(c->argv[i], &next, 0);
1205 if(next == c->argv[i]) {
1206 Debug(LDAP_DEBUG_ANY, "%s: "
1207 "unable to parse limit \"%s\" in \"timelimit <limit>\" line\n",
1208 c->log, c->argv[i], 0);
1210 } else if(next[0] != '\0') {
1211 Debug(LDAP_DEBUG_ANY, "%s: "
1212 "trailing chars \"%s\" in \"timelimit <limit>\" line (ignored)\n",
1216 lim->lms_t_hard = 0;
1223 config_overlay(ConfigArgs *c) {
1227 if(c->argv[1][0] == '-' && overlay_config(c->be, &c->argv[1][1])) {
1229 Debug(LDAP_DEBUG_ANY, "%s: (optional) %s overlay \"%s\" configuration failed (ignored)\n",
1230 c->log, c->be == frontendDB ? "global " : "", c->argv[1][1]);
1231 } else if(overlay_config(c->be, c->argv[1])) {
1238 config_suffix(ConfigArgs *c) {
1240 struct berval pdn, ndn;
1243 if ( !BER_BVISNULL( &c->be->be_suffix[0] )) {
1244 value_add( &c->rvalue_vals, c->be->be_suffix );
1245 value_add( &c->rvalue_nvals, c->be->be_nsuffix );
1251 #ifdef SLAPD_MONITOR_DN
1252 if(!strcasecmp(c->argv[1], SLAPD_MONITOR_DN)) {
1253 Debug(LDAP_DEBUG_ANY, "%s: "
1254 "\"%s\" is reserved for monitoring slapd\n",
1255 c->log, SLAPD_MONITOR_DN, 0);
1262 tbe = select_backend(&ndn, 0, 0);
1264 Debug(LDAP_DEBUG_ANY, "%s: suffix already served by this backend! (ignored)\n",
1269 Debug(LDAP_DEBUG_ANY, "%s: suffix already served by a preceding backend \"%s\"\n",
1270 c->log, tbe->be_suffix[0].bv_val, 0);
1274 } else if(pdn.bv_len == 0 && default_search_nbase.bv_len) {
1275 Debug(LDAP_DEBUG_ANY, "%s: suffix DN empty and default search "
1276 "base provided \"%s\" (assuming okay)\n",
1277 c->log, default_search_base.bv_val, 0);
1279 ber_bvarray_add(&c->be->be_suffix, &pdn);
1280 ber_bvarray_add(&c->be->be_nsuffix, &ndn);
1285 config_rootdn(ConfigArgs *c) {
1287 if ( !BER_BVISNULL( &c->be->be_rootdn )) {
1288 value_add_one(&c->rvalue_vals, &c->be->be_rootdn);
1289 value_add_one(&c->rvalue_nvals, &c->be->be_rootndn);
1295 c->be->be_rootdn = c->value_dn;
1296 c->be->be_rootndn = c->value_ndn;
1301 config_rootpw(ConfigArgs *c) {
1304 if (!BER_BVISEMPTY(&c->be->be_rootpw)) {
1305 c->value_string=ch_strdup("*");
1311 tbe = select_backend(&c->be->be_rootndn, 0, 0);
1313 Debug(LDAP_DEBUG_ANY, "%s: "
1314 "rootpw can only be set when rootdn is under suffix\n",
1318 ber_str2bv(c->value_string, 0, 0, &c->be->be_rootpw);
1323 config_restrict(ConfigArgs *c) {
1324 slap_mask_t restrictops = 0;
1326 struct verb_mask_list restrictable_ops[] = {
1327 { "bind", SLAP_RESTRICT_OP_BIND },
1328 { "add", SLAP_RESTRICT_OP_ADD },
1329 { "modify", SLAP_RESTRICT_OP_MODIFY },
1330 { "rename", SLAP_RESTRICT_OP_RENAME },
1332 { "delete", SLAP_RESTRICT_OP_DELETE },
1333 { "search", SLAP_RESTRICT_OP_SEARCH },
1334 { "compare", SLAP_RESTRICT_OP_COMPARE },
1335 { "read", SLAP_RESTRICT_OP_READS },
1336 { "write", SLAP_RESTRICT_OP_WRITES },
1337 { "extended", SLAP_RESTRICT_OP_EXTENDED },
1338 { "extended=" LDAP_EXOP_START_TLS, SLAP_RESTRICT_EXOP_START_TLS },
1339 { "extended=" LDAP_EXOP_MODIFY_PASSWD, SLAP_RESTRICT_EXOP_MODIFY_PASSWD },
1340 { "extended=" LDAP_EXOP_X_WHO_AM_I, SLAP_RESTRICT_EXOP_WHOAMI },
1341 { "extended=" LDAP_EXOP_X_CANCEL, SLAP_RESTRICT_EXOP_CANCEL },
1346 return mask_to_verbs( c, restrictable_ops, c->be->be_restrictops );
1348 i = verbs_to_mask( c, restrictable_ops, &restrictops );
1350 Debug(LDAP_DEBUG_ANY, "%s: "
1351 "unknown operation %s in \"restrict <features>\" line\n",
1352 c->log, c->argv[i], 0);
1355 if ( restrictops & SLAP_RESTRICT_OP_EXTENDED )
1356 restrictops &= ~SLAP_RESTRICT_EXOP_MASK;
1357 c->be->be_restrictops |= restrictops;
1362 config_allows(ConfigArgs *c) {
1363 slap_mask_t allows = 0;
1365 struct verb_mask_list allowable_ops[] = {
1366 { "bind_v2", SLAP_ALLOW_BIND_V2 },
1367 { "bind_anon_cred", SLAP_ALLOW_BIND_ANON_CRED },
1368 { "bind_anon_dn", SLAP_ALLOW_BIND_ANON_DN },
1369 { "update_anon", SLAP_ALLOW_UPDATE_ANON },
1373 return mask_to_verbs( c, allowable_ops, global_allows );
1375 i = verbs_to_mask(c, allowable_ops, &allows);
1377 Debug(LDAP_DEBUG_ANY, "%s: "
1378 "unknown feature %s in \"allow <features>\" line\n",
1379 c->log, c->argv[i], 0);
1382 global_allows |= allows;
1387 config_disallows(ConfigArgs *c) {
1388 slap_mask_t disallows = 0;
1390 struct verb_mask_list disallowable_ops[] = {
1391 { "bind_anon", SLAP_DISALLOW_BIND_ANON },
1392 { "bind_simple", SLAP_DISALLOW_BIND_SIMPLE },
1393 { "bind_krb4", SLAP_DISALLOW_BIND_KRBV4 },
1394 { "tls_2_anon", SLAP_DISALLOW_TLS_2_ANON },
1395 { "tls_authc", SLAP_DISALLOW_TLS_AUTHC },
1399 return mask_to_verbs( c, disallowable_ops, global_disallows );
1401 i = verbs_to_mask(c, disallowable_ops, &disallows);
1403 Debug(LDAP_DEBUG_ANY, "%s: "
1404 "unknown feature %s in \"disallow <features>\" line\n",
1405 c->log, c->argv[i], 0);
1408 global_disallows |= disallows;
1413 config_requires(ConfigArgs *c) {
1414 slap_mask_t requires = 0;
1416 struct verb_mask_list requires_ops[] = {
1417 { "bind", SLAP_REQUIRE_BIND },
1418 { "LDAPv3", SLAP_REQUIRE_LDAP_V3 },
1419 { "authc", SLAP_REQUIRE_AUTHC },
1420 { "sasl", SLAP_REQUIRE_SASL },
1421 { "strong", SLAP_REQUIRE_STRONG },
1425 return mask_to_verbs( c, requires_ops, c->be->be_requires );
1427 i = verbs_to_mask(c, requires_ops, &requires);
1429 Debug(LDAP_DEBUG_ANY, "%s: "
1430 "unknown feature %s in \"require <features>\" line\n",
1431 c->log, c->argv[i], 0);
1434 c->be->be_requires = requires;
1439 config_loglevel(ConfigArgs *c) {
1442 struct verb_mask_list loglevel_ops[] = {
1443 { "Trace", LDAP_DEBUG_TRACE },
1444 { "Packets", LDAP_DEBUG_PACKETS },
1445 { "Args", LDAP_DEBUG_ARGS },
1446 { "Conns", LDAP_DEBUG_CONNS },
1447 { "BER", LDAP_DEBUG_BER },
1448 { "Filter", LDAP_DEBUG_FILTER },
1449 { "Config", LDAP_DEBUG_CONFIG },
1450 { "ACL", LDAP_DEBUG_ACL },
1451 { "Stats", LDAP_DEBUG_STATS },
1452 { "Stats2", LDAP_DEBUG_STATS2 },
1453 { "Shell", LDAP_DEBUG_SHELL },
1454 { "Parse", LDAP_DEBUG_PARSE },
1455 { "Cache", LDAP_DEBUG_CACHE },
1456 { "Index", LDAP_DEBUG_INDEX },
1462 return mask_to_verbs( c, loglevel_ops, ldap_syslog );
1467 for( i=1; i < c->argc; i++ ) {
1470 if ( isdigit( c->argv[i][0] ) ) {
1471 level = strtol( c->argv[i], &next, 10 );
1472 if ( next == NULL || next[0] != '\0' ) {
1473 Debug( LDAP_DEBUG_ANY,
1474 "%s: unable to parse level \"%s\" "
1475 "in \"loglevel <level> [...]\" line.\n",
1476 c->log, c->argv[i], 0);
1480 int j = verb_to_mask(c, loglevel_ops, c->argv[i][0]);
1481 if(!loglevel_ops[j].word) {
1482 Debug( LDAP_DEBUG_ANY,
1483 "%s: unknown level \"%s\" "
1484 "in \"loglevel <level> [...]\" line.\n",
1485 c->log, c->argv[i], 0);
1488 level = loglevel_ops[j].mask;
1490 ldap_syslog |= level;
1496 config_syncrepl(ConfigArgs *c) {
1498 if ( c->be->be_syncinfo ) {
1500 syncrepl_unparse( c->be->be_syncinfo, &bv );
1501 ber_bvarray_add( &c->rvalue_vals, &bv );
1506 if(SLAP_SHADOW(c->be)) {
1507 Debug(LDAP_DEBUG_ANY, "%s: "
1508 "syncrepl: database already shadowed.\n",
1511 } else if(add_syncrepl(c->be, c->argv, c->argc)) {
1514 SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SYNC_SHADOW);
1519 config_referral(ConfigArgs *c) {
1520 struct berval vals[2];
1522 if ( default_referral ) {
1523 value_add( &c->rvalue_vals, default_referral );
1529 if(validate_global_referral(c->argv[1])) {
1530 Debug(LDAP_DEBUG_ANY, "%s: "
1531 "invalid URL (%s) in \"referral\" line.\n",
1532 c->log, c->argv[1], 0);
1536 ber_str2bv(c->argv[1], 0, 0, &vals[0]);
1537 vals[1].bv_val = NULL; vals[1].bv_len = 0;
1538 if(value_add(&default_referral, vals)) return(LDAP_OTHER);
1546 { BER_BVC("ssf="), offsetof(slap_ssf_set_t, sss_ssf) },
1547 { BER_BVC("transport="), offsetof(slap_ssf_set_t, sss_transport) },
1548 { BER_BVC("tls="), offsetof(slap_ssf_set_t, sss_tls) },
1549 { BER_BVC("sasl="), offsetof(slap_ssf_set_t, sss_sasl) },
1550 { BER_BVC("update_ssf="), offsetof(slap_ssf_set_t, sss_update_ssf) },
1551 { BER_BVC("update_transport="), offsetof(slap_ssf_set_t, sss_update_transport) },
1552 { BER_BVC("update_tls="), offsetof(slap_ssf_set_t, sss_update_tls) },
1553 { BER_BVC("update_sasl="), offsetof(slap_ssf_set_t, sss_update_sasl) },
1554 { BER_BVC("simple_bind="), offsetof(slap_ssf_set_t, sss_simple_bind) },
1559 config_security(ConfigArgs *c) {
1560 slap_ssf_set_t *set = &c->be->be_ssf_set;
1569 for (i=0; !BER_BVISNULL( &sec_keys[i].key ); i++) {
1570 tgt = (slap_ssf_t *)((char *)set + sec_keys[i].off);
1573 bv.bv_len = sprintf( numbuf, "%u", *tgt );
1574 bv.bv_len += sec_keys[i].key.bv_len;
1575 bv.bv_val = ch_malloc( bv.bv_len + 1);
1576 next = lutil_strcopy( bv.bv_val, sec_keys[i].key.bv_val );
1577 strcpy( next, numbuf );
1578 ber_bvarray_add( &c->rvalue_vals, &bv );
1583 for(i = 1; i < c->argc; i++) {
1584 slap_ssf_t *tgt = NULL;
1586 for ( j=0; !BER_BVISNULL( &sec_keys[j].key ); j++ ) {
1587 if(!strncasecmp(c->argv[i], sec_keys[j].key.bv_val,
1588 sec_keys[j].key.bv_len)) {
1589 src = c->argv[i] + sec_keys[j].key.bv_len;
1590 tgt = (slap_ssf_t *)((char *)set + sec_keys[j].off);
1595 Debug(LDAP_DEBUG_ANY, "%s: "
1596 "unknown factor %s in \"security <factors>\" line\n",
1597 c->log, c->argv[i], 0);
1601 *tgt = strtol(src, &next, 10);
1602 if(next == NULL || next[0] != '\0' ) {
1603 Debug(LDAP_DEBUG_ANY, "%s: "
1604 "unable to parse factor \"%s\" in \"security <factors>\" line\n",
1605 c->log, c->argv[i], 0);
1613 anlist_unparse( AttributeName *an, char *ptr ) {
1616 for (; !BER_BVISNULL( &an->an_name ); an++) {
1617 if ( comma ) *ptr++ = ',';
1618 ptr = lutil_strcopy( ptr, an->an_name.bv_val );
1625 replica_unparse( struct slap_replica_info *ri, int i, struct berval *bv )
1629 struct berval bc = {0};
1632 len = sprintf(numbuf, "{%d}", i );
1634 len += strlen( ri->ri_uri ) + STRLENOF("uri=");
1635 if ( ri->ri_nsuffix ) {
1636 for (i=0; !BER_BVISNULL( &ri->ri_nsuffix[i] ); i++) {
1637 len += ri->ri_nsuffix[i].bv_len + STRLENOF(" suffix=\"\"");
1640 if ( ri->ri_attrs ) {
1641 len += STRLENOF("attr");
1642 if ( ri->ri_exclude ) len++;
1643 for (i=0; !BER_BVISNULL( &ri->ri_attrs[i].an_name ); i++) {
1644 len += 1 + ri->ri_attrs[i].an_name.bv_len;
1647 bindconf_unparse( &ri->ri_bindconf, &bc );
1650 bv->bv_val = ch_malloc(len + 1);
1653 ptr = lutil_strcopy( bv->bv_val, numbuf );
1654 ptr = lutil_strcopy( ptr, "uri=" );
1655 ptr = lutil_strcopy( ptr, ri->ri_uri );
1657 if ( ri->ri_nsuffix ) {
1658 for (i=0; !BER_BVISNULL( &ri->ri_nsuffix[i] ); i++) {
1659 ptr = lutil_strcopy( ptr, " suffix=\"" );
1660 ptr = lutil_strcopy( ptr, ri->ri_nsuffix[i].bv_val );
1664 if ( ri->ri_attrs ) {
1665 ptr = lutil_strcopy( ptr, "attr" );
1666 if ( ri->ri_exclude ) *ptr++ = '!';
1668 ptr = anlist_unparse( ri->ri_attrs, ptr );
1671 strcpy( ptr, bc.bv_val );
1672 ch_free( bc.bv_val );
1677 config_replica(ConfigArgs *c) {
1678 int i, nr = -1, len;
1679 char *replicahost, *replicauri;
1683 if (c->be->be_replica) {
1685 for (i=0;c->be->be_replica[i]; i++) {
1686 replica_unparse( c->be->be_replica[i], i, &bv );
1687 ber_bvarray_add( &c->rvalue_vals, &bv );
1693 if(SLAP_MONITOR(c->be)) {
1694 Debug(LDAP_DEBUG_ANY, "%s: "
1695 "\"replica\" should not be used inside monitor database\n",
1697 return(0); /* FIXME: should this be an error? */
1700 for(i = 1; i < c->argc; i++) {
1701 if(!strncasecmp(c->argv[i], "host=", STRLENOF("host="))) {
1702 replicahost = c->argv[i] + STRLENOF("host=");
1703 len = strlen( replicahost );
1704 replicauri = ch_malloc( len + STRLENOF("ldap://") + 1 );
1705 sprintf( replicauri, "ldap://%s", replicahost );
1706 replicahost = replicauri + STRLENOF( "ldap://");
1707 nr = add_replica_info(c->be, replicauri, replicahost);
1709 } else if(!strncasecmp(c->argv[i], "uri=", STRLENOF("uri="))) {
1710 if(ldap_url_parse(c->argv[i] + STRLENOF("uri="), &ludp) != LDAP_SUCCESS) {
1711 Debug(LDAP_DEBUG_ANY, "%s: "
1712 "replica line contains invalid "
1713 "uri definition.\n", c->log, 0, 0);
1716 if(!ludp->lud_host) {
1717 Debug(LDAP_DEBUG_ANY, "%s: "
1718 "replica line contains invalid "
1719 "uri definition - missing hostname.\n",
1723 ldap_free_urldesc(ludp);
1724 replicauri = c->argv[i] + STRLENOF("uri=");
1725 replicauri = ch_strdup( replicauri );
1726 replicahost = strchr( replicauri, '/' );
1728 nr = add_replica_info(c->be, replicauri, replicahost);
1733 Debug(LDAP_DEBUG_ANY, "%s: "
1734 "missing host or uri in \"replica\" line\n",
1737 } else if(nr == -1) {
1738 Debug(LDAP_DEBUG_ANY, "%s: "
1739 "unable to add replica \"%s\"\n",
1740 c->log, replicauri, 0);
1743 for(i = 1; i < c->argc; i++) {
1744 if(!strncasecmp(c->argv[i], "suffix=", STRLENOF( "suffix="))) {
1745 switch(add_replica_suffix(c->be, nr, c->argv[i] + STRLENOF("suffix="))) {
1747 Debug(LDAP_DEBUG_ANY, "%s: "
1748 "suffix \"%s\" in \"replica\" line is not valid for backend (ignored)\n",
1749 c->log, c->argv[i] + STRLENOF("suffix="), 0);
1752 Debug(LDAP_DEBUG_ANY, "%s: "
1753 "unable to normalize suffix in \"replica\" line (ignored)\n",
1758 } else if(!strncasecmp(c->argv[i], "attr", STRLENOF("attr"))) {
1760 char *arg = c->argv[i] + STRLENOF("attr");
1768 if(add_replica_attrs(c->be, nr, arg + 1, exclude)) {
1769 Debug(LDAP_DEBUG_ANY, "%s: "
1770 "attribute \"%s\" in \"replica\" line is unknown\n",
1771 c->log, arg + 1, 0);
1774 } else if ( bindconf_parse( c->argv[i],
1775 &c->be->be_replica[nr]->ri_bindconf ) ) {
1784 config_updatedn(ConfigArgs *c) {
1788 if (!BER_BVISEMPTY(&c->be->be_update_ndn)) {
1789 value_add_one(&c->rvalue_vals, &c->be->be_update_ndn);
1790 value_add_one(&c->rvalue_nvals, &c->be->be_update_ndn);
1795 if(SLAP_SHADOW(c->be)) {
1796 Debug(LDAP_DEBUG_ANY, "%s: "
1797 "updatedn: database already shadowed.\n",
1802 ber_str2bv(c->argv[1], 0, 0, &dn);
1804 rc = dnNormalize(0, NULL, NULL, &dn, &c->be->be_update_ndn, NULL);
1806 if(rc != LDAP_SUCCESS) {
1807 Debug(LDAP_DEBUG_ANY, "%s: "
1808 "updatedn DN is invalid: %d (%s)\n",
1809 c->log, rc, ldap_err2string( rc ));
1813 SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | SLAP_DBFLAG_SLURP_SHADOW);
1818 config_updateref(ConfigArgs *c) {
1819 struct berval vals[2];
1821 if ( c->be->be_update_refs ) {
1822 value_add( &c->rvalue_vals, c->be->be_update_refs );
1828 if(!SLAP_SHADOW(c->be)) {
1829 Debug(LDAP_DEBUG_ANY, "%s: "
1830 "updateref line must come after syncrepl or updatedn.\n",
1835 if(validate_global_referral(c->argv[1])) {
1836 Debug(LDAP_DEBUG_ANY, "%s: "
1837 "invalid URL (%s) in \"updateref\" line.\n",
1838 c->log, c->argv[1], 0);
1841 ber_str2bv(c->argv[1], 0, 0, &vals[0]);
1842 vals[1].bv_val = NULL;
1843 if(value_add(&c->be->be_update_refs, vals)) return(LDAP_OTHER);
1848 config_include(ConfigArgs *c) {
1849 unsigned long savelineno = c->lineno;
1852 ConfigFile *cfsave = cfn;
1853 ConfigFile *cf2 = NULL;
1857 cf = ch_calloc( 1, sizeof(ConfigFile));
1858 #ifdef SLAPD_MODULES
1859 cf->c_modlast = &cf->c_modpaths;
1861 if ( cfn->c_kids ) {
1862 for (cf2=cfn->c_kids; cf2 && cf2->c_sibs; cf2=cf2->c_sibs) ;
1868 rc = read_config_file(c->argv[1], c->depth + 1, c);
1869 c->lineno = savelineno - 1;
1872 if ( cf2 ) cf2->c_sibs = NULL;
1873 else cfn->c_kids = NULL;
1876 ber_str2bv( c->argv[1], 0, 1, &cf->c_file );
1883 config_tls_option(ConfigArgs *c) {
1886 case CFG_TLS_RAND: flag = LDAP_OPT_X_TLS_RANDOM_FILE; break;
1887 case CFG_TLS_CIPHER: flag = LDAP_OPT_X_TLS_CIPHER_SUITE; break;
1888 case CFG_TLS_CERT_FILE: flag = LDAP_OPT_X_TLS_CERTFILE; break;
1889 case CFG_TLS_CERT_KEY: flag = LDAP_OPT_X_TLS_KEYFILE; break;
1890 case CFG_TLS_CA_PATH: flag = LDAP_OPT_X_TLS_CACERTDIR; break;
1891 case CFG_TLS_CA_FILE: flag = LDAP_OPT_X_TLS_CACERTFILE; break;
1892 default: Debug(LDAP_DEBUG_ANY, "%s: "
1893 "unknown tls_option <%x>\n",
1894 c->log, c->type, 0);
1897 return ldap_pvt_tls_get_option( NULL, flag, &c->value_string );
1899 ch_free(c->value_string);
1900 return(ldap_pvt_tls_set_option(NULL, flag, c->argv[1]));
1903 /* FIXME: this ought to be provided by libldap */
1905 config_tls_config(ConfigArgs *c) {
1907 struct verb_mask_list crlkeys[] = {
1908 { "none", LDAP_OPT_X_TLS_CRL_NONE },
1909 { "peer", LDAP_OPT_X_TLS_CRL_PEER },
1910 { "all", LDAP_OPT_X_TLS_CRL_ALL },
1913 struct verb_mask_list vfykeys[] = {
1914 { "never", LDAP_OPT_X_TLS_NEVER },
1915 { "demand", LDAP_OPT_X_TLS_DEMAND },
1916 { "try", LDAP_OPT_X_TLS_TRY },
1917 { "hard", LDAP_OPT_X_TLS_HARD },
1921 #ifdef HAVE_OPENSSL_CRL
1922 case CFG_TLS_CRLCHECK: flag = LDAP_OPT_X_TLS_CRLCHECK; keys = crlkeys;
1925 case CFG_TLS_VERIFY: flag = LDAP_OPT_X_TLS_REQUIRE_CERT; keys = vfykeys;
1927 default: Debug(LDAP_DEBUG_ANY, "%s: "
1928 "unknown tls_option <%x>\n",
1929 c->log, c->type, 0);
1932 ldap_pvt_tls_get_option( NULL, flag, &c->value_int );
1933 for (i=0; keys[i].word; i++) {
1934 if (keys[i].mask == c->value_int) {
1935 c->value_string = ch_strdup( keys[i].word );
1941 ch_free( c->value_string );
1942 if(isdigit((unsigned char)c->argv[1][0])) {
1943 i = atoi(c->argv[1]);
1944 return(ldap_pvt_tls_set_option(NULL, flag, &i));
1946 return(ldap_int_tls_config(NULL, flag, c->argv[1]));
1961 si = (syncinfo_t *) ch_calloc( 1, sizeof( syncinfo_t ) );
1964 Debug( LDAP_DEBUG_ANY, "out of memory in add_syncrepl\n", 0, 0, 0 );
1968 si->si_bindconf.sb_tls = SB_TLS_OFF;
1969 si->si_bindconf.sb_method = LDAP_AUTH_SIMPLE;
1970 si->si_schemachecking = 0;
1971 ber_str2bv( "(objectclass=*)", STRLENOF("(objectclass=*)"), 1,
1972 &si->si_filterstr );
1973 si->si_base.bv_val = NULL;
1974 si->si_scope = LDAP_SCOPE_SUBTREE;
1975 si->si_attrsonly = 0;
1976 si->si_anlist = (AttributeName *) ch_calloc( 1, sizeof( AttributeName ));
1977 si->si_exanlist = (AttributeName *) ch_calloc( 1, sizeof( AttributeName ));
1978 si->si_attrs = NULL;
1979 si->si_allattrs = 0;
1980 si->si_allopattrs = 0;
1981 si->si_exattrs = NULL;
1982 si->si_type = LDAP_SYNC_REFRESH_ONLY;
1983 si->si_interval = 86400;
1984 si->si_retryinterval = NULL;
1985 si->si_retrynum_init = NULL;
1986 si->si_retrynum = NULL;
1987 si->si_manageDSAit = 0;
1991 si->si_presentlist = NULL;
1992 LDAP_LIST_INIT( &si->si_nonpresentlist );
1993 ldap_pvt_thread_mutex_init( &si->si_mutex );
1995 rc = parse_syncrepl_line( cargv, cargc, si );
1998 Debug( LDAP_DEBUG_ANY, "failed to add syncinfo\n", 0, 0, 0 );
1999 syncinfo_free( si );
2002 Debug( LDAP_DEBUG_CONFIG,
2003 "Config: ** successfully added syncrepl \"%s\"\n",
2004 BER_BVISNULL( &si->si_provideruri ) ?
2005 "(null)" : si->si_provideruri.bv_val, 0, 0 );
2006 if ( !si->si_schemachecking ) {
2007 SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
2010 be->be_syncinfo = si;
2015 /* NOTE: used & documented in slapd.conf(5) */
2017 #define PROVIDERSTR "provider"
2018 #define TYPESTR "type"
2019 #define INTERVALSTR "interval"
2020 #define SEARCHBASESTR "searchbase"
2021 #define FILTERSTR "filter"
2022 #define SCOPESTR "scope"
2023 #define ATTRSSTR "attrs"
2024 #define ATTRSONLYSTR "attrsonly"
2025 #define SLIMITSTR "sizelimit"
2026 #define TLIMITSTR "timelimit"
2027 #define SCHEMASTR "schemachecking"
2029 /* FIXME: undocumented */
2030 #define OLDAUTHCSTR "bindprincipal"
2031 #define EXATTRSSTR "exattrs"
2032 #define RETRYSTR "retry"
2035 #define LASTMODSTR "lastmod"
2036 #define LMGENSTR "gen"
2037 #define LMNOSTR "no"
2038 #define LMREQSTR "req"
2039 #define SRVTABSTR "srvtab"
2040 #define SUFFIXSTR "suffix"
2041 #define MANAGEDSAITSTR "manageDSAit"
2044 #define GOT_ID 0x0001
2045 #define GOT_PROVIDER 0x0002
2048 #define GOT_ALL (GOT_ID|GOT_PROVIDER)
2054 { BER_BVC("base"), LDAP_SCOPE_BASE },
2055 { BER_BVC("one"), LDAP_SCOPE_ONELEVEL },
2056 #ifdef LDAP_SCOPE_SUBORDINATE
2057 { BER_BVC("children"), LDAP_SCOPE_SUBORDINATE },
2058 { BER_BVC("subordinate"), 0 },
2060 { BER_BVC("sub"), LDAP_SCOPE_SUBTREE },
2065 parse_syncrepl_line(
2075 for ( i = 1; i < cargc; i++ ) {
2076 if ( !strncasecmp( cargv[ i ], IDSTR "=",
2077 STRLENOF( IDSTR "=" ) ) )
2080 /* '\0' string terminator accounts for '=' */
2081 val = cargv[ i ] + STRLENOF( IDSTR "=" );
2083 if ( tmp >= 1000 || tmp < 0 ) {
2084 fprintf( stderr, "Error: parse_syncrepl_line: "
2085 "syncrepl id %d is out of range [0..999]\n", tmp );
2090 } else if ( !strncasecmp( cargv[ i ], PROVIDERSTR "=",
2091 STRLENOF( PROVIDERSTR "=" ) ) )
2093 val = cargv[ i ] + STRLENOF( PROVIDERSTR "=" );
2094 ber_str2bv( val, 0, 1, &si->si_provideruri );
2095 gots |= GOT_PROVIDER;
2096 } else if ( !strncasecmp( cargv[ i ], SCHEMASTR "=",
2097 STRLENOF( SCHEMASTR "=" ) ) )
2099 val = cargv[ i ] + STRLENOF( SCHEMASTR "=" );
2100 if ( !strncasecmp( val, "on", STRLENOF( "on" ) )) {
2101 si->si_schemachecking = 1;
2102 } else if ( !strncasecmp( val, "off", STRLENOF( "off" ) ) ) {
2103 si->si_schemachecking = 0;
2105 si->si_schemachecking = 1;
2107 } else if ( !strncasecmp( cargv[ i ], FILTERSTR "=",
2108 STRLENOF( FILTERSTR "=" ) ) )
2110 val = cargv[ i ] + STRLENOF( FILTERSTR "=" );
2111 ber_str2bv( val, 0, 1, &si->si_filterstr );
2112 } else if ( !strncasecmp( cargv[ i ], SEARCHBASESTR "=",
2113 STRLENOF( SEARCHBASESTR "=" ) ) )
2118 val = cargv[ i ] + STRLENOF( SEARCHBASESTR "=" );
2119 if ( si->si_base.bv_val ) {
2120 ch_free( si->si_base.bv_val );
2122 ber_str2bv( val, 0, 0, &bv );
2123 rc = dnNormalize( 0, NULL, NULL, &bv, &si->si_base, NULL );
2124 if ( rc != LDAP_SUCCESS ) {
2125 fprintf( stderr, "Invalid base DN \"%s\": %d (%s)\n",
2126 val, rc, ldap_err2string( rc ) );
2129 } else if ( !strncasecmp( cargv[ i ], SCOPESTR "=",
2130 STRLENOF( SCOPESTR "=" ) ) )
2133 val = cargv[ i ] + STRLENOF( SCOPESTR "=" );
2134 for ( j=0; !BER_BVISNULL(&scopes[j].key); j++ ) {
2135 if (!strncasecmp( val, scopes[j].key.bv_val,
2136 scopes[j].key.bv_len )) {
2137 while (!scopes[j].val) j--;
2138 si->si_scope = scopes[j].val;
2142 if ( BER_BVISNULL(&scopes[j].key) ) {
2143 fprintf( stderr, "Error: parse_syncrepl_line: "
2144 "unknown scope \"%s\"\n", val);
2147 } else if ( !strncasecmp( cargv[ i ], ATTRSONLYSTR "=",
2148 STRLENOF( ATTRSONLYSTR "=" ) ) )
2150 si->si_attrsonly = 1;
2151 } else if ( !strncasecmp( cargv[ i ], ATTRSSTR "=",
2152 STRLENOF( ATTRSSTR "=" ) ) )
2154 val = cargv[ i ] + STRLENOF( ATTRSSTR "=" );
2155 if ( !strncasecmp( val, ":include:", STRLENOF(":include:") ) ) {
2157 attr_fname = ch_strdup( val + STRLENOF(":include:") );
2158 si->si_anlist = file2anlist( si->si_anlist, attr_fname, " ,\t" );
2159 if ( si->si_anlist == NULL ) {
2160 ch_free( attr_fname );
2163 si->si_anfile = attr_fname;
2165 char *str, *s, *next;
2166 char delimstr[] = " ,\t";
2167 str = ch_strdup( val );
2168 for ( s = ldap_pvt_strtok( str, delimstr, &next );
2170 s = ldap_pvt_strtok( NULL, delimstr, &next ) )
2172 if ( strlen(s) == 1 && *s == '*' ) {
2173 si->si_allattrs = 1;
2174 *(val + ( s - str )) = delimstr[0];
2176 if ( strlen(s) == 1 && *s == '+' ) {
2177 si->si_allopattrs = 1;
2178 *(val + ( s - str )) = delimstr[0];
2182 si->si_anlist = str2anlist( si->si_anlist, val, " ,\t" );
2183 if ( si->si_anlist == NULL ) {
2187 } else if ( !strncasecmp( cargv[ i ], EXATTRSSTR "=",
2188 STRLENOF( EXATTRSSTR "=" ) ) )
2190 val = cargv[ i ] + STRLENOF( EXATTRSSTR "=" );
2191 if ( !strncasecmp( val, ":include:", STRLENOF(":include:") )) {
2193 attr_fname = ch_strdup( val + STRLENOF(":include:") );
2194 si->si_exanlist = file2anlist(
2195 si->si_exanlist, attr_fname, " ,\t" );
2196 if ( si->si_exanlist == NULL ) {
2197 ch_free( attr_fname );
2200 ch_free( attr_fname );
2202 si->si_exanlist = str2anlist( si->si_exanlist, val, " ,\t" );
2203 if ( si->si_exanlist == NULL ) {
2207 } else if ( !strncasecmp( cargv[ i ], TYPESTR "=",
2208 STRLENOF( TYPESTR "=" ) ) )
2210 val = cargv[ i ] + STRLENOF( TYPESTR "=" );
2211 if ( !strncasecmp( val, "refreshOnly",
2212 STRLENOF("refreshOnly") ))
2214 si->si_type = LDAP_SYNC_REFRESH_ONLY;
2215 } else if ( !strncasecmp( val, "refreshAndPersist",
2216 STRLENOF("refreshAndPersist") ))
2218 si->si_type = LDAP_SYNC_REFRESH_AND_PERSIST;
2219 si->si_interval = 60;
2221 fprintf( stderr, "Error: parse_syncrepl_line: "
2222 "unknown sync type \"%s\"\n", val);
2225 } else if ( !strncasecmp( cargv[ i ], INTERVALSTR "=",
2226 STRLENOF( INTERVALSTR "=" ) ) )
2228 val = cargv[ i ] + STRLENOF( INTERVALSTR "=" );
2229 if ( si->si_type == LDAP_SYNC_REFRESH_AND_PERSIST ) {
2230 si->si_interval = 0;
2238 hstr = strchr( dstr, ':' );
2239 if ( hstr == NULL ) {
2240 fprintf( stderr, "Error: parse_syncrepl_line: "
2241 "invalid interval \"%s\"\n", val );
2245 mstr = strchr( hstr, ':' );
2246 if ( mstr == NULL ) {
2247 fprintf( stderr, "Error: parse_syncrepl_line: "
2248 "invalid interval \"%s\"\n", val );
2252 sstr = strchr( mstr, ':' );
2253 if ( sstr == NULL ) {
2254 fprintf( stderr, "Error: parse_syncrepl_line: "
2255 "invalid interval \"%s\"\n", val );
2264 if (( hh > 24 ) || ( hh < 0 ) ||
2265 ( mm > 60 ) || ( mm < 0 ) ||
2266 ( ss > 60 ) || ( ss < 0 ) || ( dd < 0 )) {
2267 fprintf( stderr, "Error: parse_syncrepl_line: "
2268 "invalid interval \"%s\"\n", val );
2271 si->si_interval = (( dd * 24 + hh ) * 60 + mm ) * 60 + ss;
2273 if ( si->si_interval < 0 ) {
2274 fprintf( stderr, "Error: parse_syncrepl_line: "
2275 "invalid interval \"%ld\"\n",
2276 (long) si->si_interval);
2279 } else if ( !strncasecmp( cargv[ i ], RETRYSTR "=",
2280 STRLENOF( RETRYSTR "=" ) ) )
2285 val = cargv[ i ] + STRLENOF( RETRYSTR "=" );
2286 retry_list = (char **) ch_calloc( 1, sizeof( char * ));
2287 retry_list[0] = NULL;
2289 slap_str2clist( &retry_list, val, " ,\t" );
2291 for ( k = 0; retry_list && retry_list[k]; k++ ) ;
2295 "Error: incomplete syncrepl retry list\n" );
2296 for ( k = 0; retry_list && retry_list[k]; k++ ) {
2297 ch_free( retry_list[k] );
2299 ch_free( retry_list );
2300 exit( EXIT_FAILURE );
2302 si->si_retryinterval = (time_t *) ch_calloc( n + 1, sizeof( time_t ));
2303 si->si_retrynum = (int *) ch_calloc( n + 1, sizeof( int ));
2304 si->si_retrynum_init = (int *) ch_calloc( n + 1, sizeof( int ));
2305 for ( j = 0; j < n; j++ ) {
2306 si->si_retryinterval[j] = atoi( retry_list[j*2] );
2307 if ( *retry_list[j*2+1] == '+' ) {
2308 si->si_retrynum_init[j] = -1;
2309 si->si_retrynum[j] = -1;
2313 si->si_retrynum_init[j] = atoi( retry_list[j*2+1] );
2314 si->si_retrynum[j] = atoi( retry_list[j*2+1] );
2317 si->si_retrynum_init[j] = -2;
2318 si->si_retrynum[j] = -2;
2319 si->si_retryinterval[j] = 0;
2321 for ( k = 0; retry_list && retry_list[k]; k++ ) {
2322 ch_free( retry_list[k] );
2324 ch_free( retry_list );
2325 } else if ( !strncasecmp( cargv[ i ], MANAGEDSAITSTR "=",
2326 STRLENOF( MANAGEDSAITSTR "=" ) ) )
2328 val = cargv[ i ] + STRLENOF( MANAGEDSAITSTR "=" );
2329 si->si_manageDSAit = atoi( val );
2330 } else if ( !strncasecmp( cargv[ i ], SLIMITSTR "=",
2331 STRLENOF( SLIMITSTR "=") ) )
2333 val = cargv[ i ] + STRLENOF( SLIMITSTR "=" );
2334 si->si_slimit = atoi( val );
2335 } else if ( !strncasecmp( cargv[ i ], TLIMITSTR "=",
2336 STRLENOF( TLIMITSTR "=" ) ) )
2338 val = cargv[ i ] + STRLENOF( TLIMITSTR "=" );
2339 si->si_tlimit = atoi( val );
2340 } else if ( bindconf_parse( cargv[i], &si->si_bindconf )) {
2341 fprintf( stderr, "Error: parse_syncrepl_line: "
2342 "unknown keyword \"%s\"\n", cargv[ i ] );
2347 if ( gots != GOT_ALL ) {
2349 "Error: Malformed \"syncrepl\" line in slapd config file" );
2357 syncrepl_unparse( syncinfo_t *si, struct berval *bv )
2360 char buf[BUFSIZ*2], *ptr;
2363 bindconf_unparse( &si->si_bindconf, &bc );
2365 ptr += sprintf( ptr, IDSTR "=%03d " PROVIDERSTR "=%s",
2366 si->si_rid, si->si_provideruri.bv_val );
2367 if ( !BER_BVISNULL( &bc )) {
2368 ptr = lutil_strcopy( ptr, bc.bv_val );
2371 if ( !BER_BVISEMPTY( &si->si_filterstr )) {
2372 ptr = lutil_strcopy( ptr, " " FILTERSTR "=\"" );
2373 ptr = lutil_strcopy( ptr, si->si_filterstr.bv_val );
2376 if ( !BER_BVISNULL( &si->si_base )) {
2377 ptr = lutil_strcopy( ptr, " " SEARCHBASESTR "=\"" );
2378 ptr = lutil_strcopy( ptr, si->si_base.bv_val );
2381 for (i=0; !BER_BVISNULL(&scopes[i].key);i++) {
2382 if ( si->si_scope == scopes[i].val ) {
2383 ptr = lutil_strcopy( ptr, " " SCOPESTR "=" );
2384 ptr = lutil_strcopy( ptr, scopes[i].key.bv_val );
2388 if ( si->si_attrsonly ) {
2389 ptr = lutil_strcopy( ptr, " " ATTRSONLYSTR "=yes" );
2391 if ( si->si_anfile ) {
2392 ptr = lutil_strcopy( ptr, " " ATTRSSTR "=:include:" );
2393 ptr = lutil_strcopy( ptr, si->si_anfile );
2394 } else if ( si->si_allattrs || si->si_allopattrs ||
2395 ( si->si_anlist && !BER_BVISNULL(&si->si_anlist[0].an_name) )) {
2397 ptr = lutil_strcopy( ptr, " " ATTRSSTR "=\"" );
2399 ptr = anlist_unparse( si->si_anlist, ptr );
2400 if ( si->si_allattrs ) {
2401 if ( old != ptr ) *ptr++ = ',';
2404 if ( si->si_allopattrs ) {
2405 if ( old != ptr ) *ptr++ = ',';
2410 if ( si->si_exanlist && !BER_BVISNULL(&si->si_exanlist[0].an_name) ) {
2411 ptr = lutil_strcopy( ptr, " " EXATTRSSTR "=" );
2412 ptr = anlist_unparse( si->si_exanlist, ptr );
2414 ptr = lutil_strcopy( ptr, " " SCHEMASTR "=" );
2415 ptr = lutil_strcopy( ptr, si->si_schemachecking ? "on" : "off" );
2417 ptr = lutil_strcopy( ptr, " " TYPESTR "=" );
2418 ptr = lutil_strcopy( ptr, si->si_type == LDAP_SYNC_REFRESH_AND_PERSIST ?
2419 "refreshAndPersist" : "refreshOnly" );
2421 if ( si->si_type == LDAP_SYNC_REFRESH_ONLY ) {
2424 dd = si->si_interval;
2431 ptr = lutil_strcopy( ptr, " " INTERVALSTR "=" );
2432 ptr += sprintf( ptr, "%02d:%02d:%02d:%02d", dd, hh, mm, ss );
2433 } else if ( si->si_retryinterval ) {
2435 ptr = lutil_strcopy( ptr, " " RETRYSTR "=\"" );
2436 for (i=0; si->si_retryinterval[i]; i++) {
2437 if ( space ) *ptr++ = ' ';
2439 ptr += sprintf( ptr, "%d", si->si_retryinterval[i] );
2440 if ( si->si_retrynum_init[i] == -1 )
2443 ptr += sprintf( ptr, "%d", si->si_retrynum_init );
2448 #if 0 /* FIXME: unused in syncrepl.c, should remove it */
2449 ptr = lutil_strcopy( ptr, " " MANAGEDSAITSTR "=" );
2450 ptr += sprintf( ptr, "%d", si->si_manageDSAit );
2453 if ( si->si_slimit ) {
2454 ptr = lutil_strcopy( ptr, " " SLIMITSTR "=" );
2455 ptr += sprintf( ptr, "%d", si->si_slimit );
2458 if ( si->si_tlimit ) {
2459 ptr = lutil_strcopy( ptr, " " TLIMITSTR "=" );
2460 ptr += sprintf( ptr, "%d", si->si_tlimit );
2462 bc.bv_len = ptr - buf;
2464 ber_dupbv( bv, &bc );
2469 read_config(const char *fname, int depth) {
2471 if ( !backend_db_init( "config" ))
2474 ber_str2bv( fname, 0, 1, &cf_prv.c_file );
2475 return read_config_file(fname, depth, NULL);
2479 config_back_bind( Operation *op, SlapReply *rs )
2481 if ( op->orb_method == LDAP_AUTH_SIMPLE && be_isroot_pw( op )) {
2482 ber_dupbv( &op->orb_edn, be_root_dn( op->o_bd ));
2483 /* frontend sends result */
2484 return LDAP_SUCCESS;
2487 rs->sr_err = LDAP_INVALID_CREDENTIALS;
2488 send_ldap_result( op, rs );
2493 static CfEntryInfo *
2494 config_find_base( CfEntryInfo *root, struct berval *dn, CfEntryInfo **last )
2499 if ( dn_match( &root->ce_entry->e_nname, dn ))
2502 c = dn->bv_val+dn->bv_len;
2503 for (;*c != ',';c--);
2507 for (--c;c>dn->bv_val && *c != ',';c--);
2511 cdn.bv_len = dn->bv_len - (c-dn->bv_val);
2513 root = root->ce_kids;
2515 for (;root;root=root->ce_sibs) {
2516 if ( dn_match( &root->ce_entry->e_nname, &cdn )) {
2517 if ( cdn.bv_val == dn->bv_val ) {
2528 config_send( Operation *op, SlapReply *rs, CfEntryInfo *ce, int depth )
2532 if ( test_filter( op, ce->ce_entry, op->ors_filter ) == LDAP_COMPARE_TRUE )
2534 rs->sr_attrs = op->ors_attrs;
2535 rs->sr_entry = ce->ce_entry;
2536 rc = send_search_entry( op, rs );
2538 if ( op->ors_scope == LDAP_SCOPE_SUBTREE ) {
2539 if ( ce->ce_kids ) {
2540 rc = config_send( op, rs, ce->ce_kids, 1 );
2541 if ( rc ) return rc;
2544 for (ce=ce->ce_sibs; ce; ce=ce->ce_sibs) {
2545 rc = config_send( op, rs, ce, 0 );
2554 config_back_search( Operation *op, SlapReply *rs )
2557 CfEntryInfo *ce, *last;
2560 if ( !be_isroot( op ) ) {
2561 rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
2562 send_ldap_result( op, rs );
2565 cfb = (CfBackInfo *)op->o_bd->be_private;
2567 ce = config_find_base( cfb->cb_root, &op->o_req_ndn, &last );
2570 rs->sr_matched = last->ce_entry->e_name.bv_val;
2571 rs->sr_err = LDAP_NO_SUCH_OBJECT;
2574 switch ( op->ors_scope ) {
2575 case LDAP_SCOPE_BASE:
2576 case LDAP_SCOPE_SUBTREE:
2577 config_send( op, rs, ce, 0 );
2580 case LDAP_SCOPE_ONELEVEL:
2581 for (ce = ce->ce_kids; ce; ce=ce->ce_sibs) {
2582 config_send( op, rs, ce, 1 );
2587 rs->sr_err = LDAP_SUCCESS;
2589 send_ldap_result( op, rs );
2594 config_alloc_entry( struct berval *pdn, struct berval *rdn )
2596 Entry *e = ch_calloc( 1, sizeof(Entry) );
2597 CfEntryInfo *ce = ch_calloc( 1, sizeof(CfEntryInfo) );
2600 build_new_dn( &e->e_name, pdn, rdn, NULL );
2601 ber_dupbv( &e->e_nname, &e->e_name );
2610 config_build_entry( ConfigArgs *c, Entry *e, ObjectClass *oc,
2611 struct berval *rdn, ConfigTable *ct, int table )
2613 struct berval vals[2];
2614 struct berval ad_name;
2615 AttributeDescription *ad = NULL;
2621 BER_BVZERO( &vals[1] );
2623 vals[0] = oc->soc_cname;
2624 attr_merge(e, slap_schema.si_ad_objectClass, vals, NULL );
2625 ptr = strchr(rdn->bv_val, '=');
2626 ad_name.bv_val = rdn->bv_val;
2627 ad_name.bv_len = ptr - rdn->bv_val;
2628 rc = slap_bv2ad( &ad_name, &ad, &text );
2632 vals[0].bv_val = ptr+1;
2633 vals[0].bv_len = rdn->bv_len - (vals[0].bv_val - rdn->bv_val);
2634 attr_merge(e, ad, vals, NULL );
2636 for (at=oc->soc_allowed;*at;at++) {
2637 /* Skip the naming attr */
2638 if ((*at)->sat_ad == ad || (*at)->sat_ad == slap_schema.si_ad_cn )
2640 for (i=0;ct[i].name;i++) {
2641 if (ct[i].ad == (*at)->sat_ad)
2644 rc = config_get_vals(&ct[i], c);
2645 if (rc == LDAP_SUCCESS) {
2646 attr_merge(e, ct[i].ad, c->rvalue_vals, c->rvalue_nvals);
2647 ber_bvarray_free( c->rvalue_nvals );
2648 ber_bvarray_free( c->rvalue_vals );
2653 if ( table == BI_TABLE )
2654 ct = c->bi->bi_cf_table;
2656 ct = c->be->be_cf_table;
2657 for (;ct && ct->name;ct++) {
2658 if (!ct->ad) continue;
2659 rc = config_get_vals(ct, c);
2660 if (rc == LDAP_SUCCESS) {
2661 attr_merge(e, ct->ad, c->rvalue_vals, c->rvalue_nvals);
2669 static CfEntryInfo *
2670 config_build_includes( ConfigArgs *c, Entry *parent )
2674 ConfigFile *cf = (ConfigFile *)c->line;
2675 CfEntryInfo *ce, *ceparent, *ceprev;
2677 ceparent = parent->e_private;
2679 for (i=0; cf; cf=cf->c_sibs, i++) {
2680 c->value_dn.bv_val = c->log;
2681 c->value_dn.bv_len = sprintf(c->value_dn.bv_val, "cn=include{%d}", i);
2682 e = config_alloc_entry( &parent->e_nname, &c->value_dn );
2683 c->line = (char *)cf;
2684 config_build_entry( c, e, cfOc_include, &c->value_dn,
2685 c->bi->bi_cf_table, NO_TABLE );
2687 if ( !ceparent->ce_kids ) {
2688 ceparent->ce_kids = ce;
2690 ceprev->ce_sibs = ce;
2694 c->line = (char *)cf->c_kids;
2695 config_build_includes( c, e );
2702 config_back_db_open( BackendDB *be )
2704 CfBackInfo *cfb = be->be_private;
2707 CfEntryInfo *ce, *ceparent, *ceprev;
2714 /* create root of tree */
2715 ber_str2bv( CONFIG_DN, STRLENOF( CONFIG_DN ), 0, &rdn );
2716 e = config_alloc_entry( NULL, &rdn );
2721 c.line = (char *)cfb->cb_config;
2722 ct = c.bi->bi_cf_table;
2723 config_build_entry( &c, e, cfOc_global, &rdn, ct, NO_TABLE );
2728 /* Create includeFile nodes... */
2729 if ( cfb->cb_config->c_kids ) {
2730 c.line = (char *)cfb->cb_config->c_kids;
2731 ceprev = config_build_includes( &c, parent );
2734 /* Create backend nodes. Skip if they don't provide a cf_table.
2735 * There usually aren't any of these.
2740 for (i=0; i<nBackendInfo; i++, bi++) {
2741 if (!bi->bi_cf_table) continue;
2742 if (!bi->bi_private) continue;
2745 rdn.bv_len = sprintf(rdn.bv_val, "%s=%s", cfAd_backend->ad_cname.bv_val, bi->bi_type);
2746 e = config_alloc_entry( &parent->e_nname, &rdn );
2750 config_build_entry( &c, e, cfOc_backend, &rdn, ct, BI_TABLE );
2751 if ( !ceparent->ce_kids ) {
2752 ceparent->ce_kids = ce;
2754 ceprev->ce_sibs = ce;
2759 /* Create database nodes... */
2760 for (i=0; i<nBackendDB; i++) {
2761 slap_overinfo *oi = NULL;
2765 bptr = &backendDB[i];
2767 if ( overlay_is_over( bptr )) {
2768 oi = bptr->bd_info->bi_private;
2774 rdn.bv_len = sprintf(rdn.bv_val, "%s={%0x}%s", cfAd_database->ad_cname.bv_val,
2776 e = config_alloc_entry( &parent->e_nname, &rdn );
2782 config_build_entry( &c, e, cfOc_database, &rdn, ct, BE_TABLE );
2783 if ( !ceparent->ce_kids ) {
2784 ceparent->ce_kids = ce;
2786 ceprev->ce_sibs = ce;
2789 /* Iterate through overlays */
2793 CfEntryInfo *opar = ce, *oprev = NULL;
2796 for (j=0,on=oi->oi_list; on; j++,on=on->on_next) {
2798 rdn.bv_len = sprintf(rdn.bv_val, "%s={%0x}%s",
2799 cfAd_overlay->ad_cname.bv_val, j, on->on_bi.bi_type );
2800 oe = config_alloc_entry( &e->e_nname, &rdn );
2806 config_build_entry( &c, oe, cfOc_overlay, &rdn, ct, BI_TABLE );
2807 if ( !opar->ce_kids ) {
2810 oprev->ce_sibs = ce;
2821 config_back_db_destroy( Backend *be )
2823 free( be->be_private );
2828 config_back_db_init( Backend *be )
2833 cfb = ch_calloc( 1, sizeof(CfBackInfo));
2834 cfb->cb_config = &cf_prv;
2835 be->be_private = cfb;
2837 ber_str2bv( CONFIG_DN, 0, 1, &be->be_rootdn );
2838 ber_dupbv( &be->be_rootndn, &be->be_rootdn );
2839 ber_dupbv( &dn, &be->be_rootdn );
2840 ber_bvarray_add( &be->be_suffix, &dn );
2841 ber_dupbv( &dn, &be->be_rootdn );
2842 ber_bvarray_add( &be->be_nsuffix, &dn );
2849 AttributeDescription **desc;
2850 AttributeDescription *sub;
2852 { "attribute", NULL, NULL },
2853 { "backend", &cfAd_backend, NULL },
2854 { "database", &cfAd_database, NULL },
2855 { "ditcontentrule", NULL, NULL },
2856 { "include", &cfAd_include, NULL },
2857 { "objectclass", NULL, NULL },
2858 { "overlay", &cfAd_overlay, NULL },
2859 { NULL, NULL, NULL }
2863 config_back_initialize( BackendInfo *bi )
2865 ConfigTable *ct = config_back_cf_table;
2874 bi->bi_db_init = config_back_db_init;
2875 bi->bi_db_config = 0;
2876 bi->bi_db_open = config_back_db_open;
2877 bi->bi_db_close = 0;
2878 bi->bi_db_destroy = config_back_db_destroy;
2880 bi->bi_op_bind = config_back_bind;
2881 bi->bi_op_unbind = 0;
2882 bi->bi_op_search = config_back_search;
2883 bi->bi_op_compare = 0;
2884 bi->bi_op_modify = 0;
2885 bi->bi_op_modrdn = 0;
2887 bi->bi_op_delete = 0;
2888 bi->bi_op_abandon = 0;
2890 bi->bi_extended = 0;
2892 bi->bi_chk_referrals = 0;
2894 bi->bi_connection_init = 0;
2895 bi->bi_connection_destroy = 0;
2898 for (i=0; OidMacros[i].name; i++ ) {
2899 argv[1] = OidMacros[i].name;
2900 argv[2] = OidMacros[i].oid;
2901 parse_oidm( "slapd", i, 3, argv );
2904 i = init_config_attrs( ct );
2907 /* set up the notable AttributeDescriptions */
2908 ads[0].sub = slap_schema.si_ad_attributeTypes;
2909 ads[3].sub = slap_schema.si_ad_ditContentRules;
2910 ads[5].sub = slap_schema.si_ad_objectClasses;
2912 bi->bi_cf_table = ct;
2915 for (;ct->name;ct++) {
2916 if (strcmp(ct->name, ads[i].name)) continue;
2918 ct->ad = ads[i].sub;
2920 *ads[i].desc = ct->ad;
2923 if (!ads[i].name) break;
2926 /* set up the objectclasses */
2927 i = init_config_ocs( cf_ocs );