]> git.sur5r.net Git - openldap/commitdiff
work around syncprov interoperation issues; minor cleanup
authorPierangelo Masarati <ando@openldap.org>
Wed, 1 Jun 2005 19:35:13 +0000 (19:35 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 1 Jun 2005 19:35:13 +0000 (19:35 +0000)
12 files changed:
servers/slapd/back-sql/add.c
servers/slapd/back-sql/bind.c
servers/slapd/back-sql/compare.c
servers/slapd/back-sql/delete.c
servers/slapd/back-sql/entry-id.c
servers/slapd/back-sql/init.c
servers/slapd/back-sql/modify.c
servers/slapd/back-sql/modrdn.c
servers/slapd/back-sql/proto-sql.h
servers/slapd/back-sql/rdbms_depend/pgsql/backsql_drop.sql
servers/slapd/back-sql/rdbms_depend/pgsql/testdb_drop.sql
servers/slapd/back-sql/search.c

index d080b75f96072c45039c8a03c495fd377aa414e8..cd2b5a6131f437b7497eecfa9532245ea964dc5a 100644 (file)
@@ -1494,7 +1494,7 @@ done:;
        }
 
        if ( !BER_BVISNULL( &p.e_nname ) ) {
-               entry_clean( &p );
+               backsql_entry_clean( op, &p );
        }
 
        Debug( LDAP_DEBUG_TRACE, "<==backsql_add(\"%s\"): %d \"%s\"\n",
index 5817d06af60eaaa9b1fc0dea4fd214ef3385a267..0bc12e5a24c7475f2dfdb53407c06f647258487d 100644 (file)
@@ -106,7 +106,7 @@ error_return:;
        }
 
        if ( !BER_BVISNULL( &e.e_nname ) ) {
-               entry_clean( &e );
+               backsql_entry_clean( op, &e );
        }
 
        if ( bsi.bsi_attrs != NULL ) {
index 4783714f148bd393ec4e1f429d5c9d1822911dc0..9baf9ff35d66d3cf016a40c0f3c240e12d61d579 100644 (file)
@@ -181,7 +181,7 @@ return_results:;
        }
 
        if ( !BER_BVISNULL( &e.e_nname ) ) {
-               entry_clean( &e );
+               backsql_entry_clean( op, &e );
        }
 
        if ( bsi.bsi_attrs != NULL ) {
index 5659541268adaae12a36f7d5779f72bf3deb0f09..e8bf7142c67983d7553822e750e2c3a47a7af888 100644 (file)
@@ -474,11 +474,11 @@ done:;
        }
 
        if ( !BER_BVISNULL( &d.e_nname ) ) {
-               entry_clean( &d );
+               backsql_entry_clean( op, &d );
        }
 
        if ( !BER_BVISNULL( &p.e_nname ) ) {
-               entry_clean( &p );
+               backsql_entry_clean( op, &p );
        }
 
        return rs->sr_err;
index 49d3346c7e5715d73f6dc1741ae93f60c057a98b..87aba87a7d1cda1109106c8c3de7474a248bef52 100644 (file)
@@ -862,7 +862,7 @@ backsql_id2entry( backsql_srch_info *bsi, backsql_entryID *eid )
                        &bsi->bsi_oc->bom_oc->soc_cname,
                        bsi->bsi_op->o_tmpmemctx );
        if ( rc != LDAP_SUCCESS ) {
-               entry_clean( bsi->bsi_e );
+               backsql_entry_clean( op, bsi->bsi_e );
                return rc;
        }
 
@@ -966,7 +966,7 @@ next:;
                                        "structural_class() failed %d (%s)\n",
                                        bsi->bsi_e->e_name.bv_val,
                                        rc, text ? text : "" );
-                               entry_clean( bsi->bsi_e );
+                               backsql_entry_clean( op, bsi->bsi_e );
                                return rc;
                        }
 
@@ -977,7 +977,7 @@ next:;
                                        "to entry\n",
                                        bsi->bsi_e->e_name.bv_val, soc.bv_val,
                                        bsi->bsi_oc->bom_oc->soc_cname.bv_val );
-                               entry_clean( bsi->bsi_e );
+                               backsql_entry_clean( op, bsi->bsi_e );
                                return rc;
                        }
                }
@@ -987,7 +987,7 @@ next:;
                                &bsi->bsi_oc->bom_oc->soc_cname,
                                bsi->bsi_op->o_tmpmemctx );
                if ( rc != LDAP_SUCCESS ) {
-                       entry_clean( bsi->bsi_e );
+                       backsql_entry_clean( op, bsi->bsi_e );
                        return rc;
                }
        }
