From d0a379ed45ba2a65d21ef04bb17d7b82fb86dbf8 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Mon, 7 Jan 2008 20:08:22 +0000 Subject: [PATCH] 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. --- servers/slapd/backend.c | 10 +++++++--- servers/slapd/passwd.c | 8 +++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 3eb2a679d4..e29d2ba8b8 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -795,6 +795,9 @@ int be_rootdn_bind( Operation *op, SlapReply *rs ) { int rc; +#ifdef SLAPD_SPASSWD + void *old_authctx = NULL; +#endif assert( op->o_tag == LDAP_REQ_BIND ); assert( op->orb_method == LDAP_AUTH_SIMPLE ); @@ -819,14 +822,15 @@ be_rootdn_bind( Operation *op, SlapReply *rs ) } #ifdef SLAPD_SPASSWD - ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind, - 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 rc = lutil_passwd( &op->o_bd->be_rootpw, &op->orb_cred, NULL, NULL ); #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 rc = ( rc == 0 ? LDAP_SUCCESS : LDAP_INVALID_CREDENTIALS ); diff --git a/servers/slapd/passwd.c b/servers/slapd/passwd.c index 7444b179c2..a722ef9d7c 100644 --- a/servers/slapd/passwd.c +++ b/servers/slapd/passwd.c @@ -505,8 +505,10 @@ slap_passwd_check( AccessControlState acl_state = ACL_STATE_INIT; #ifdef SLAPD_SPASSWD - ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind, - op->o_conn->c_sasl_authctx, NULL ); + void *old_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 for ( bv = a->a_vals; bv->bv_val != NULL; bv++ ) { @@ -525,7 +527,7 @@ slap_passwd_check( #ifdef SLAPD_SPASSWD ldap_pvt_thread_pool_setkey( op->o_threadctx, slap_sasl_bind, - NULL, NULL ); + old_authctx, NULL ); #endif return result; -- 2.39.5