]> git.sur5r.net Git - openldap/commitdiff
ITS#5259 fix sasl_auxprop_store to allow cleanup after bindop is gone
authorHoward Chu <hyc@openldap.org>
Sat, 22 Dec 2007 22:53:58 +0000 (22:53 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 22 Dec 2007 22:53:58 +0000 (22:53 +0000)
servers/slapd/connection.c
servers/slapd/proto-slap.h
servers/slapd/sasl.c

index aedfff1fcec1532ceee8150bba66a467fff6b7a2..957662fde75bcd0d98cbf263d9f2c70ab6db3850 100644 (file)
@@ -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 ) {
index 214bdf8944421b556f07b2bb0d4ea627521a25b8..e3be75afbcbe27d1b9e6dac16a898c340e077f70 100644 (file)
@@ -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 *));
 
 /*
index 7a757872f6cf83a6de9493f4915a23cf1a2f3125..7c2314a6e5ed61420566f7bbc7f2ca10e3428737 100644 (file)
@@ -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;