]> git.sur5r.net Git - openldap/blob - servers/slapd/back-monitor/operational.c
f174eecda8cddb3c89c556d82ae73bb7c2c7651d
[openldap] / servers / slapd / back-monitor / operational.c
1 /* operational.c - monitor backend operational attributes function */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 1998-2003 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16 /* ACKNOWLEDGEMENTS:
17  * This work was initially developed by Pierangelo Masarati for inclusion
18  * in OpenLDAP Software.
19  */
20
21 #include "portable.h"
22
23 #include <stdio.h>
24
25 #include <ac/string.h>
26 #include <ac/socket.h>
27
28 #include "slap.h"
29 #include "back-monitor.h"
30 #include "proto-back-monitor.h"
31
32 /*
33  * sets the supported operational attributes (if required)
34  */
35
36 int
37 monitor_back_operational(
38         Operation       *op,
39         SlapReply       *rs,
40         int             opattrs,
41         Attribute       **a )
42 {
43         Attribute       **aa = a;
44
45         assert( rs->sr_entry );
46
47         if ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates,
48                                 rs->sr_attrs ) ) {
49                 int                     hs;
50                 struct monitorentrypriv *mp;
51
52                 mp = ( struct monitorentrypriv * )rs->sr_entry->e_private;
53
54                 assert( mp );
55
56                 hs = MONITOR_HAS_CHILDREN( mp );
57                 *aa = slap_operational_hasSubordinate( hs );
58                 if ( *aa != NULL ) {
59                         aa = &(*aa)->a_next;
60                 }
61         }
62         
63         return 0;
64 }
65