1 /* id2children.c - routines to deal with the id2children index */
4 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
11 #include <ac/string.h>
13 #include <ac/socket.h>
16 #include "back-ldbm.h"
30 ldbm_datum_init( key );
33 LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
34 "has_children: enter %ld\n", p->e_id ));
36 Debug( LDAP_DEBUG_TRACE, "=> has_children( %ld )\n", p->e_id , 0, 0 );
40 if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX,
41 LDBM_WRCREAT )) == NULL ) {
43 LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
44 "has_children: could not open \"dn2id%s\"\n",
47 Debug( LDAP_DEBUG_ANY,
48 "<= has_children -1 could not open \"dn2id%s\"\n",
55 key.dsize = strlen( p->e_ndn ) + 2;
56 key.dptr = ch_malloc( key.dsize );
57 sprintf( key.dptr, "%c%s", DN_ONE_PREFIX, p->e_ndn );
59 idl = idl_fetch( be, db, key );
63 ldbm_cache_close( be, db );
71 LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
72 "has_children: id (%ld) %s children.\n",
73 p->e_id, rc ? "has" : "doesn't have" ));
75 Debug( LDAP_DEBUG_TRACE, "<= has_children( %ld ): %s\n",
76 p->e_id, rc ? "yes" : "no", 0 );