Back to index

openldap  2.4.31
operational.c
Go to the documentation of this file.
00001 /* operational.c - monitor backend operational attributes function */
00002 /* $OpenLDAP$ */
00003 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00004  *
00005  * Copyright 2001-2012 The OpenLDAP Foundation.
00006  * Portions Copyright 2001-2003 Pierangelo Masarati.
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted only as authorized by the OpenLDAP
00011  * Public License.
00012  *
00013  * A copy of this license is available in file LICENSE in the
00014  * top-level directory of the distribution or, alternatively, at
00015  * <http://www.OpenLDAP.org/license.html>.
00016  */
00017 /* ACKNOWLEDGEMENTS:
00018  * This work was initially developed by Pierangelo Masarati for inclusion
00019  * in OpenLDAP Software.
00020  */
00021 
00022 #include "portable.h"
00023 
00024 #include <stdio.h>
00025 
00026 #include <ac/string.h>
00027 #include <ac/socket.h>
00028 
00029 #include "slap.h"
00030 #include "back-monitor.h"
00031 #include "proto-back-monitor.h"
00032 
00033 /*
00034  * sets the supported operational attributes (if required)
00035  */
00036 
00037 int
00038 monitor_back_operational(
00039        Operation     *op,
00040        SlapReply     *rs )
00041 {
00042        Attribute     **ap;
00043 
00044        assert( rs->sr_entry != NULL );
00045 
00046        for ( ap = &rs->sr_operational_attrs; *ap; ap = &(*ap)->a_next ) {
00047               if ( (*ap)->a_desc == slap_schema.si_ad_hasSubordinates ) {
00048                      break;
00049               }
00050        }
00051 
00052        if ( *ap == NULL &&
00053               attr_find( rs->sr_entry->e_attrs, slap_schema.si_ad_hasSubordinates ) == NULL &&
00054               ( SLAP_OPATTRS( rs->sr_attr_flags ) ||
00055                      ad_inlist( slap_schema.si_ad_hasSubordinates, rs->sr_attrs ) ) )
00056        {
00057               int                  hs;
00058               monitor_entry_t      *mp;
00059 
00060               mp = ( monitor_entry_t * )rs->sr_entry->e_private;
00061 
00062               assert( mp != NULL );
00063 
00064               hs = MONITOR_HAS_CHILDREN( mp );
00065               *ap = slap_operational_hasSubordinate( hs );
00066               assert( *ap != NULL );
00067               ap = &(*ap)->a_next;
00068        }
00069        
00070        return LDAP_SUCCESS;
00071 }
00072