2001-12-22 19:50:16 +08:00
|
|
|
/* operational.c - ldbm backend operational attributes function */
|
|
|
|
/*
|
2002-01-05 05:17:25 +08:00
|
|
|
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
2001-12-22 19:50:16 +08:00
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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(
|
|
|
|
BackendDB *be,
|
|
|
|
Connection *conn,
|
|
|
|
Operation *op,
|
|
|
|
Entry *e,
|
|
|
|
int *hasSubordinates )
|
|
|
|
{
|
|
|
|
if ( has_children( be, e ) ) {
|
|
|
|
*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(
|
|
|
|
BackendDB *be,
|
|
|
|
Connection *conn,
|
|
|
|
Operation *op,
|
|
|
|
Entry *e,
|
2001-12-31 19:35:52 +08:00
|
|
|
AttributeName *attrs,
|
2001-12-22 19:50:16 +08:00
|
|
|
int opattrs,
|
|
|
|
Attribute **a )
|
|
|
|
{
|
|
|
|
Attribute **aa = a;
|
|
|
|
|
|
|
|
assert( e );
|
|
|
|
|
|
|
|
if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) ) {
|
|
|
|
int hs;
|
|
|
|
|
|
|
|
hs = has_children( be, e );
|
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;
|
|
|
|
}
|
|
|
|
|