]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/result.c
Fix prev commit, overlay config was broken
[openldap] / servers / slapd / result.c
index f2ef04cb35665bb4b38ae7d2ba9970c9d2f81278..f1abb5110b8970cc2a1af9b83cdd7adf807beb4b 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -453,7 +453,7 @@ send_ldap_response(
 
        ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex );
        ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 );
-       ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, bytes );
+       ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, (unsigned long)bytes );
        ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex );
 
 cleanup:;
@@ -465,20 +465,18 @@ cleanup:;
 clean2:;
        if ( op->o_callback ) {
                int             first = 1;
-               slap_callback   *sc = op->o_callback,
-                               *sc_next = op->o_callback;
+               slap_callback   *sc = op->o_callback, *sc_next;
 
                for ( sc_next = op->o_callback; sc_next; op->o_callback = sc_next) {
                        sc_next = op->o_callback->sc_next;
                        if ( op->o_callback->sc_cleanup ) {
                                (void)op->o_callback->sc_cleanup( op, rs );
-                               if ( first && op->o_callback == NULL ) {
-                                       sc = NULL;
+                               if ( first && op->o_callback != sc ) {
+                                       sc = op->o_callback;
                                }
                        }
                        first = 0;
                }
-
                op->o_callback = sc;
        }
 
@@ -581,7 +579,7 @@ slap_send_ldap_result( Operation *op, SlapReply *rs )
         * should just set SLAPI_RESULT_CODE rather than sending a
         * result if they wish to change the result.
         */
-       if ( op->o_pb != NULL ) {
+       if ( op->o_callback == NULL && op->o_pb != NULL ) {
                slapi_int_pblock_set_operation( op->o_pb, op );
                slapi_pblock_set( op->o_pb, SLAPI_RESULT_CODE,
                        (void *)rs->sr_err );
@@ -1180,7 +1178,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
                rs->sr_nentries++;
 
                ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex );
-               ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, bytes );
+               ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, (unsigned long)bytes );
                ldap_pvt_mp_add_ulong( slap_counters.sc_entries, 1 );
                ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 );
                ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex );
@@ -1197,20 +1195,18 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
 error_return:;
        if ( op->o_callback ) {
                int             first = 1;
-               slap_callback   *sc = op->o_callback,
-                               *sc_next = op->o_callback;
+               slap_callback   *sc = op->o_callback, *sc_next;
 
                for ( sc_next = op->o_callback; sc_next; op->o_callback = sc_next) {
                        sc_next = op->o_callback->sc_next;
                        if ( op->o_callback->sc_cleanup ) {
                                (void)op->o_callback->sc_cleanup( op, rs );
-                               if ( first && op->o_callback == NULL ) {
-                                       sc = NULL;
+                               if ( first && op->o_callback != sc ) {
+                                       sc = op->o_callback;
                                }
                        }
                        first = 0;
                }
-
                op->o_callback = sc;
        }
 
@@ -1369,7 +1365,7 @@ slap_send_search_reference( Operation *op, SlapReply *rs )
        ber_free_buf( ber );
 
        ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex );
-       ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, bytes );
+       ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, (unsigned long)bytes );
        ldap_pvt_mp_add_ulong( slap_counters.sc_refs, 1 );
        ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 );
        ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex );
@@ -1386,20 +1382,18 @@ slap_send_search_reference( Operation *op, SlapReply *rs )
 rel:
        if ( op->o_callback ) {
                int             first = 1;
-               slap_callback   *sc = op->o_callback,
-                               *sc_next = op->o_callback;
+               slap_callback   *sc = op->o_callback, *sc_next;
 
                for ( sc_next = op->o_callback; sc_next; op->o_callback = sc_next) {
                        sc_next = op->o_callback->sc_next;
                        if ( op->o_callback->sc_cleanup ) {
                                (void)op->o_callback->sc_cleanup( op, rs );
-                               if ( first && op->o_callback == NULL ) {
-                                       sc = NULL;
+                               if ( first && op->o_callback != sc ) {
+                                       sc = op->o_callback;
                                }
                        }
                        first = 0;
                }
-
                op->o_callback = sc;
        }
 
@@ -1510,7 +1504,7 @@ int slap_read_controls(
                *ctrl = (LDAPControl *) slap_sl_calloc( 1, sizeof(LDAPControl), NULL );
        } else {
                /* retry: free previous try */
-               slap_sl_free( (*ctrl)->ldctl_value.bv_val, &op->o_tmpmemctx );
+               slap_sl_free( (*ctrl)->ldctl_value.bv_val, op->o_tmpmemctx );
        }
 
        **ctrl = c;