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-2006 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 );
40 Debug( LDAP_DEBUG_TRACE, "=> has_children( %ld )\n", p->e_id , 0, 0 );
43 if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX,
44 LDBM_WRCREAT )) == NULL ) {
45 Debug( LDAP_DEBUG_ANY,
46 "<= has_children -1 could not open \"dn2id%s\"\n",
52 key.dsize = strlen( p->e_ndn ) + 2;
53 key.dptr = ch_malloc( key.dsize );
54 sprintf( key.dptr, "%c%s", DN_ONE_PREFIX, p->e_ndn );
56 idl = idl_fetch( be, db, key );
60 ldbm_cache_close( be, db );
67 Debug( LDAP_DEBUG_TRACE, "<= has_children( %ld ): %s\n",
68 p->e_id, rc ? "yes" : "no", 0 );