1 /* config.c - ldbm backend configuration file routine */
3 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/socket.h>
12 #include <ac/string.h>
15 #include "back-ldbm.h"
17 int ldbm_ignore_nextid_file = 0;
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 if ( li->li_nextid_file )
50 free( li->li_nextid_file );
52 ch_malloc( strlen(li->li_directory) + sizeof("/NEXTID") + 1 );
54 strcpy(li->li_nextid_file, li->li_directory);
55 strcat(li->li_nextid_file, "/NEXTID");
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 (ignored)\n",
79 attr_index_config( li, fname, lineno, argc - 1, &argv[1], 0 );
81 /* size of the cache in entries */
82 } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
85 "%s: line %d: missing size in \"cachesize <size>\" line\n",
89 li->li_cache.c_maxsize = atoi( argv[1] );
91 /* size of each dbcache in bytes */
92 } else if ( strcasecmp( argv[0], "dbcachesize" ) == 0 ) {
95 "%s: line %d: missing size in \"dbcachesize <size>\" line\n",
99 li->li_dbcachesize = atoi( argv[1] );
102 } else if ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) {
103 li->li_dbcachewsync = 0;
108 "%s: line %d: unknown directive \"%s\" in ldbm database definition (ignored)\n",
109 fname, lineno, argv[0] );