]> git.sur5r.net Git - openldap/commitdiff
added hasSubordinates to back-monitor
authorPierangelo Masarati <ando@openldap.org>
Sat, 22 Dec 2001 12:28:02 +0000 (12:28 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 22 Dec 2001 12:28:02 +0000 (12:28 +0000)
servers/slapd/back-monitor/Makefile.in
servers/slapd/back-monitor/back-monitor.h
servers/slapd/back-monitor/external.h
servers/slapd/back-monitor/init.c
servers/slapd/back-monitor/operational.c [new file with mode: 0644]

index cd77e57d4186644809ea0f1a98d0c4e015a37578..7650495db395d991b9202e9f7eedf942359d196a 100644 (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
index 97030eef499691b8ba24689a3de6273cc0e39b80..7b5d71f5c4242c40ec8e99c138e6d79991ad6d49 100644 (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 * );
index 6cf06e84c23616dc858503e2726b08b3e829bb51..a498bfcc8fe1051a21930e5e168eb7d1a22a9937 100644 (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 */
index de541088e71b35652d5260240d145a0d7a3b1912..db4713afb1a2cc6e47e0534dbea0920f86114f95 100644 (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
diff --git a/servers/slapd/back-monitor/operational.c b/servers/slapd/back-monitor/operational.c
new file mode 100644 (file)
index 0000000..4636690
--- /dev/null
@@ -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;
+}
+