1 /* config.c - ldbm backend configuration file routine */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-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>.
21 #include <ac/socket.h>
22 #include <ac/string.h>
25 #include "back-ldbm.h"
37 struct ldbminfo *li = (struct ldbminfo *) be->be_private;
40 fprintf( stderr, "%s: line %d: ldbm database info is null!\n",
45 /* directory where database files live */
46 if ( strcasecmp( argv[0], "directory" ) == 0 ) {
49 "%s: line %d: missing dir in \"directory <dir>\" line\n",
53 if ( li->li_directory )
54 free( li->li_directory );
55 li->li_directory = ch_strdup( argv[1] );
57 /* mode with which to create new database files */
58 } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
61 "%s: line %d: missing mode in \"mode <mode>\" line\n",
65 li->li_mode = strtol( argv[1], NULL, 0 );
67 /* attribute to index */
68 } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
71 "%s: line %d: missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
74 } else if ( argc > 3 ) {
76 "%s: line %d: extra junk after \"index <attr> [pres,eq,approx,sub]\" line" SLAPD_CONF_UNKNOWN_IGNORED ".\n",
78 #ifdef SLAPD_CONF_UNKNOWN_BAILOUT
80 #endif /* SLAPD_CONF_UNKNOWN_BAILOUT */
82 rc = attr_index_config( li, fname, lineno, argc - 1, &argv[1] );
84 if( rc != LDAP_SUCCESS ) return 1;
86 /* size of the cache in entries */
87 } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
90 "%s: line %d: missing size in \"cachesize <size>\" line\n",
94 li->li_cache.c_maxsize = atoi( argv[1] );
96 /* size of each dbcache in bytes */
97 } else if ( strcasecmp( argv[0], "dbcachesize" ) == 0 ) {
100 "%s: line %d: missing size in \"dbcachesize <size>\" line\n",
104 li->li_dbcachesize = atoi( argv[1] );
106 /* no locking (not safe) */
107 } else if ( strcasecmp( argv[0], "dbnolocking" ) == 0 ) {
108 li->li_dblocking = 0;
110 /* no write sync (not safe) */
111 } else if ( ( strcasecmp( argv[0], "dbnosync" ) == 0 )
112 || ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) )
114 li->li_dbwritesync = 0;
116 /* run sync thread */
117 } else if ( strcasecmp( argv[0], "dbsync" ) == 0 ) {
121 Debug( LDAP_DEBUG_ANY,
122 "%s: line %d: missing frquency value in \"dbsync <frequency> [<wait-times> [wait-interval]]\" line\n",
130 Debug( LDAP_DEBUG_ANY,
131 "%s: line %d: frquency value (%d) invalid \"dbsync <frequency> [<wait-times> [wait-interval]]\" line\n",
136 li->li_dbsyncfreq = i;
141 Debug( LDAP_DEBUG_ANY,
142 "%s: line %d: frquency value (%d) invalid \"dbsync <frequency> [<wait-times> [wait-interval]]\" line\n",
146 li ->li_dbsyncwaitn = i;
152 Debug( LDAP_DEBUG_ANY,
153 "%s: line %d: frquency value (%d) invalid \"dbsync <frequency> [<wait-times> [wait-interval]]\" line\n",
157 li ->li_dbsyncwaitinterval = i;
160 /* turn off writesync when sync policy is in place */
161 li->li_dbwritesync = 0;
164 Debug( LDAP_DEBUG_ANY,
165 "\"dbsync\" policies not supported in non-threaded environments\n", 0, 0, 0);
172 return SLAP_CONF_UNKNOWN;