From: Ondrej Kuznik Date: Mon, 23 Apr 2012 14:58:20 +0000 (+0200) Subject: ITS#7256 A few issues discovered during testing slapmodify. X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=01f698bce979660270207ce052f3bdbbd79365a5;p=openldap ITS#7256 A few issues discovered during testing slapmodify. - bdb deallocates cursor after some tool operations but expects it to be around every time it is called - mdb tries to allocate a second transaction while it already holds one, deadlocking - op->o_hdr must exist for most uses of op, but o_tmpmfuncs need not - what about indexing after a tool modify? Does it happen automatically? --- diff --git a/servers/slapd/back-bdb/tools.c b/servers/slapd/back-bdb/tools.c index 91facca824..c0ce3a2cf8 100644 --- a/servers/slapd/back-bdb/tools.c +++ b/servers/slapd/back-bdb/tools.c @@ -747,6 +747,15 @@ done: e->e_id = NOID; } + if ( cursor == NULL ) + { + int rc = bdb->bi_id2entry->bdi_db->cursor( + bdb->bi_id2entry->bdi_db, bdb->bi_cache.c_txn, &cursor, + bdb->bi_db_opflags ); + if ( rc != 0 ) + e->e_id = NOID; + } + return e->e_id; } @@ -982,6 +991,15 @@ done: e->e_id = NOID; } + if ( cursor == NULL ) + { + int rc = bdb->bi_id2entry->bdi_db->cursor( + bdb->bi_id2entry->bdi_db, bdb->bi_cache.c_txn, &cursor, + bdb->bi_db_opflags ); + if ( rc != 0 ) + e->e_id = NOID; + } + return e->e_id; } diff --git a/servers/slapd/back-mdb/id2entry.c b/servers/slapd/back-mdb/id2entry.c index 77a25a6daa..a430618147 100644 --- a/servers/slapd/back-mdb/id2entry.c +++ b/servers/slapd/back-mdb/id2entry.c @@ -245,7 +245,7 @@ int mdb_entry_return( if ( !e ) return 0; if ( e->e_private ) { - if ( op->o_hdr ) { + if ( op->o_hdr && op->o_tmpmfuncs ) { op->o_tmpfree( e->e_nname.bv_val, op->o_tmpmemctx ); op->o_tmpfree( e->e_name.bv_val, op->o_tmpmemctx ); op->o_tmpfree( e, op->o_tmpmemctx );