+
+ case BDB_PGSIZE: {
+ struct bdb_db_pgsize *ps;
+ char buf[SLAP_TEXT_BUFLEN];
+ struct berval bv;
+ int rc = 1;
+
+ bv.bv_val = buf;
+ for ( ps = bdb->bi_pagesizes; ps; ps = ps->bdp_next ) {
+ bv.bv_len = sprintf( buf, "%s %d", ps->bdp_name.bv_val,
+ ps->bdp_size / 1024 );
+ value_add_one( &c->rvalue_vals, &bv );
+ rc = 0;
+
+ }
+ break;
+ }
+ }
+ return rc;
+ } else if ( c->op == LDAP_MOD_DELETE ) {
+ rc = 0;
+ switch( c->type ) {
+ case BDB_MODE:
+#if 0
+ /* FIXME: does it make any sense to change the mode,
+ * if we don't exec a chmod()? */
+ bdb->bi_dbenv_mode = SLAPD_DEFAULT_DB_MODE;
+ break;
+#endif
+
+ /* single-valued no-ops */
+ case BDB_LOCKD:
+ case BDB_SSTACK:
+ break;
+
+ case BDB_CHKPT:
+ if ( bdb->bi_txn_cp_task ) {
+ struct re_s *re = bdb->bi_txn_cp_task;
+ bdb->bi_txn_cp_task = NULL;
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+ if ( ldap_pvt_runqueue_isrunning( &slapd_rq, re ) )
+ ldap_pvt_runqueue_stoptask( &slapd_rq, re );
+ ldap_pvt_runqueue_remove( &slapd_rq, re );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
+ }
+ bdb->bi_txn_cp = 0;
+ break;
+ case BDB_CONFIG:
+ if ( c->valx < 0 ) {
+ ber_bvarray_free( bdb->bi_db_config );
+ bdb->bi_db_config = NULL;
+ } else {
+ int i = c->valx;
+ ch_free( bdb->bi_db_config[i].bv_val );
+ for (; bdb->bi_db_config[i].bv_val; i++)
+ bdb->bi_db_config[i] = bdb->bi_db_config[i+1];
+ }
+ bdb->bi_flags |= BDB_UPD_CONFIG;
+ c->cleanup = bdb_cf_cleanup;
+ break;
+ /* Doesn't really make sense to change these on the fly;
+ * the entire DB must be dumped and reloaded
+ */
+ case BDB_CRYPTFILE:
+ if ( bdb->bi_db_crypt_file ) {
+ ch_free( bdb->bi_db_crypt_file );
+ bdb->bi_db_crypt_file = NULL;
+ }
+ /* FALLTHRU */
+ case BDB_CRYPTKEY:
+ if ( !BER_BVISNULL( &bdb->bi_db_crypt_key )) {
+ ch_free( bdb->bi_db_crypt_key.bv_val );
+ BER_BVZERO( &bdb->bi_db_crypt_key );
+ }
+ break;
+ case BDB_DIRECTORY:
+ bdb->bi_flags |= BDB_RE_OPEN;
+ bdb->bi_flags ^= BDB_HAS_CONFIG;
+ ch_free( bdb->bi_dbenv_home );
+ bdb->bi_dbenv_home = NULL;
+ ch_free( bdb->bi_db_config_path );
+ bdb->bi_db_config_path = NULL;
+ c->cleanup = bdb_cf_cleanup;
+ ldap_pvt_thread_pool_purgekey( bdb->bi_dbenv );
+ break;
+ case BDB_NOSYNC:
+ bdb->bi_dbenv->set_flags( bdb->bi_dbenv, DB_TXN_NOSYNC, 0 );
+ break;
+ case BDB_CHECKSUM:
+ bdb->bi_flags &= ~BDB_CHKSUM;
+ break;
+ case BDB_INDEX:
+ if ( c->valx == -1 ) {
+ int i;
+
+ /* delete all (FIXME) */
+ for ( i = 0; i < bdb->bi_nattrs; i++ ) {
+ bdb->bi_attrs[i]->ai_indexmask |= BDB_INDEX_DELETING;
+ }
+ bdb->bi_flags |= BDB_DEL_INDEX;
+ c->cleanup = bdb_cf_cleanup;
+
+ } else {
+ struct berval bv, def = BER_BVC("default");
+ char *ptr;
+
+ for (ptr = c->line; !isspace( (unsigned char) *ptr ); ptr++);
+
+ bv.bv_val = c->line;
+ bv.bv_len = ptr - bv.bv_val;
+ if ( bvmatch( &bv, &def )) {
+ bdb->bi_defaultmask = 0;
+
+ } else {
+ int i;
+ char **attrs;
+ char sep;
+
+ sep = bv.bv_val[ bv.bv_len ];
+ bv.bv_val[ bv.bv_len ] = '\0';
+ attrs = ldap_str2charray( bv.bv_val, "," );
+
+ for ( i = 0; attrs[ i ]; i++ ) {
+ AttributeDescription *ad = NULL;
+ const char *text;
+ AttrInfo *ai;
+
+ slap_str2ad( attrs[ i ], &ad, &text );
+ /* if we got here... */
+ assert( ad != NULL );
+
+ ai = bdb_attr_mask( bdb, ad );
+ /* if we got here... */
+ assert( ai != NULL );
+
+ ai->ai_indexmask |= BDB_INDEX_DELETING;
+ bdb->bi_flags |= BDB_DEL_INDEX;
+ c->cleanup = bdb_cf_cleanup;
+ }
+
+ bv.bv_val[ bv.bv_len ] = sep;
+ ldap_charray_free( attrs );
+ }
+ }
+ break;
+ /* doesn't make sense on the fly; the DB file must be
+ * recreated
+ */
+ case BDB_PGSIZE: {
+ struct bdb_db_pgsize *ps, **prev;
+ int i;
+
+ for ( i = 0, prev = &bdb->bi_pagesizes, ps = *prev; ps;
+ prev = &ps->bdp_next, ps = ps->bdp_next, i++ ) {
+ if ( c->valx == -1 || i == c->valx ) {
+ *prev = ps->bdp_next;
+ ch_free( ps );
+ ps = *prev;
+ if ( i == c->valx ) break;
+ }
+ }
+ }
+ break;