1 /* config.c - ldbm backend configuration file routine */
4 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <ac/socket.h>
13 #include <ac/string.h>
16 #include "back-ldbm.h"
29 struct ldbm_backend_info *lbi =
30 (struct ldbm_backend_info *) bi->bi_private;
33 fprintf( stderr, "%s: line %d: ldbm backend info is null!\n",
38 /* directory where database files live */
39 if ( strcasecmp( argv[0], "directory" ) == 0 ) {
42 "%s: line %d: missing dir in \"directory <dir>\" line\n",
46 if ( lbi->lbi_directory ) {
47 free( lbi->lbi_directory );
49 lbi->lbi_directory = ch_strdup( argv[1] );
54 "%s: line %d: unknown directive \"%s\" in ldbm backend definition (ignored)\n",
55 fname, lineno, argv[0] );
71 struct ldbminfo *li = (struct ldbminfo *) be->be_private;
74 fprintf( stderr, "%s: line %d: ldbm database info is null!\n",
79 /* directory where database files live */
80 if ( strcasecmp( argv[0], "directory" ) == 0 ) {
83 "%s: line %d: missing dir in \"directory <dir>\" line\n",
87 if ( li->li_directory )
88 free( li->li_directory );
89 li->li_directory = ch_strdup( argv[1] );
91 /* mode with which to create new database files */
92 } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
95 "%s: line %d: missing mode in \"mode <mode>\" line\n",
99 li->li_mode = strtol( argv[1], NULL, 0 );
101 /* attribute to index */
102 } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
105 "%s: line %d: missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
108 } else if ( argc > 3 ) {
110 "%s: line %d: extra junk after \"index <attr> [pres,eq,approx,sub]\" line (ignored)\n",
113 rc = attr_index_config( li, fname, lineno, argc - 1, &argv[1] );
115 if( rc != LDAP_SUCCESS ) return 1;
117 /* size of the cache in entries */
118 } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
121 "%s: line %d: missing size in \"cachesize <size>\" line\n",
125 li->li_cache.c_maxsize = atoi( argv[1] );
127 /* size of each dbcache in bytes */
128 } else if ( strcasecmp( argv[0], "dbcachesize" ) == 0 ) {
131 "%s: line %d: missing size in \"dbcachesize <size>\" line\n",
135 li->li_dbcachesize = atoi( argv[1] );
137 /* no locking (not safe) */
138 } else if ( strcasecmp( argv[0], "dbnolocking" ) == 0 ) {
139 li->li_dblocking = 0;
141 /* no write sync (not safe) */
142 } else if ( ( strcasecmp( argv[0], "dbnosync" ) == 0 )
143 || ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) )
145 li->li_dbwritesync = 0;
150 "%s: line %d: unknown directive \"%s\" in ldbm database definition (ignored)\n",
151 fname, lineno, argv[0] );