struct berval *dn,
int prefix,
ID *ids,
+ ID *stack,
void *ctx )
{
int rc;
ID id;
ID dbuf;
ID *ids;
+ void *ptr;
ID tmp[BDB_IDL_DB_SIZE];
+ ID *buf;
DBT key;
DBT data;
DBC *dbc;
if ( cx->rc ) return cx->rc;
BDB_IDL_ZERO( cx->tmp );
+ cx->data.data = &cx->dbuf;
+ cx->data.ulen = sizeof(ID);
+ cx->data.dlen = sizeof(ID);
+ cx->data.flags = DB_DBT_USERMEM | DB_DBT_PARTIAL;
+
/* The first item holds the parent ID. Ignore it. */
cx->rc = cx->dbc->c_get( cx->dbc, &cx->key, &cx->data, DB_SET );
if ( cx->rc == DB_NOTFOUND ) goto saveit;
if ( cx->rc ) return cx->rc;
+ cx->data.data = cx->buf;
+ cx->data.ulen = BDB_IDL_UM_SIZE * sizeof(ID);
+ cx->data.flags = DB_DBT_USERMEM;
+
/* Fetch the rest of the IDs in a loop... */
while ( (cx->rc = cx->dbc->c_get( cx->dbc, &cx->key, &cx->data,
- DB_NEXT_DUP )) == 0 ) {
- bdb_idl_insert( cx->tmp, cx->dbuf );
+ DB_MULTIPLE | DB_NEXT_DUP )) == 0 ) {
+ u_int8_t *j;
+ size_t len;
+ DB_MULTIPLE_INIT( cx->ptr, &cx->data );
+ while (cx->ptr) {
+ DB_MULTIPLE_NEXT( cx->ptr, &cx->data, j, len );
+ if (j) {
+ AC_MEMCPY( &cx->dbuf, j, sizeof(ID) );
+ bdb_idl_insert( cx->tmp, cx->dbuf );
+ }
+ }
}
cx->dbc->c_close( cx->dbc );
struct berval *dn,
int prefix,
ID *ids,
+ ID *stack,
void *ctx )
{
struct dn2id_cookie cx;
+ EntryInfo *ei = (EntryInfo *)dn;
- cx.id = *(ID *)dn;
+#ifndef BDB_MULTIPLE_SUFFIXES
+ if ( ei->bei_parent->bei_id == 0 ) {
+ struct bdb_info *bdb = (struct bdb_info *)be->be_private;
+ BDB_IDL_ALL( bdb, ids );
+ return 0;
+ }
+#endif
+ cx.id = ei->bei_id;
cx.bdb = (struct bdb_info *)be->be_private;
cx.db = cx.bdb->bi_dn2id->bdi_db;
cx.prefix = prefix;
cx.ids = ids;
+ cx.buf = stack;
cx.ctx = ctx;
BDB_IDL_ZERO( ids );
cx.key.flags = DB_DBT_USERMEM;
DBTzero(&cx.data);
- cx.data.data = &cx.dbuf;
- cx.data.ulen = sizeof(ID);
- cx.data.dlen = sizeof(ID);
- cx.data.flags = DB_DBT_USERMEM | DB_DBT_PARTIAL;
return bdb_dn2idl_internal(&cx);
}
Debug( LDAP_DEBUG_FILTER, "\tDN ONE\n", 0, 0, 0 );
#endif
rc = bdb_dn2idl( op->o_bd, f->f_dn, DN_ONE_PREFIX, ids,
- op->o_tmpmemctx );
+ stack, op->o_tmpmemctx );
if( rc == DB_NOTFOUND ) {
BDB_IDL_ZERO( ids );
rc = 0;
Debug( LDAP_DEBUG_FILTER, "\tDN SUBTREE\n", 0, 0, 0 );
#endif
rc = bdb_dn2idl( op->o_bd, f->f_dn, DN_SUBTREE_PREFIX, ids,
- op->o_tmpmemctx );
+ stack, op->o_tmpmemctx );
break;
case LDAP_FILTER_PRESENT:
* we should never see the ID of an entry that doesn't exist.
* Set the name so that the scope's IDL can be retrieved.
*/
-#ifndef BDB_HIER
ei = NULL;
rs->sr_err = bdb_cache_find_entry_id(op->o_bd, NULL, ido, &ei,
0, locker, &locka, op->o_tmpmemctx );
if (rs->sr_err != LDAP_SUCCESS) goto nextido;
e = ei->bei_e;
+#ifndef BDB_HIER
sf->f_dn = &e->e_nname;
#else
/* bdb_dn2idl uses IDs for keys, not DNs */
- sf->f_dn = (struct berval *)&ido;
+ sf->f_dn = (struct berval *)ei;
#endif
}
return rs->sr_err;
/* Copy info to base, must free entry before accessing the database
* in search_candidates, to avoid deadlocks.
*/
+ base.e_private = e->e_private;
base.e_nname = realbase;
base.e_id = e->e_id;
? SLAPD_FILTER_DN_SUBTREE
: SLAPD_FILTER_DN_ONE;
#ifdef BDB_HIER
- scopef.f_dn = (struct berval *)&e->e_id;
+ scopef.f_dn = (struct berval *)e->e_private;
#else
scopef.f_dn = &e->e_nname;
#endif