index f3e744fe4bc1e698cf7aa06272407a0e05ec051f..cf0bebf73b95282f32b40d805184a295731892b3 100644 (file)
@@ -74,6 +74,7 @@ sql_back_initialize(
        bi->bi_chk_referrals = 0;
        bi->bi_operational = backsql_operational;
        bi->bi_entry_get_rw = backsql_entry_get;
+       bi->bi_entry_release_rw = backsql_entry_release;
  
        bi->bi_connection_init = 0;
        bi->bi_connection_destroy = backsql_connection_destroy;
index 6b192631e2ccbff998b89ea38c0bc6e8079171d6..623362a487852af522bb3c47bc62fe0033d8d076 100644 (file)
@@ -158,7 +158,7 @@ backsql_modify( Operation *op, SlapReply *rs )
        if ( BACKSQL_CHECK_SCHEMA( bi ) ) {
                char            textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
 
-               entry_clean( &m );
+               backsql_entry_clean( op, &m );
 
                bsi.bsi_e = &m;
                rs->sr_err = backsql_id2entry( &bsi, &bsi.bsi_base_id );
@@ -212,7 +212,7 @@ done:;
        }
 
        if ( !BER_BVISNULL( &m.e_nname ) ) {
-               entry_clean( &m );
+               backsql_entry_clean( op, &m );
        }
 
        if ( bsi.bsi_attrs != NULL ) {
index ade189bae898b3cae7811c982b0e9906f20737de..ce904498e2ef75106df5f3cdb4896642d09415d6 100644 (file)
@@ -449,7 +449,7 @@ backsql_modrdn( Operation *op, SlapReply *rs )
        if ( BACKSQL_CHECK_SCHEMA( bi ) ) {
                char            textbuf[ SLAP_TEXT_BUFLEN ] = { '\0' };
 
-               entry_clean( &r );
+               backsql_entry_clean( op, &r );
                (void)backsql_free_entryID( op, &e_id, 0 );
 
                bsi.bsi_e = &r;
@@ -574,15 +574,15 @@ done:;
        }
 
        if ( !BER_BVISNULL( &r.e_nname ) ) {
-               entry_clean( &r );
+               backsql_entry_clean( op, &r );
        }
 
        if ( !BER_BVISNULL( &p.e_nname ) ) {
-               entry_clean( &p );
+               backsql_entry_clean( op, &p );
        }
 
        if ( !BER_BVISNULL( &n.e_nname ) ) {
-               entry_clean( &n );
+               backsql_entry_clean( op, &n );
        }
 
        Debug( LDAP_DEBUG_TRACE, "<==backsql_modrdn()\n", 0, 0, 0 );
index 8019284223d1e0e0712fcc321fbfe705c86273c4..4cdc28d20273b246c495165e8b7ae6f6eddf658c 100644 (file)
@@ -169,6 +169,8 @@ int backsql_init_search( backsql_srch_info *bsi,
                Operation *op, SlapReply *rs, AttributeName *attrs,
                unsigned flags );
 
+void backsql_entry_clean( Operation *op, Entry *e );
+
 /*
  * sql-wrap.h
  */
@@ -283,6 +285,7 @@ extern BI_op_delete         backsql_delete;
 
 extern BI_operational          backsql_operational;
 extern BI_entry_get_rw         backsql_entry_get;
+extern BI_entry_release_rw     backsql_entry_release;
 
 extern BI_connection_destroy   backsql_connection_destroy;
 
index 49e7e3acd15294e2d775ccf643d6bfeffbbcf096..eff0a9ef530cef949b6901f2626f06d2ca302b4e 100644 (file)
@@ -1,4 +1,3 @@
-DROP TABLE ldap_referrals;
 DROP TABLE ldap_entry_objclasses;
 DROP TABLE ldap_attr_mappings;
 DROP TABLE ldap_entries;
index 17b12afd425fd0c5f9fbf92dbe4d6674c7f35741..908cd44123a13aa1a70d358d341785cc05b2f8f9 100644 (file)
@@ -3,3 +3,4 @@ DROP TABLE institutes;
 DROP TABLE documents;
 DROP TABLE authors_docs;
 DROP TABLE phones;
+DROP TABLE referrals;
index da3cea0d21fd9aa791a236147ed1a300dd15974c..c78920f926599eee469eecbce0e1596743c44ad1 100644 (file)
@@ -2096,7 +2096,7 @@ backsql_search( Operation *op, SlapReply *rs )
                                        } else {
                                                rs->sr_err = LDAP_OTHER;
                                        }
-                                       entry_clean( &user_entry2 );
+                                       backsql_entry_clean( op, &user_entry2 );
                                }
                                if ( bsi2.bsi_attrs != NULL ) {
                                        op->o_tmpfree( bsi2.bsi_attrs,
@@ -2218,7 +2218,7 @@ backsql_search( Operation *op, SlapReply *rs )
 
 next_entry:;
                if ( e == &user_entry ) {
-                       entry_clean( &user_entry );
+                       backsql_entry_clean( op, &user_entry );
                }
 
 next_entry2:;
@@ -2245,10 +2245,10 @@ send_results:;
                send_ldap_result( op, rs );
        }
 
-       entry_clean( &base_entry );
+       backsql_entry_clean( op, &base_entry );
 
        /* in case we got here accidentally */
-       entry_clean( &user_entry );
+       backsql_entry_clean( op, &user_entry );
 
        if ( rs->sr_v2ref ) {
                ber_bvarray_free( rs->sr_v2ref );
@@ -2390,3 +2390,39 @@ return_results:;
        return rc;
 }
 
+void
+backsql_entry_clean(
+               Operation       *op,
+               Entry           *e )
+{
+       void *ctx;
+
+       ctx = ldap_pvt_thread_pool_context();
+
+       if ( ctx == NULL || ctx == op->o_tmpmemctx ) {
+               if ( !BER_BVISNULL( &e->e_name ) ) {
+                       op->o_tmpfree( e->e_name.bv_val, op->o_tmpmemctx );
+                       BER_BVZERO( &e->e_name );
+               }
+
+               if ( !BER_BVISNULL( &e->e_nname ) ) {
+                       op->o_tmpfree( e->e_nname.bv_val, op->o_tmpmemctx );
+                       BER_BVZERO( &e->e_nname );
+               }
+       }
+
+       entry_clean( e );
+}
+
+int
+backsql_entry_release(
+               Operation       *op,
+               Entry           *e,
+               int             rw )
+{
+       backsql_entry_clean( op, e );
+
+       ch_free( e );
+
+       return 0;
+}