From 1c476b302ed786a4be3a0c7264a2a936f18fe038 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 25 Aug 2011 14:47:23 -0700 Subject: [PATCH] ITS#6983 fix duplicate entry in HDB subtree IDL --- servers/slapd/back-bdb/dn2id.c | 1 + servers/slapd/back-bdb/idl.c | 2 +- servers/slapd/back-bdb/proto-bdb.h | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index afa2164214..9625443c14 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -945,6 +945,7 @@ hdb_dn2idl_internal( cx->rc = bdb_idl_cache_get(cx->bdb, cx->db, &cx->key, ids); if ( cx->rc == LDAP_SUCCESS ) { if ( cx->depth ) { + bdb_idl_delete( cx->tmp, cx->id ); /* ITS#6983, drop our own ID */ bdb_idl_append( cx->ids, cx->tmp ); cx->need_sort = 1; } diff --git a/servers/slapd/back-bdb/idl.c b/servers/slapd/back-bdb/idl.c index e9a415a43f..853a88c3dd 100644 --- a/servers/slapd/back-bdb/idl.c +++ b/servers/slapd/back-bdb/idl.c @@ -219,7 +219,7 @@ int bdb_idl_insert( ID *ids, ID id ) return 0; } -static int bdb_idl_delete( ID *ids, ID id ) +int bdb_idl_delete( ID *ids, ID id ) { unsigned x; diff --git a/servers/slapd/back-bdb/proto-bdb.h b/servers/slapd/back-bdb/proto-bdb.h index f0070775d2..87b0a85c63 100644 --- a/servers/slapd/back-bdb/proto-bdb.h +++ b/servers/slapd/back-bdb/proto-bdb.h @@ -281,6 +281,7 @@ bdb_idl_cache_del_id( #define bdb_idl_next BDB_SYMBOL(idl_next) #define bdb_idl_search BDB_SYMBOL(idl_search) #define bdb_idl_insert BDB_SYMBOL(idl_insert) +#define bdb_idl_delete BDB_SYMBOL(idl_delete) #define bdb_idl_intersection BDB_SYMBOL(idl_intersection) #define bdb_idl_union BDB_SYMBOL(idl_union) #define bdb_idl_sort BDB_SYMBOL(idl_sort) @@ -303,6 +304,7 @@ int bdb_idl_fetch_key( int get_flag ); int bdb_idl_insert( ID *ids, ID id ); +int bdb_idl_delete( ID *ids, ID id ); int bdb_idl_insert_key( BackendDB *be, -- 2.39.5