Home | History | Annotate | Line # | Download | only in back-monitor
operational.c revision 1.1.1.2
      1 /*	$NetBSD: operational.c,v 1.1.1.2 2010/03/08 02:14:20 lukem Exp $	*/
      2 
      3 /* operational.c - monitor backend operational attributes function */
      4 /* OpenLDAP: pkg/ldap/servers/slapd/back-monitor/operational.c,v 1.17.2.5 2009/01/22 00:01:08 kurt Exp */
      5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
      6  *
      7  * Copyright 2001-2009 The OpenLDAP Foundation.
      8  * Portions Copyright 2001-2003 Pierangelo Masarati.
      9  * All rights reserved.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted only as authorized by the OpenLDAP
     13  * Public License.
     14  *
     15  * A copy of this license is available in file LICENSE in the
     16  * top-level directory of the distribution or, alternatively, at
     17  * <http://www.OpenLDAP.org/license.html>.
     18  */
     19 /* ACKNOWLEDGEMENTS:
     20  * This work was initially developed by Pierangelo Masarati for inclusion
     21  * in OpenLDAP Software.
     22  */
     23 
     24 #include "portable.h"
     25 
     26 #include <stdio.h>
     27 
     28 #include <ac/string.h>
     29 #include <ac/socket.h>
     30 
     31 #include "slap.h"
     32 #include "back-monitor.h"
     33 #include "proto-back-monitor.h"
     34 
     35 /*
     36  * sets the supported operational attributes (if required)
     37  */
     38 
     39 int
     40 monitor_back_operational(
     41 	Operation	*op,
     42 	SlapReply	*rs )
     43 {
     44 	Attribute	**ap;
     45 
     46 	assert( rs->sr_entry != NULL );
     47 
     48 	for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next )
     49 		/* just count */ ;
     50 
     51 	if ( SLAP_OPATTRS( rs->sr_attr_flags ) ||
     52 			ad_inlist( slap_schema.si_ad_hasSubordinates, rs->sr_attrs ) )
     53 	{
     54 		int			hs;
     55 		monitor_entry_t	*mp;
     56 
     57 		mp = ( monitor_entry_t * )rs->sr_entry->e_private;
     58 
     59 		assert( mp != NULL );
     60 
     61 		hs = MONITOR_HAS_CHILDREN( mp );
     62 		*ap = slap_operational_hasSubordinate( hs );
     63 		assert( *ap != NULL );
     64 		ap = &(*ap)->a_next;
     65 	}
     66 
     67 	return LDAP_SUCCESS;
     68 }
     69 
     70