]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sql/bind.c
slapi_ch_bvdup() should be implemented in terms of ber_dupbv()
[openldap] / servers / slapd / back-sql / bind.c
index 3ce75c1f08add6db532491bae69e0fb4cc1961e4..f87ebdd972cc2d2b48ac938c5d9c4c754e742e2b 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1999-2005 The OpenLDAP Foundation.
+ * Copyright 1999-2006 The OpenLDAP Foundation.
  * Portions Copyright 1999 Dmitry Kovalev.
  * Portions Copyright 2002 Pierangelo Masarati.
  * All rights reserved.
@@ -34,7 +34,7 @@ backsql_bind( Operation *op, SlapReply *rs )
        SQLHDBC                 dbh = SQL_NULL_HDBC;
        Entry                   e = { 0 };
        Attribute               *a;
-       backsql_srch_info       bsi;
+       backsql_srch_info       bsi = { 0 };
        AttributeName           anlist[2];
        int                     rc;
  
@@ -76,7 +76,6 @@ backsql_bind( Operation *op, SlapReply *rs )
 
        bsi.bsi_e = &e;
        rc = backsql_init_search( &bsi, &op->o_req_ndn, LDAP_SCOPE_BASE, 
-                       SLAP_NO_LIMIT, SLAP_NO_LIMIT,
                        (time_t)(-1), NULL, dbh, op, rs, anlist,
                        BACKSQL_ISF_GET_ENTRY );
        if ( rc != LDAP_SUCCESS ) {
@@ -101,10 +100,12 @@ backsql_bind( Operation *op, SlapReply *rs )
        }
 
 error_return:;
-       (void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 );
+       if ( !BER_BVISNULL( &bsi.bsi_base_id.eid_ndn ) ) {
+               (void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 );
+       }
 
-       if ( bsi.bsi_e ) {
-               entry_clean( bsi.bsi_e );
+       if ( !BER_BVISNULL( &e.e_nname ) ) {
+               backsql_entry_clean( op, &e );
        }
 
        if ( bsi.bsi_attrs != NULL ) {