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"
28 struct ldbm_backend_info *lbi =
29 (struct ldbm_backend_info *) bi->bi_private;
32 fprintf( stderr, "%s: line %d: ldbm backend info is null!\n",
37 /* directory where database files live */
38 if ( strcasecmp( argv[0], "directory" ) == 0 ) {
41 "%s: line %d: missing dir in \"directory <dir>\" line\n",
45 if ( lbi->lbi_directory ) {
46 free( lbi->lbi_directory );
48 lbi->lbi_directory = ch_strdup( argv[1] );
53 "%s: line %d: unknown directive \"%s\" in ldbm backend definition (ignored)\n",
54 fname, lineno, argv[0] );
70 struct ldbminfo *li = (struct ldbminfo *) be->be_private;
73 fprintf( stderr, "%s: line %d: ldbm database info is null!\n",
78 /* directory where database files live */
79 if ( strcasecmp( argv[0], "directory" ) == 0 ) {
82 "%s: line %d: missing dir in \"directory <dir>\" line\n",
86 if ( li->li_directory )
87 free( li->li_directory );
88 li->li_directory = ch_strdup( argv[1] );
90 /* mode with which to create new database files */
91 } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
94 "%s: line %d: missing mode in \"mode <mode>\" line\n",
98 li->li_mode = strtol( argv[1], NULL, 0 );
100 /* attribute to index */
101 } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
104 "%s: line %d: missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
107 } else if ( argc > 3 ) {
109 "%s: line %d: extra junk after \"index <attr> [pres,eq,approx,sub]\" line (ignored)\n",
112 rc = attr_index_config( li, fname, lineno, argc - 1, &argv[1] );
114 if( rc != LDAP_SUCCESS ) return 1;
116 /* size of the cache in entries */
117 } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
120 "%s: line %d: missing size in \"cachesize <size>\" line\n",
124 li->li_cache.c_maxsize = atoi( argv[1] );
126 /* size of each dbcache in bytes */
127 } else if ( strcasecmp( argv[0], "dbcachesize" ) == 0 ) {
130 "%s: line %d: missing size in \"dbcachesize <size>\" line\n",
134 li->li_dbcachesize = atoi( argv[1] );
136 /* no locking (not safe) */
137 } else if ( strcasecmp( argv[0], "dbnolocking" ) == 0 ) {
138 li->li_dblocking = 0;
140 /* no write sync (not safe) */
141 } else if ( ( strcasecmp( argv[0], "dbnosync" ) == 0 )
142 || ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) )
144 li->li_dbwritesync = 0;
149 "%s: line %d: unknown directive \"%s\" in ldbm database definition (ignored)\n",
150 fname, lineno, argv[0] );