]> git.sur5r.net Git - openldap/commitdiff
more on ITS#3808
authorPierangelo Masarati <ando@openldap.org>
Wed, 29 Jun 2005 12:28:40 +0000 (12:28 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 29 Jun 2005 12:28:40 +0000 (12:28 +0000)
libraries/libldap/os-ip.c
servers/slapd/back-ldap/bind.c
servers/slapd/back-ldap/search.c

index 407f5ebad2c1030371bc870cfb6f91fa7b8cade6..7715044f14f3b87c618ca8d8658b32c9f94ded5a 100644 (file)
@@ -903,6 +903,7 @@ ldap_int_select( LDAP *ld, struct timeval *timeout )
 #endif
 
        sip = (struct selectinfo *)ld->ld_selectinfo;
+       assert( sip != NULL );
 
 #ifdef HAVE_POLL
        {
index b817be965a728d073127efae642b746b71f0c40e..13fba4a4b0bbdd825b25f80723072f83d2817765 100644 (file)
@@ -101,17 +101,25 @@ done:;
 
        /* must re-insert if local DN changed as result of bind */
        if ( lc->lc_bound && !dn_match( &op->o_req_ndn, &lc->lc_local_ndn ) ) {
-               int     lerr;
+               struct ldapconn *tmplc;
+               int             lerr;
 
                ldap_pvt_thread_mutex_lock( &li->conn_mutex );
-               lc = avl_delete( &li->conntree, (caddr_t)lc,
+               tmplc = avl_delete( &li->conntree, (caddr_t)lc,
                                ldap_back_conn_cmp );
-               if ( !BER_BVISNULL( &lc->lc_local_ndn ) ) {
-                       ch_free( lc->lc_local_ndn.bv_val );
+               if ( tmplc != NULL ) {
+                       if ( !BER_BVISNULL( &lc->lc_local_ndn ) ) {
+                               ch_free( lc->lc_local_ndn.bv_val );
+                       }
+                       ber_dupbv( &lc->lc_local_ndn, &op->o_req_ndn );
+                       lerr = avl_insert( &li->conntree, (caddr_t)lc,
+                               ldap_back_conn_cmp, ldap_back_conn_dup );
+
+               } else {
+                       /* something BAD happened */
+                       lerr = -1;
+                       rc = LDAP_OTHER;
                }
-               ber_dupbv( &lc->lc_local_ndn, &op->o_req_ndn );
-               lerr = avl_insert( &li->conntree, (caddr_t)lc,
-                       ldap_back_conn_cmp, ldap_back_conn_dup );
                ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
                if ( lerr == -1 ) {
                        ldap_back_conn_free( lc );
@@ -444,6 +452,7 @@ ldap_back_getconn( Operation *op, SlapReply *rs, ldap_back_send_t sendok )
                /* Err could be -1 in case a duplicate ldapconn is inserted */
                if ( rs->sr_err != 0 ) {
                        ldap_back_conn_free( lc );
+                       rs->sr_err = LDAP_OTHER;
                        if ( op->o_conn && ( sendok & LDAP_BACK_SENDERR ) ) {
                                send_ldap_error( op, rs, LDAP_OTHER,
                                "internal server error" );
index 84b0902f9af51f5f783bc044d40a9ce4fd79f0e1..d7fb4a8afb583bb328fd21076ef34d040409be4c 100644 (file)
@@ -286,7 +286,7 @@ fail:;
 
                        e = ldap_first_entry( lc->lc_ld, res );
                        rc = ldap_build_entry( op, e, &ent, &bdn );
-                      if ( rc == LDAP_SUCCESS ) {
+                       if ( rc == LDAP_SUCCESS ) {
                                rs->sr_entry = &ent;
                                rs->sr_attrs = op->ors_attrs;
                                rs->sr_operational_attrs = NULL;