Commit d3e8c0c7 authored by Ondrej Kuznik's avatar Ondrej Kuznik Committed by Quanah Gibson-Mount
Browse files

ITS#7182 Maintain the operation counts.

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.
parent 76f281a3
......@@ -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 );
......
......@@ -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:
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment