mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Added some delete handlers
This commit is contained in:
parent
df6701667e
commit
eac3fc3737
@ -330,9 +330,26 @@ bdb_attr_index_unparse( struct bdb_info *bdb, BerVarray *bva )
|
||||
avl_apply( bdb->bi_attrs, bdb_attr_index_unparser, bva, -1, AVL_INORDER );
|
||||
}
|
||||
|
||||
static void
|
||||
bdb_attrinfo_free( AttrInfo *ai )
|
||||
{
|
||||
#ifdef LDAP_COMP_MATCH
|
||||
free( ai->ai_cr );
|
||||
#endif
|
||||
free( ai );
|
||||
}
|
||||
|
||||
void
|
||||
bdb_attr_index_destroy( Avlnode *tree )
|
||||
{
|
||||
avl_free( tree, free );
|
||||
avl_free( tree, bdb_attrinfo_free );
|
||||
}
|
||||
|
||||
void bdb_attr_index_free( struct bdb_info *bdb, AttributeDescription *ad )
|
||||
{
|
||||
AttrInfo *ai;
|
||||
|
||||
ai = avl_delete( &bdb->bi_attrs, ad, ainfo_type_cmp );
|
||||
if ( ai )
|
||||
bdb_attrinfo_free( ai );
|
||||
}
|
||||
|
@ -221,7 +221,50 @@ bdb_cf_gen(ConfigArgs *c)
|
||||
break;
|
||||
}
|
||||
return rc;
|
||||
} else if ( c->op == LDAP_MOD_DELETE ) {
|
||||
rc = 0;
|
||||
switch( c->type ) {
|
||||
/* single-valued no-ops */
|
||||
case BDB_LOCKD:
|
||||
case BDB_SSTACK:
|
||||
break;
|
||||
|
||||
case BDB_CHKPT:
|
||||
/* FIXME: should stop the checkpoint task too */
|
||||
bdb->bi_txn_cp = 0;
|
||||
break;
|
||||
case BDB_CONFIG:
|
||||
rc = 1;
|
||||
/* FIXME: delete values or the whole file? */
|
||||
break;
|
||||
case BDB_DIRECTORY:
|
||||
rc = 1;
|
||||
/* FIXME: what does this mean? */
|
||||
break;
|
||||
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 ( ber_bvmatch( &bv, &defbv )) {
|
||||
bdb->bi_defaultmask = 0;
|
||||
} else {
|
||||
slap_bv2ad( &bv, &ad, &text );
|
||||
if ( ad )
|
||||
bdb_attr_index_free( bdb, ad );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
switch( c->type ) {
|
||||
case BDB_CHKPT:
|
||||
bdb->bi_txn_cp = 1;
|
||||
@ -282,6 +325,10 @@ bdb_cf_gen(ConfigArgs *c)
|
||||
bdb->bi_dbenv_xflags |= DB_TXN_NOSYNC;
|
||||
else
|
||||
bdb->bi_dbenv_xflags &= ~DB_TXN_NOSYNC;
|
||||
if ( bdb->bi_db_is_open ) {
|
||||
bdb->bi_dbenv->set_flags( bdb->bi_dbenv, DB_TXN_NOSYNC,
|
||||
c->value_int );
|
||||
}
|
||||
break;
|
||||
|
||||
case BDB_INDEX:
|
||||
@ -289,6 +336,9 @@ bdb_cf_gen(ConfigArgs *c)
|
||||
c->argc - 1, &c->argv[1] );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) return 1;
|
||||
/* FIXME: must run slapindex on the new attributes */
|
||||
if ( bdb->bi_db_is_open ) {
|
||||
}
|
||||
break;
|
||||
|
||||
case BDB_LOCKD:
|
||||
|
@ -33,6 +33,7 @@ LDAP_BEGIN_DECL
|
||||
#define bdb_attr_mask BDB_SYMBOL(attr_mask)
|
||||
#define bdb_attr_index_config BDB_SYMBOL(attr_index_config)
|
||||
#define bdb_attr_index_destroy BDB_SYMBOL(attr_index_destroy)
|
||||
#define bdb_attr_index_free BDB_SYMBOL(attr_index_free)
|
||||
#define bdb_attr_index_unparse BDB_SYMBOL(attr_index_unparse)
|
||||
|
||||
#ifdef LDAP_COMP_MATCH
|
||||
@ -57,6 +58,8 @@ int bdb_attr_index_config LDAP_P(( struct bdb_info *bdb,
|
||||
|
||||
void bdb_attr_index_unparse LDAP_P(( struct bdb_info *bdb, BerVarray *bva ));
|
||||
void bdb_attr_index_destroy LDAP_P(( Avlnode *tree ));
|
||||
void bdb_attr_index_free LDAP_P(( struct bdb_info *bdb,
|
||||
AttributeDescription *ad ));
|
||||
|
||||
/*
|
||||
* config.c
|
||||
|
Loading…
Reference in New Issue
Block a user