1 /* id2children.c - routines to deal with the id2children index */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2003 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
12 * A copy of this license is available in the file LICENSE in the
13 * top-level directory of the distribution or, alternatively, at
14 * <http://www.OpenLDAP.org/license.html>.
20 #include <ac/string.h>
22 #include <ac/socket.h>
25 #include "back-ldbm.h"
38 ldbm_datum_init( key );
41 LDAP_LOG( INDEX, ENTRY, "has_children: enter %ld\n", p->e_id, 0, 0 );
43 Debug( LDAP_DEBUG_TRACE, "=> has_children( %ld )\n", p->e_id , 0, 0 );
47 if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX,
48 LDBM_WRCREAT )) == NULL ) {
51 "has_children: could not open \"dn2id%s\"\n", LDBM_SUFFIX, 0, 0 );
53 Debug( LDAP_DEBUG_ANY,
54 "<= has_children -1 could not open \"dn2id%s\"\n",
61 key.dsize = strlen( p->e_ndn ) + 2;
62 key.dptr = ch_malloc( key.dsize );
63 sprintf( key.dptr, "%c%s", DN_ONE_PREFIX, p->e_ndn );
65 idl = idl_fetch( be, db, key );
69 ldbm_cache_close( be, db );
77 LDAP_LOG( INDEX, ENTRY,
78 "has_children: id (%ld) %s children.\n",
79 p->e_id, rc ? "has" : "doesn't have", 0 );
81 Debug( LDAP_DEBUG_TRACE, "<= has_children( %ld ): %s\n",
82 p->e_id, rc ? "yes" : "no", 0 );