1 /* $NetBSD: operational.c,v 1.1.1.4 2014/05/28 09:58:50 tron Exp $ */ 2 3 /* operational.c - monitor backend operational attributes function */ 4 /* $OpenLDAP$ */ 5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>. 6 * 7 * Copyright 2001-2014 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 if ( (*ap)->a_desc == slap_schema.si_ad_hasSubordinates ) { 50 break; 51 } 52 } 53 54 if ( *ap == NULL && 55 attr_find( rs->sr_entry->e_attrs, slap_schema.si_ad_hasSubordinates ) == NULL && 56 ( SLAP_OPATTRS( rs->sr_attr_flags ) || 57 ad_inlist( slap_schema.si_ad_hasSubordinates, rs->sr_attrs ) ) ) 58 { 59 int hs; 60 monitor_entry_t *mp; 61 62 mp = ( monitor_entry_t * )rs->sr_entry->e_private; 63 64 assert( mp != NULL ); 65 66 hs = MONITOR_HAS_CHILDREN( mp ); 67 *ap = slap_operational_hasSubordinate( hs ); 68 assert( *ap != NULL ); 69 ap = &(*ap)->a_next; 70 } 71 72 return LDAP_SUCCESS; 73 } 74 75