ITS#5309: Use ldap_pvt_thread_pool_setkey_x() in slap_passwd_check() and

be_rootdn_bind() - push/pop any old value instead of resetting it.
This commit is contained in:
Hallvard Furuseth 2008-01-07 20:08:22 +00:00
parent 4a2cda3cff
commit d0a379ed45
2 changed files with 12 additions and 6 deletions

View File

@ -795,6 +795,9 @@ int
be_rootdn_bind( Operation *op, SlapReply *rs ) be_rootdn_bind( Operation *op, SlapReply *rs )
{ {
int rc; int rc;
#ifdef SLAPD_SPASSWD
void *old_authctx = NULL;
#endif
assert( op->o_tag == LDAP_REQ_BIND ); assert( op->o_tag == LDAP_REQ_BIND );
assert( op->orb_method == LDAP_AUTH_SIMPLE ); assert( op->orb_method == LDAP_AUTH_SIMPLE );
@ -819,14 +822,15 @@ be_rootdn_bind( Operation *op, SlapReply *rs )
} }
#ifdef SLAPD_SPASSWD #ifdef SLAPD_SPASSWD
ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind, ldap_pvt_thread_pool_setkey_x( op->o_threadctx, slap_sasl_bind,
op->o_conn->c_sasl_authctx, NULL ); op->o_conn->c_sasl_authctx, NULL, &old_authctx, NULL );
#endif #endif
rc = lutil_passwd( &op->o_bd->be_rootpw, &op->orb_cred, NULL, NULL ); rc = lutil_passwd( &op->o_bd->be_rootpw, &op->orb_cred, NULL, NULL );
#ifdef SLAPD_SPASSWD #ifdef SLAPD_SPASSWD
ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind, NULL, NULL ); ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind,
old_authctx, NULL );
#endif #endif
rc = ( rc == 0 ? LDAP_SUCCESS : LDAP_INVALID_CREDENTIALS ); rc = ( rc == 0 ? LDAP_SUCCESS : LDAP_INVALID_CREDENTIALS );

View File

@ -505,8 +505,10 @@ slap_passwd_check(
AccessControlState acl_state = ACL_STATE_INIT; AccessControlState acl_state = ACL_STATE_INIT;
#ifdef SLAPD_SPASSWD #ifdef SLAPD_SPASSWD
ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind, void *old_authctx = NULL;
op->o_conn->c_sasl_authctx, NULL );
ldap_pvt_thread_pool_setkey_x( op->o_threadctx, slap_sasl_bind,
op->o_conn->c_sasl_authctx, NULL, &old_authctx, NULL );
#endif #endif
for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) { for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) {
@ -525,7 +527,7 @@ slap_passwd_check(
#ifdef SLAPD_SPASSWD #ifdef SLAPD_SPASSWD
ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind, ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind,
NULL, NULL ); old_authctx, NULL );
#endif #endif
return result; return result;