- /* entry does not exist - see how much of the dn does exist */
- /* dn_parent checks returns NULL if dn is suffix */
- if ( (pdn = dn_parent( be, dn )) != NULL ) {
- /* get entry with reader lock */
- if ( (e = dn2entry_r( be, pdn, matched )) != NULL ) {
- *matched = e;
+ 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_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) {
+ EntryInfo *ei2;
+ diskNode *d = (diskNode *)j;
+ short nrlen;
+
+ AC_MEMCPY( &ei.bei_id, &d->entryID, sizeof(ID) );
+ AC_MEMCPY( &nrlen, &d->nrdnlen, sizeof(d->nrdnlen) );
+ ei.bei_nrdn.bv_len = nrlen;
+ /* nrdn/rdn are set in-place.
+ * hdb_cache_load will copy them as needed
+ */
+ ei.bei_nrdn.bv_val = d->nrdn;
+ ei.bei_rdn.bv_len = len - sizeof(diskNode) - ei.bei_nrdn.bv_len;
+ ei.bei_rdn.bv_val = d->nrdn + ei.bei_nrdn.bv_len + 1;
+ bdb_idl_insert( cx->tmp, ei.bei_id );
+ hdb_cache_load( cx->bdb, &ei, &ei2 );
+ }
+ }
+ }
+ cx->rc = cx->dbc->c_close( cx->dbc );
+ } else {
+ /* The in-memory cache is in sync with the on-disk data.
+ * do we have any kids?
+ */
+ cx->rc = 0;
+ if ( cx->ei->bei_ckids > 0 ) {
+
+ /* Walk the kids tree; order is irrelevant since bdb_idl_insert
+ * will insert in sorted order.
+ */
+ avl_apply( cx->ei->bei_kids, apply_func, cx->tmp, -1, AVL_POSTORDER );