]> git.sur5r.net Git - openldap/commitdiff
changes required to use rwm overlay
authorPierangelo Masarati <ando@openldap.org>
Sat, 6 Dec 2003 10:54:10 +0000 (10:54 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 6 Dec 2003 10:54:10 +0000 (10:54 +0000)
servers/slapd/overlays/rwm.c
servers/slapd/result.c
servers/slapd/slap.h

index d0929c5dc838d268ccd8fc7d44134b67aff9a357..71729665e72e7b701b523fd73ebdb34aad5d47e2 100644 (file)
@@ -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;
 
index 07b8d2d904e85903dcf497ac7bcc51e908ee5efb..fcf1b137e4f51044e44228da62841c297b697d35 100644 (file)
@@ -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 );
 }
 
index 2805efd2b9861241a84e4b978ffc5c937432fe24..f7b663f0273bed51fa9b6cf401abc17cecf3b18d 100644 (file)
@@ -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 */