From: Pierangelo Masarati Date: Thu, 15 Dec 2005 23:46:23 +0000 (+0000) Subject: first part of fix to ITS#4262 X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~581 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e788a5c380d53f979d3c7a20e208e9a7429e956d;p=openldap first part of fix to ITS#4262 --- diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index 75b24f7da2..309346bf75 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -464,26 +464,52 @@ bdb_cf_gen(ConfigArgs *c) case BDB_NOSYNC: bdb->bi_dbenv->set_flags( bdb->bi_dbenv, DB_TXN_NOSYNC, 0 ); break; - case BDB_INDEX: { - AttributeDescription *ad = NULL; - struct berval bv, def = BER_BVC("default"); - char *ptr; - const char *text; - for (ptr = c->line; !isspace( *ptr ); ptr++); - bv.bv_val = c->line; - bv.bv_len = ptr - bv.bv_val; - if ( bvmatch( &bv, &def )) { - bdb->bi_defaultmask = 0; + case BDB_INDEX: + if ( c->valx == -1 ) { + /* delete all (FIXME) */ + } else { - slap_bv2ad( &bv, &ad, &text ); - if ( ad ) { - AttrInfo *ai = bdb_attr_mask( bdb, ad ); - ai->ai_indexmask |= BDB_INDEX_DELETING; - bdb->bi_flags |= BDB_DEL_INDEX; - c->cleanup = bdb_cf_cleanup; + struct berval bv, def = BER_BVC("default"); + char *ptr; + + for (ptr = c->line; !isspace( *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; } return rc; diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 13cf3f619e..2f8cd60f4c 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -628,6 +628,7 @@ config_parse_vals(ConfigTable *ct, ConfigArgs *c, int valx) } rc = config_check_vals( ct, c, 1 ); ch_free( c->tline ); + c->tline = NULL; if ( rc ) rc = LDAP_CONSTRAINT_VIOLATION;