2001-12-22 19:50:16 +08:00
|
|
|
/* operational.c - ldbm backend operational attributes function */
|
2003-11-29 05:08:20 +08:00
|
|
|
/* $OpenLDAP$ */
|
|
|
|
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
*
|
|
|
|
* Copyright 1998-2003 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>.
|
2001-12-22 19:50:16 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "portable.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <ac/string.h>
|
|
|
|
#include <ac/socket.h>
|
|
|
|
|
|
|
|
#include "slap.h"
|
|
|
|
#include "back-ldbm.h"
|
|
|
|
#include "proto-back-ldbm.h"
|
|
|
|
|
|
|
|
/*
|
2002-10-27 00:18:31 +08:00
|
|
|
* sets *hasSubordinates to LDAP_COMPARE_TRUE/LDAP_COMPARE_FALSE
|
|
|
|
* if the entry has children or not.
|
2001-12-22 19:50:16 +08:00
|
|
|
*/
|
2002-10-27 00:18:31 +08:00
|
|
|
int
|
|
|
|
ldbm_back_hasSubordinates(
|
|
|
|
Operation *op,
|
|
|
|
Entry *e,
|
|
|
|
int *hasSubordinates )
|
|
|
|
{
|
2003-03-30 17:03:54 +08:00
|
|
|
if ( has_children( op->o_bd, e ) ) {
|
2002-10-27 00:18:31 +08:00
|
|
|
*hasSubordinates = LDAP_COMPARE_TRUE;
|
2001-12-22 19:50:16 +08:00
|
|
|
|
2002-10-27 00:18:31 +08:00
|
|
|
} else {
|
|
|
|
*hasSubordinates = LDAP_COMPARE_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sets the supported operational attributes (if required)
|
|
|
|
*/
|
2001-12-22 19:50:16 +08:00
|
|
|
int
|
|
|
|
ldbm_back_operational(
|
|
|
|
Operation *op,
|
2003-03-30 17:03:54 +08:00
|
|
|
SlapReply *rs,
|
2001-12-22 19:50:16 +08:00
|
|
|
int opattrs,
|
|
|
|
Attribute **a )
|
|
|
|
{
|
|
|
|
Attribute **aa = a;
|
|
|
|
|
2003-03-30 17:03:54 +08:00
|
|
|
assert( rs->sr_entry );
|
2001-12-22 19:50:16 +08:00
|
|
|
|
2003-03-30 17:03:54 +08:00
|
|
|
if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, rs->sr_attrs ) ) {
|
2001-12-22 19:50:16 +08:00
|
|
|
int hs;
|
|
|
|
|
2003-03-30 17:03:54 +08:00
|
|
|
hs = has_children( op->o_bd, rs->sr_entry );
|
2001-12-22 22:24:13 +08:00
|
|
|
*aa = slap_operational_hasSubordinate( hs );
|
|
|
|
if ( *aa != NULL ) {
|
|
|
|
aa = &(*aa)->a_next;
|
|
|
|
}
|
2001-12-22 19:50:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|