From: Pierangelo Masarati Date: Sat, 22 Dec 2001 12:28:02 +0000 (+0000) Subject: added hasSubordinates to back-monitor X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~580 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3824672c498dfabd1958176284e45125756276bd;p=openldap added hasSubordinates to back-monitor --- diff --git a/servers/slapd/back-monitor/Makefile.in b/servers/slapd/back-monitor/Makefile.in index cd77e57d41..7650495db3 100644 --- a/servers/slapd/back-monitor/Makefile.in +++ b/servers/slapd/back-monitor/Makefile.in @@ -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 diff --git a/servers/slapd/back-monitor/back-monitor.h b/servers/slapd/back-monitor/back-monitor.h index 97030eef49..7b5d71f5c4 100644 --- a/servers/slapd/back-monitor/back-monitor.h +++ b/servers/slapd/back-monitor/back-monitor.h @@ -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 * ); diff --git a/servers/slapd/back-monitor/external.h b/servers/slapd/back-monitor/external.h index 6cf06e84c2..a498bfcc8f 100644 --- a/servers/slapd/back-monitor/external.h +++ b/servers/slapd/back-monitor/external.h @@ -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 */ diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index de541088e7..db4713afb1 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -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 diff --git a/servers/slapd/back-monitor/operational.c b/servers/slapd/back-monitor/operational.c new file mode 100644 index 0000000000..46366905df --- /dev/null +++ b/servers/slapd/back-monitor/operational.c @@ -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 + +#include +#include + +#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; +} +