From: Pierangelo Masarati Date: Sat, 6 Dec 2003 10:54:10 +0000 (+0000) Subject: changes required to use rwm overlay X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~266 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=723bc044e05900ef9d77fc0e543281275da62f30;p=openldap changes required to use rwm overlay --- diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index d0929c5dc8..71729665e7 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -205,6 +205,7 @@ rwm_search( Operation *op, SlapReply *rs ) return rc; } + /* TODO: rewrite/map filter & attrs */ return SLAP_CB_CONTINUE; } @@ -223,6 +224,7 @@ rwm_extended( Operation *op, SlapReply *rs ) return rc; } + /* TODO: rewrite/map extended data ? ... */ return 0; } @@ -324,6 +326,9 @@ rwm_send_entry( Operation *op, SlapReply *rs ) e->e_nname = ndn; rs->sr_entry = e; + + /* TODO: map entry attribute types, objectclasses + * and dn-valued attribute values */ return SLAP_CB_CONTINUE; diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 07b8d2d904..fcf1b137e4 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -254,7 +254,7 @@ send_ldap_response( if (op->o_callback && op->o_callback->sc_response) { rc = op->o_callback->sc_response( op, rs ); - if ( rc != SLAP_CB_CONTINUE ) return; + if ( rc != SLAP_CB_CONTINUE ) goto cleanup; } #ifdef LDAP_CONNECTIONLESS @@ -370,7 +370,7 @@ send_ldap_response( if (!op->o_conn || op->o_conn->c_is_udp == 0) #endif ber_free_buf( ber ); - return; + goto cleanup; } /* send BER */ @@ -391,7 +391,7 @@ send_ldap_response( 0, 0, 0 ); #endif - return; + goto cleanup; } #ifdef LDAP_SLAPI @@ -406,6 +406,13 @@ send_ldap_response( num_bytes_sent += bytes; num_pdu_sent++; ldap_pvt_thread_mutex_unlock( &num_sent_mutex ); + +cleanup:; + if ( rs->sr_matched && rs->sr_flags & REP_MATCHED_MUSTBEFREED ) { + free( rs->sr_matched ); + rs->sr_matched = NULL; + } + return; } @@ -656,7 +663,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs ) rs->sr_type = REP_SEARCH; if (op->o_callback && op->o_callback->sc_response) { rc = op->o_callback->sc_response( op, rs ); - if ( rc != SLAP_CB_CONTINUE ) return rc; + if ( rc != SLAP_CB_CONTINUE ) goto error_return; } #ifdef NEW_LOGGING @@ -682,8 +689,8 @@ slap_send_search_entry( Operation *op, SlapReply *rs ) 0, 0, 0 ); #endif - sl_release( mark, op->o_tmpmemctx ); - return( 1 ); + rc = 1; + goto error_return; } edn = rs->sr_entry->e_nname.bv_val; @@ -1171,8 +1178,8 @@ slap_send_search_entry( Operation *op, SlapReply *rs ) if ( op->o_res_ber == NULL ) ber_free_buf( ber ); send_ldap_error( op, rs, LDAP_OTHER, "encode entry end error" ); - sl_release( mark, op->o_tmpmemctx ); - return( 1 ); + rc = 1; + goto error_return; } if ( op->o_res_ber == NULL ) { @@ -1190,8 +1197,8 @@ slap_send_search_entry( Operation *op, SlapReply *rs ) 0, 0, 0 ); #endif - sl_release( mark, op->o_tmpmemctx ); - return -1; + rc = -1; + goto error_return; } rs->sr_nentries++; @@ -1215,8 +1222,18 @@ slap_send_search_entry( Operation *op, SlapReply *rs ) rc = 0; error_return:; + if ( op->o_tag == LDAP_REQ_SEARCH && rs->sr_type == REP_SEARCH + && rs->sr_entry + && (rs->sr_flags & REP_ENTRY_MUSTBEFREED) ) + { + entry_free( rs->sr_entry ); + rs->sr_entry = NULL; + rs->sr_flags &= ~REP_ENTRY_MUSTBEFREED; + } + sl_release( mark, op->o_tmpmemctx ); if ( e_flags ) sl_free( e_flags, op->o_tmpmemctx ); + return( rc ); } diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 2805efd2b9..f7b663f027 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1629,6 +1629,10 @@ typedef struct slap_rep { rep_extended_s sru_extended; rep_search_s sru_search; } sr_un; + slap_mask_t sr_flags; +#define REP_ENTRY_MODIFIABLE 0x00000001 +#define REP_ENTRY_MUSTBEFREED 0x00000002 +#define REP_MATCHED_MUSTBEFREED 0x00000010 } SlapReply; /* short hands for response members */