]> git.sur5r.net Git - openldap/commitdiff
ITS#7182 Maintain the operation counts.
authorOndrej Kuznik <ondrej.kuznik@acision.com>
Wed, 8 Feb 2012 13:18:29 +0000 (14:18 +0100)
committerHoward Chu <hyc@openldap.org>
Tue, 27 Mar 2012 11:28:37 +0000 (04:28 -0700)
Currently ldap_back_default_rebind cannot access the ldapinfo structure.
Being a configurable callback, not letting it monitor when a change
might be disruptive feels safer.

servers/slapd/back-ldap/add.c
servers/slapd/back-ldap/bind.c
servers/slapd/back-ldap/compare.c
servers/slapd/back-ldap/delete.c
servers/slapd/back-ldap/extended.c
servers/slapd/back-ldap/modify.c
servers/slapd/back-ldap/modrdn.c
servers/slapd/back-ldap/search.c

index 513db86165c21c61e77fc5f611b01ba87f9b37dc..cb240523218da122a14a904f0544d5d467bf8022 100644 (file)
@@ -113,6 +113,10 @@ retry:
                }
        }
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_ADD ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
 cleanup:
        (void)ldap_back_controls_free( op, rs, &ctrls );
 
index 5be6976a544dbefdd07ed6001936f2bb78a54362..03c54e473f0c3b64aa75c9f7501234cee3afff84 100644 (file)
@@ -275,6 +275,10 @@ retry:;
                }
        }
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_BIND ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
        ldap_back_controls_free( op, rs, &ctrls );
 
        if ( rc == LDAP_SUCCESS ) {
@@ -1461,6 +1465,10 @@ retry_lock:;
                                LDAP_SASL_QUIET, lutil_sasl_interact,
                                defaults );
 
+               ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+               ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_BIND ], 1 );
+               ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
                lutil_sasl_freedefs( defaults );
 
                switch ( rs->sr_err ) {
@@ -1510,6 +1518,10 @@ retry:;
                        LDAP_SASL_SIMPLE, &lc->lc_cred,
                        NULL, NULL, &msgid );
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_BIND ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
        if ( rs->sr_err == LDAP_SERVER_DOWN ) {
                if ( retries != LDAP_BACK_RETRY_NEVER ) {
                        if ( dolock ) {
@@ -1634,6 +1646,8 @@ ldap_back_default_rebind( LDAP *ld, LDAP_CONST char *url, ber_tag_t request,
 #endif /* HAVE_TLS */
 
        /* FIXME: add checks on the URL/identity? */
+       /* TODO: would like to count this bind operation for monitoring
+        * too, but where do we get the ldapinfo_t? */
 
        return ldap_sasl_bind_s( ld,
                        BER_BVISNULL( &lc->lc_cred ) ? "" : lc->lc_bound_ndn.bv_val,
@@ -2323,6 +2337,10 @@ ldap_back_proxy_authz_bind(
                        }
                } while ( rs->sr_err == LDAP_SASL_BIND_IN_PROGRESS );
 
+               ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+               ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_BIND ], 1 );
+               ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
                switch ( rs->sr_err ) {
                case LDAP_SUCCESS:
 #ifdef SLAP_AUTH_DN
@@ -2430,6 +2448,10 @@ ldap_back_proxy_authz_bind(
                                bindcred, NULL, NULL, &msgid );
                rc = ldap_back_op_result( lc, op, rs, msgid,
                        -1, ( sendok | LDAP_BACK_BINDING ) );
+
+               ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+               ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_BIND ], 1 );
+               ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
                break;
 
        default:
index 151edeb8a627e49fccdd9d07bdc5a3744157a5f1..a4747373d9e7139a4d7a680cf07040127b8a5d78 100644 (file)
@@ -73,6 +73,10 @@ retry:
                }
        }
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_COMPARE ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
 cleanup:
        (void)ldap_back_controls_free( op, rs, &ctrls );
        
index 4d5c231dbba1346aa4c1320bbb1e60e11aad91aa..eb04d8f88b61e2d5db1c39f47a44e933ead75704 100644 (file)
@@ -71,6 +71,10 @@ retry:
                }
        }
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_DELETE ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
 cleanup:
        (void)ldap_back_controls_free( op, rs, &ctrls );
 
index 574a545c3cc3c91d0f05d9a6a59be9703969635d..b96ddc03679dcd8cde4bbbc16c06d38f09abbea3 100644 (file)
@@ -264,6 +264,10 @@ retry:
                ldap_back_quarantine( op, rs );
        }
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_EXTENDED ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
        if ( freedn ) {
                op->o_tmpfree( dn.bv_val, op->o_tmpmemctx );
                op->o_tmpfree( ndn.bv_val, op->o_tmpmemctx );
@@ -377,6 +381,10 @@ retry:
                ldap_back_quarantine( op, rs );
        }
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_EXTENDED ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
        /* these have to be freed anyway... */
        if ( rs->sr_matched ) {
                free( (char *)rs->sr_matched );
index 7012c227baebea34014df5c5225c112dd11c9486..e2dccea0f5644910bafe8f0302eff873c7b9b838 100644 (file)
@@ -120,6 +120,10 @@ retry:;
                }
        }
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_MODIFY ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
 cleanup:;
        (void)ldap_back_controls_free( op, rs, &ctrls );
 
index 34e38e435653f9a548edb056d74e3f56fc76e32e..a4c99fcc535966284f994b3b6dda6f8261292605 100644 (file)
@@ -104,6 +104,10 @@ retry:
                }
        }
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_MODRDN ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
 cleanup:
        (void)ldap_back_controls_free( op, rs, &ctrls );
 
index 22aa5c23c20e8a7702affe6098455b74e1d87d62..d2d2080c8639f075947dfcfb5e3a4bacf086674a 100644 (file)
@@ -236,6 +236,10 @@ retry:
                        tv.tv_sec ? &tv : NULL,
                        op->ors_slimit, op->ors_deref, &msgid );
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_SEARCH ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
        if ( rs->sr_err != LDAP_SUCCESS ) {
                switch ( rs->sr_err ) {
                case LDAP_SERVER_DOWN: