]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-monitor/time.c
plug more one-time leaks; rearrange subsystems setup
[openldap] / servers / slapd / back-monitor / time.c
index c7820d311ce5ba8c1ba5cfd17f434577d87f33e1..61273a6839763d4f10120c274576b6bad75a4d4a 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2001-2004 The OpenLDAP Foundation.
+ * Copyright 2001-2005 The OpenLDAP Foundation.
  * Portions Copyright 2001-2003 Pierangelo Masarati.
  * All rights reserved.
  *
 #include "proto-slap.h"
 #include "back-monitor.h"
 
+static int
+monitor_subsys_time_update(
+       Operation               *op,
+       SlapReply               *rs,
+       Entry                   *e );
+
 int
 monitor_subsys_time_init(
        BackendDB               *be,
-       monitor_subsys_t        *ms
-)
+       monitor_subsys_t        *ms )
 {
        monitor_info_t  *mi;
        
@@ -45,6 +50,8 @@ monitor_subsys_time_init(
 
        assert( be != NULL );
 
+       ms->mss_update = monitor_subsys_time_update;
+
        mi = ( monitor_info_t * )be->be_private;
 
        if ( monitor_cache_get( mi,
@@ -166,18 +173,18 @@ monitor_subsys_time_init(
        return( 0 );
 }
 
-int
+static int
 monitor_subsys_time_update(
        Operation               *op,
-       Entry                   *e
-)
+       SlapReply               *rs,
+       Entry                   *e )
 {
        monitor_info_t          *mi = ( monitor_info_t * )op->o_bd->be_private;
        static struct berval    bv_current = BER_BVC( "cn=current" );
        struct berval           rdn;
 
-       assert( mi );
-       assert( e );
+       assert( mi != NULL );
+       assert( e != NULL );
 
        dnRdn( &e->e_nname, &rdn );
        
@@ -219,13 +226,15 @@ monitor_subsys_time_update(
 
                a = attr_find( e->e_attrs, mi->mi_ad_monitorTimestamp );
                if ( a == NULL ) {
-                       return( -1 );
+                       return rs->sr_err = LDAP_OTHER;
                }
 
                assert( len == a->a_vals[ 0 ].bv_len );
                AC_MEMCPY( a->a_vals[ 0 ].bv_val, tmbuf, len );
+
+               /* FIXME: touch modifyTimestamp? */
        }
 
-       return( 0 );
+       return SLAP_CB_CONTINUE;
 }