mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 23:59:34 -05:00
ITS#9871 slapo-ppolicy: use explicit backend in bind_response
This commit is contained in:
parent
5d985e0145
commit
4e3687cda3
1 changed files with 13 additions and 11 deletions
|
|
@ -1656,7 +1656,8 @@ free_pwd_history_list( pw_hist **l )
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct ppbind {
|
typedef struct ppbind {
|
||||||
slap_overinst *on;
|
pp_info *pi;
|
||||||
|
BackendDB *be;
|
||||||
int send_ctrl;
|
int send_ctrl;
|
||||||
int set_restrict;
|
int set_restrict;
|
||||||
LDAPControl **oldctrls;
|
LDAPControl **oldctrls;
|
||||||
|
|
@ -1706,8 +1707,7 @@ static int
|
||||||
ppolicy_bind_response( Operation *op, SlapReply *rs )
|
ppolicy_bind_response( Operation *op, SlapReply *rs )
|
||||||
{
|
{
|
||||||
ppbind *ppb = op->o_callback->sc_private;
|
ppbind *ppb = op->o_callback->sc_private;
|
||||||
slap_overinst *on = ppb->on;
|
pp_info *pi = ppb->pi;
|
||||||
pp_info *pi = on->on_bi.bi_private;
|
|
||||||
Modifications *mod = ppb->mod, *m;
|
Modifications *mod = ppb->mod, *m;
|
||||||
int pwExpired = 0;
|
int pwExpired = 0;
|
||||||
int ngut = -1, warn = -1, fc = 0, age, rc;
|
int ngut = -1, warn = -1, fc = 0, age, rc;
|
||||||
|
|
@ -1718,7 +1718,7 @@ ppolicy_bind_response( Operation *op, SlapReply *rs )
|
||||||
char nowstr[ LDAP_LUTIL_GENTIME_BUFSIZE ];
|
char nowstr[ LDAP_LUTIL_GENTIME_BUFSIZE ];
|
||||||
char nowstr_usec[ LDAP_LUTIL_GENTIME_BUFSIZE+8 ];
|
char nowstr_usec[ LDAP_LUTIL_GENTIME_BUFSIZE+8 ];
|
||||||
struct berval timestamp, timestamp_usec;
|
struct berval timestamp, timestamp_usec;
|
||||||
BackendInfo *bi = op->o_bd->bd_info;
|
BackendDB *be = op->o_bd;
|
||||||
LDAPControl *ctrl = NULL;
|
LDAPControl *ctrl = NULL;
|
||||||
Entry *e;
|
Entry *e;
|
||||||
|
|
||||||
|
|
@ -1728,9 +1728,9 @@ ppolicy_bind_response( Operation *op, SlapReply *rs )
|
||||||
goto locked;
|
goto locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
op->o_bd->bd_info = (BackendInfo *)on->on_info;
|
op->o_bd = ppb->be;
|
||||||
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 = be;
|
||||||
|
|
||||||
if ( rc != LDAP_SUCCESS ) {
|
if ( rc != LDAP_SUCCESS ) {
|
||||||
ldap_pvt_thread_mutex_unlock( &pi->pwdFailureTime_mutex );
|
ldap_pvt_thread_mutex_unlock( &pi->pwdFailureTime_mutex );
|
||||||
|
|
@ -2032,8 +2032,9 @@ check_expiring_password:
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
op->o_bd->bd_info = (BackendInfo *)on->on_info;
|
op->o_bd = ppb->be;
|
||||||
be_entry_release_r( op, e );
|
be_entry_release_r( op, e );
|
||||||
|
op->o_bd = be;
|
||||||
|
|
||||||
locked:
|
locked:
|
||||||
if ( mod && !pi->disable_write ) {
|
if ( mod && !pi->disable_write ) {
|
||||||
|
|
@ -2072,7 +2073,7 @@ locked:
|
||||||
op2.orm_no_opattrs = 1;
|
op2.orm_no_opattrs = 1;
|
||||||
op2.o_dont_replicate = 1;
|
op2.o_dont_replicate = 1;
|
||||||
}
|
}
|
||||||
op2.o_bd->bd_info = (BackendInfo *)on->on_info;
|
op2.o_bd = ppb->be;
|
||||||
}
|
}
|
||||||
rc = op2.o_bd->be_modify( &op2, &r2 );
|
rc = op2.o_bd->be_modify( &op2, &r2 );
|
||||||
if ( rc != LDAP_SUCCESS ) {
|
if ( rc != LDAP_SUCCESS ) {
|
||||||
|
|
@ -2103,7 +2104,6 @@ locked:
|
||||||
ppb->oldctrls = add_passcontrol( op, rs, ctrl );
|
ppb->oldctrls = add_passcontrol( op, rs, ctrl );
|
||||||
op->o_callback->sc_cleanup = ppolicy_ctrls_cleanup;
|
op->o_callback->sc_cleanup = ppolicy_ctrls_cleanup;
|
||||||
}
|
}
|
||||||
op->o_bd->bd_info = bi;
|
|
||||||
ldap_pvt_thread_mutex_unlock( &pi->pwdFailureTime_mutex );
|
ldap_pvt_thread_mutex_unlock( &pi->pwdFailureTime_mutex );
|
||||||
return SLAP_CB_CONTINUE;
|
return SLAP_CB_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
@ -2136,7 +2136,8 @@ ppolicy_bind( Operation *op, SlapReply *rs )
|
||||||
cb = op->o_tmpcalloc( sizeof(ppbind)+sizeof(slap_callback),
|
cb = op->o_tmpcalloc( sizeof(ppbind)+sizeof(slap_callback),
|
||||||
1, op->o_tmpmemctx );
|
1, op->o_tmpmemctx );
|
||||||
ppb = (ppbind *)(cb+1);
|
ppb = (ppbind *)(cb+1);
|
||||||
ppb->on = on;
|
ppb->pi = on->on_bi.bi_private;
|
||||||
|
ppb->be = op->o_bd->bd_self;
|
||||||
ppb->pErr = PP_noError;
|
ppb->pErr = PP_noError;
|
||||||
ppb->set_restrict = 1;
|
ppb->set_restrict = 1;
|
||||||
|
|
||||||
|
|
@ -2426,7 +2427,8 @@ ppolicy_compare(
|
||||||
cb = op->o_tmpcalloc( sizeof(ppbind)+sizeof(slap_callback),
|
cb = op->o_tmpcalloc( sizeof(ppbind)+sizeof(slap_callback),
|
||||||
1, op->o_tmpmemctx );
|
1, op->o_tmpmemctx );
|
||||||
ppb = (ppbind *)(cb+1);
|
ppb = (ppbind *)(cb+1);
|
||||||
ppb->on = on;
|
ppb->pi = on->on_bi.bi_private;
|
||||||
|
ppb->be = op->o_bd->bd_self;
|
||||||
ppb->pErr = PP_noError;
|
ppb->pErr = PP_noError;
|
||||||
ppb->send_ctrl = 1;
|
ppb->send_ctrl = 1;
|
||||||
/* failures here don't lockout the connection */
|
/* failures here don't lockout the connection */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue