From: Howard Chu Date: Sat, 22 Dec 2007 22:53:58 +0000 (+0000) Subject: ITS#5259 fix sasl_auxprop_store to allow cleanup after bindop is gone X-Git-Tag: OPENLDAP_REL_ENG_2_4_9~20^2~279 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d0eac819f7937c934c86f763650d65217e0802b0;p=openldap ITS#5259 fix sasl_auxprop_store to allow cleanup after bindop is gone --- diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index aedfff1fce..957662fde7 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -1895,6 +1895,27 @@ connection_fake_init( connection_fake_init2( conn, opbuf, ctx, 1 ); } +void +operation_fake_init( + Connection *conn, + Operation *op, + void *ctx, + int newmem ) +{ + /* set memory context */ + op->o_tmpmemctx = slap_sl_mem_create(SLAP_SLAB_SIZE, SLAP_SLAB_STACK, ctx, + newmem ); + op->o_tmpmfuncs = &slap_sl_mfuncs; + op->o_threadctx = ctx; + op->o_tid = ldap_pvt_thread_pool_tid( ctx ); + + op->o_counters = &slap_counters; + op->o_conn = conn; + op->o_connid = op->o_conn->c_connid; + connection_init_log_prefix( op ); +} + + void connection_fake_init2( Connection *conn, @@ -1917,17 +1938,7 @@ connection_fake_init2( op->o_hdr = &opbuf->ob_hdr; op->o_controls = opbuf->ob_controls; - /* set memory context */ - op->o_tmpmemctx = slap_sl_mem_create(SLAP_SLAB_SIZE, SLAP_SLAB_STACK, ctx, - newmem ); - op->o_tmpmfuncs = &slap_sl_mfuncs; - op->o_threadctx = ctx; - op->o_tid = ldap_pvt_thread_pool_tid( ctx ); - - op->o_counters = &slap_counters; - op->o_conn = conn; - op->o_connid = op->o_conn->c_connid; - connection_init_log_prefix( op ); + operation_fake_init( conn, op, ctx, newmem ); #ifdef LDAP_SLAPI if ( slapi_plugins_used ) { diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 214bdf8944..e3be75afbc 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -756,6 +756,11 @@ LDAP_SLAPD_F (void) connection_fake_init2 LDAP_P(( OperationBuffer *opbuf, void *threadctx, int newmem )); +LDAP_SLAPD_F (void) operation_fake_init LDAP_P(( + Connection *conn, + Operation *op, + void *threadctx, + int newmem )); LDAP_SLAPD_F (void) connection_assign_nextid LDAP_P((Connection *)); /* diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index 7a757872f6..7c2314a6e5 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -406,6 +406,7 @@ slap_auxprop_store( unsigned ulen) { Operation op = {0}; + Opheader oph; SlapReply rs = {REP_RESULT}; int rc, i, j; Connection *conn = NULL; @@ -476,7 +477,13 @@ slap_auxprop_store( &text, textbuf, textlen ); if ( rc == LDAP_SUCCESS ) { - op.o_hdr = conn->c_sasl_bindop->o_hdr; + if ( conn->c_sasl_bindop ) { + op.o_hdr = conn->c_sasl_bindop->o_hdr; + } else { + op.o_hdr = &oph; + memset( &oph, 0, sizeof(oph) ); + operation_fake_init( conn, &op, ldap_pvt_thread_pool_context(), 0 ); + } op.o_tag = LDAP_REQ_MODIFY; op.o_ndn = op.o_req_ndn; op.o_callback = &cb;