1 /* OpenLDAP WiredTiger backend */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2002-2017 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>.
17 * This work was developed by HAMANO Tsukasa <hamano@osstech.co.jp>
18 * based on back-bdb for inclusion in OpenLDAP Software.
19 * WiredTiger is a product of MongoDB Inc.
25 #include <ac/string.h>
34 int *hasSubordinates )
36 struct wt_info *wi = (struct wt_info *) op->o_bd->be_private;
42 wc = wt_ctx_get(op, wi);
44 Debug( LDAP_DEBUG_ANY,
45 LDAP_XSTRING(wt_compare)
46 ": wt_ctx_get failed\n",
51 rc = wt_dn2id_has_children(op, wc->session, e->e_id);
54 *hasSubordinates = LDAP_COMPARE_TRUE;
57 *hasSubordinates = LDAP_COMPARE_FALSE;
62 "<=- " LDAP_XSTRING(wt_hasSubordinates)
63 ": has_children failed: %s (%d)\n",
64 wiredtiger_strerror(rc), rc, 0 );
71 * sets the supported operational attributes (if required)
80 assert( rs->sr_entry != NULL );
82 for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next ) {
83 if ( (*ap)->a_desc == slap_schema.si_ad_hasSubordinates ) {
89 attr_find( rs->sr_entry->e_attrs, slap_schema.si_ad_hasSubordinates ) == NULL &&
90 ( SLAP_OPATTRS( rs->sr_attr_flags ) ||
91 ad_inlist( slap_schema.si_ad_hasSubordinates, rs->sr_attrs ) ) )
93 int hasSubordinates, rc;
95 rc = wt_hasSubordinates( op, rs->sr_entry, &hasSubordinates );
96 if ( rc == LDAP_SUCCESS ) {
97 *ap = slap_operational_hasSubordinate( hasSubordinates == LDAP_COMPARE_TRUE );
98 assert( *ap != NULL );
109 * indent-tabs-mode: t