/* operational.c - bdb backend operational attributes function */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2000-2004 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
*/
#include "portable.h"
#include "slap.h"
#include "back-bdb.h"
-#include "proto-bdb.h"
+#include "external.h"
/*
* sets *hasSubordinates to LDAP_COMPARE_TRUE/LDAP_COMPARE_FALSE
*/
int
bdb_hasSubordinates(
- BackendDB *be,
- Connection *conn,
Operation *op,
Entry *e,
int *hasSubordinates )
{
- struct bdb_info *bdb = (struct bdb_info *) be->be_private;
int rc;
assert( e );
- assert( hasSubordinates );
retry:
- rc = bdb_dn2id_children( be, NULL, &e->e_nname, 0 );
+ rc = bdb_cache_children( op, NULL, e );
switch( rc ) {
case DB_LOCK_DEADLOCK:
*/
int
bdb_operational(
- BackendDB *be,
- Connection *conn,
Operation *op,
- Entry *e,
- AttributeName *attrs,
+ SlapReply *rs,
int opattrs,
Attribute **a )
{
Attribute **aa = a;
- int rc = 0;
- assert( e );
+ assert( rs->sr_entry );
- if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) ) {
+ if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, rs->sr_attrs ) ) {
int hasSubordinates;
- rc = bdb_hasSubordinates( be, conn, op, e, &hasSubordinates );
- if ( rc == LDAP_SUCCESS ) {
+ rs->sr_err = bdb_hasSubordinates( op, rs->sr_entry, &hasSubordinates );
+ if ( rs->sr_err == LDAP_SUCCESS ) {
*aa = slap_operational_hasSubordinate( hasSubordinates == LDAP_COMPARE_TRUE );
if ( *aa != NULL ) {
aa = &(*aa)->a_next;
}
}
- return rc;
+ return rs->sr_err;
}