added hasSubordinates to back-monitor

This commit is contained in:
Pierangelo Masarati 2001-12-22 12:28:02 +00:00
parent e36bde9180
commit 3824672c49
5 changed files with 72 additions and 4 deletions

View File

@ -1,13 +1,15 @@
# $OpenLDAP$
SRCS = init.c search.c compare.c abandon.c modify.c bind.c \
operational.c \
cache.c entry.c \
backend.c database.c thread.c conn.c rww.c log.c \
dummy.c
OBJS = init.o search.o compare.o abandon.o modify.o bind.o \
cache.o entry.o \
backend.o database.o thread.o conn.o rww.o log.o \
dummy.o
OBJS = init.lo search.lo compare.lo abandon.lo modify.lo bind.lo \
operational.lo \
cache.lo entry.lo \
backend.lo database.lo thread.lo conn.lo rww.lo log.lo \
dummy.lo
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries

View File

@ -161,6 +161,8 @@ struct monitorsubsys {
#define MONITOR_HAS_VOLATILE_CH( mp ) \
( ( mp )->mp_flags & MONITOR_F_VOLATILE_CH )
#define MONITOR_HAS_CHILDREN( mp ) \
( ( mp )->mp_children || MONITOR_HAS_VOLATILE_CH( mp ) )
/* initialize entry and subentries */
int ( *mss_init )( BackendDB * );

View File

@ -72,6 +72,10 @@ extern int monitor_back_bind LDAP_P(( BackendDB *bd,
const char *dn, const char *ndn, int method,
struct berval *cred, char** edn ));
extern int monitor_back_operational LDAP_P((BackendDB *bd,
Connection *conn, Operation *op,
Entry *e, char **attrs, int opattrs, Attribute **a ));
LDAP_END_DECL
#endif /* _MONITOR_EXTERNAL_H */

View File

@ -173,6 +173,7 @@ monitor_back_initialize(
bi->bi_acl_group = NULL;
bi->bi_acl_attribute = NULL;
bi->bi_chk_referrals = NULL;
bi->bi_operational = monitor_back_operational;
/*
* hooks for slap tools

View File

@ -0,0 +1,59 @@
/* operational.c - monitor backend operational attributes function */
/*
* Copyright 1998-2001 The OpenLDAP Foundation, All Rights Reserved.
* 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-monitor.h"
#include "proto-back-monitor.h"
/*
* sets the supported operational attributes (if required)
*/
int
monitor_back_operational(
BackendDB *be,
Connection *conn,
Operation *op,
Entry *e,
char **attrs,
int opattrs,
Attribute **a )
{
Attribute **aa = a;
assert( e );
if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) ) {
int hs;
struct monitorentrypriv *mp;
mp = ( struct monitorentrypriv * )e->e_private;
assert( mp );
hs = MONITOR_HAS_CHILDREN( mp );
*aa = ch_malloc( sizeof( Attribute ) );
(*aa)->a_desc = slap_schema.si_ad_hasSubordinates;
(*aa)->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
(*aa)->a_vals[0] = ber_bvstrdup( hs ? "TRUE" : "FALSE" );
(*aa)->a_vals[1] = NULL;
(*aa)->a_next = NULL;
aa = &(*aa)->a_next;
}
return 0;
}