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 ldbminfo *li = (struct ldbminfo *) be->be_private;
32 fprintf( stderr, "%s: line %d: ldbm database 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 ( li->li_directory )
46 free( li->li_directory );
47 li->li_directory = ch_strdup( argv[1] );
49 /* mode with which to create new database files */
50 } else if ( strcasecmp( argv[0], "mode" ) == 0 ) {
53 "%s: line %d: missing mode in \"mode <mode>\" line\n",
57 li->li_mode = strtol( argv[1], NULL, 0 );
59 /* attribute to index */
60 } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
63 "%s: line %d: missing attr in \"index <attr> [pres,eq,approx,sub]\" line\n",
66 } else if ( argc > 3 ) {
68 "%s: line %d: extra junk after \"index <attr> [pres,eq,approx,sub]\" line (ignored)\n",
71 rc = attr_index_config( li, fname, lineno, argc - 1, &argv[1] );
73 if( rc != LDAP_SUCCESS ) return 1;
75 /* size of the cache in entries */
76 } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
79 "%s: line %d: missing size in \"cachesize <size>\" line\n",
83 li->li_cache.c_maxsize = atoi( argv[1] );
85 /* size of each dbcache in bytes */
86 } else if ( strcasecmp( argv[0], "dbcachesize" ) == 0 ) {
89 "%s: line %d: missing size in \"dbcachesize <size>\" line\n",
93 li->li_dbcachesize = atoi( argv[1] );
95 /* no locking (not safe) */
96 } else if ( strcasecmp( argv[0], "dbnolocking" ) == 0 ) {
99 /* no write sync (not safe) */
100 } else if ( ( strcasecmp( argv[0], "dbnosync" ) == 0 )
101 || ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) )
103 li->li_dbwritesync = 0;
108 "%s: line %d: unknown directive \"%s\" in ldbm database definition (ignored)\n",
109 fname, lineno, argv[0] );