]> git.sur5r.net Git - openldap/blob - servers/slapd/back-monitor/operational.c
46366905dfc8d8b9769130d10037e024c745010d
[openldap] / servers / slapd / back-monitor / operational.c
1 /* operational.c - monitor backend operational attributes function */
2 /*
3  * Copyright 1998-2001 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6
7 #include "portable.h"
8
9 #include <stdio.h>
10
11 #include <ac/string.h>
12 #include <ac/socket.h>
13
14 #include "slap.h"
15 #include "back-monitor.h"
16 #include "proto-back-monitor.h"
17
18 /*
19  * sets the supported operational attributes (if required)
20  */
21
22 int
23 monitor_back_operational(
24         BackendDB       *be,
25         Connection      *conn, 
26         Operation       *op,
27         Entry           *e,
28         char            **attrs,
29         int             opattrs,
30         Attribute       **a )
31 {
32         Attribute       **aa = a;
33
34         assert( e );
35
36         if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) ) {
37                 int                     hs;
38                 struct monitorentrypriv *mp;
39
40                 mp = ( struct monitorentrypriv * )e->e_private;
41
42                 assert( mp );
43
44                 hs = MONITOR_HAS_CHILDREN( mp );
45
46                 *aa = ch_malloc( sizeof( Attribute ) );
47                 (*aa)->a_desc = slap_schema.si_ad_hasSubordinates;
48
49                 (*aa)->a_vals = ch_malloc( 2 * sizeof( struct berval * ) );
50                 (*aa)->a_vals[0] = ber_bvstrdup( hs ? "TRUE" : "FALSE" );
51                 (*aa)->a_vals[1] = NULL;
52
53                 (*aa)->a_next = NULL;
54                 aa = &(*aa)->a_next;
55         }
56         
57         return 0;
58 }
59