From: Howard Chu Date: Tue, 7 Oct 2008 22:16:15 +0000 (+0000) Subject: ITS#5729 check for NULL bei_parent X-Git-Tag: ACLCHECK_0~1281 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=95d472aa9830a031821f2c6274aff38aa4eb0990;p=openldap ITS#5729 check for NULL bei_parent --- diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index ec1d70c69a..a358fe0d66 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -613,10 +613,12 @@ hdb_dn2id_add( tmp[1] = eip->bei_id; *ptr = DN_ONE_PREFIX; bdb_idl_cache_add_id( bdb, db, &key, e->e_id ); - *ptr = DN_SUBTREE_PREFIX; - for (; eip && eip->bei_parent->bei_id; eip = eip->bei_parent) { - tmp[1] = eip->bei_id; - bdb_idl_cache_add_id( bdb, db, &key, e->e_id ); + if ( eip->bei_parent ) { + *ptr = DN_SUBTREE_PREFIX; + for (; eip && eip->bei_parent->bei_id; eip = eip->bei_parent) { + tmp[1] = eip->bei_id; + bdb_idl_cache_add_id( bdb, db, &key, e->e_id ); + } } } @@ -710,10 +712,12 @@ func_leave: tmp[1] = eip->bei_id; *ptr = DN_ONE_PREFIX; bdb_idl_cache_del_id( bdb, db, &key, e->e_id ); - *ptr = DN_SUBTREE_PREFIX; - for (; eip && eip->bei_parent->bei_id; eip = eip->bei_parent) { - tmp[1] = eip->bei_id; - bdb_idl_cache_del_id( bdb, db, &key, e->e_id ); + if ( eip ->bei_parent ) { + *ptr = DN_SUBTREE_PREFIX; + for (; eip && eip->bei_parent->bei_id; eip = eip->bei_parent) { + tmp[1] = eip->bei_id; + bdb_idl_cache_del_id( bdb, db, &key, e->e_id ); + } } } Debug( LDAP_DEBUG_TRACE, "<= hdb_dn2id_delete 0x%lx: %d\n", e->e_id, rc, 0 );