Commit 64e1cdfc authored by Howard Chu's avatar Howard Chu Committed by Quanah Gibson-Mount
Browse files

ITS#9302 fix pwdFailireTime mutex scope

parent c4396517
...@@ -56,6 +56,7 @@ typedef struct pp_info { ...@@ -56,6 +56,7 @@ typedef struct pp_info {
int hash_passwords; /* transparently hash cleartext pwds */ int hash_passwords; /* transparently hash cleartext pwds */
int forward_updates; /* use frontend for policy state updates */ int forward_updates; /* use frontend for policy state updates */
int send_netscape_controls; /* send netscape password controls */ int send_netscape_controls; /* send netscape password controls */
ldap_pvt_thread_mutex_t pwdFailureTime_mutex;
} pp_info; } pp_info;
/* Our per-connection info - note, it is not per-instance, it is /* Our per-connection info - note, it is not per-instance, it is
...@@ -211,7 +212,6 @@ static struct schema_info pwd_UsSchema[] = { ...@@ -211,7 +212,6 @@ static struct schema_info pwd_UsSchema[] = {
}; };
static ldap_pvt_thread_mutex_t chk_syntax_mutex; static ldap_pvt_thread_mutex_t chk_syntax_mutex;
static ldap_pvt_thread_mutex_t pwdFailureTime_mutex;
enum { enum {
PPOLICY_DEFAULT = 1, PPOLICY_DEFAULT = 1,
...@@ -1000,13 +1000,13 @@ ppolicy_bind_response( Operation *op, SlapReply *rs ) ...@@ -1000,13 +1000,13 @@ ppolicy_bind_response( Operation *op, SlapReply *rs )
goto locked; goto locked;
} }
ldap_pvt_thread_mutex_lock( &pwdFailureTime_mutex ); ldap_pvt_thread_mutex_lock( &pi->pwdFailureTime_mutex );
op->o_bd->bd_info = (BackendInfo *)on->on_info; op->o_bd->bd_info = (BackendInfo *)on->on_info;
rc = be_entry_get_rw( op, &op->o_req_ndn, NULL, NULL, 0, &e ); rc = be_entry_get_rw( op, &op->o_req_ndn, NULL, NULL, 0, &e );
op->o_bd->bd_info = bi; op->o_bd->bd_info = bi;
if ( rc != LDAP_SUCCESS ) { if ( rc != LDAP_SUCCESS ) {
ldap_pvt_thread_mutex_unlock( &pwdFailureTime_mutex ); ldap_pvt_thread_mutex_unlock( &pi->pwdFailureTime_mutex );
return SLAP_CB_CONTINUE; return SLAP_CB_CONTINUE;
} }
...@@ -1330,7 +1330,7 @@ locked: ...@@ -1330,7 +1330,7 @@ locked:
op->o_callback->sc_cleanup = ppolicy_ctrls_cleanup; op->o_callback->sc_cleanup = ppolicy_ctrls_cleanup;
} }
op->o_bd->bd_info = bi; op->o_bd->bd_info = bi;
ldap_pvt_thread_mutex_unlock( &pwdFailureTime_mutex ); ldap_pvt_thread_mutex_unlock( &pi->pwdFailureTime_mutex );
return SLAP_CB_CONTINUE; return SLAP_CB_CONTINUE;
} }
...@@ -2423,6 +2423,7 @@ ppolicy_db_init( ...@@ -2423,6 +2423,7 @@ ppolicy_db_init(
) )
{ {
slap_overinst *on = (slap_overinst *) be->bd_info; slap_overinst *on = (slap_overinst *) be->bd_info;
pp_info *pi;
if ( SLAP_ISGLOBALOVERLAY( be ) ) { if ( SLAP_ISGLOBALOVERLAY( be ) ) {
/* do not allow slapo-ppolicy to be global by now (ITS#5858) */ /* do not allow slapo-ppolicy to be global by now (ITS#5858) */
...@@ -2467,7 +2468,7 @@ ppolicy_db_init( ...@@ -2467,7 +2468,7 @@ ppolicy_db_init(
} }
} }
on->on_bi.bi_private = ch_calloc( sizeof(pp_info), 1 ); pi = on->on_bi.bi_private = ch_calloc( sizeof(pp_info), 1 );
if ( !pwcons ) { if ( !pwcons ) {
/* accommodate for c_conn_idx == -1 */ /* accommodate for c_conn_idx == -1 */
...@@ -2477,7 +2478,7 @@ ppolicy_db_init( ...@@ -2477,7 +2478,7 @@ ppolicy_db_init(
ov_count++; ov_count++;
ldap_pvt_thread_mutex_init( &pwdFailureTime_mutex ); ldap_pvt_thread_mutex_init( &pi->pwdFailureTime_mutex );
return 0; return 0;
} }
...@@ -2514,6 +2515,7 @@ ppolicy_db_destroy( ...@@ -2514,6 +2515,7 @@ ppolicy_db_destroy(
pp_info *pi = on->on_bi.bi_private; pp_info *pi = on->on_bi.bi_private;
on->on_bi.bi_private = NULL; on->on_bi.bi_private = NULL;
ldap_pvt_thread_mutex_destroy( &pi->pwdFailureTime_mutex );
free( pi->def_policy.bv_val ); free( pi->def_policy.bv_val );
free( pi ); free( pi );
...@@ -2524,7 +2526,6 @@ ppolicy_db_destroy( ...@@ -2524,7 +2526,6 @@ ppolicy_db_destroy(
pwc--; pwc--;
ch_free( pwc ); ch_free( pwc );
} }
ldap_pvt_thread_mutex_destroy( &pwdFailureTime_mutex );
return 0; return 0;
} }
......
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