]> git.sur5r.net Git - openldap/commitdiff
more cleanup in handling timeouts in ldap_result()
authorPierangelo Masarati <ando@openldap.org>
Tue, 26 Apr 2005 21:48:43 +0000 (21:48 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 26 Apr 2005 21:48:43 +0000 (21:48 +0000)
servers/slapd/back-meta/bind.c
servers/slapd/back-meta/search.c

index f0e0c5002453b7055023d95b517fdd73b0e66073..1c088369ae3653306882427580f6ce3db99cf275 100644 (file)
@@ -181,7 +181,8 @@ meta_back_single_bind(
        struct berval           mdn = BER_BVNULL;
        dncookie                dc;
        metasingleconn_t        *msc = &mc->mc_conns[ candidate ];
-       int                     msgid;
+       int                     msgid,
+                               rebinding = 0;
        
        /*
         * Rewrite the bind dn if needed
@@ -230,12 +231,27 @@ retry:;
                                goto retry;
                        }
                        rs->sr_err = LDAP_BUSY;
-                       break;
+                       if ( rebinding ) {
+                               ldap_abandon_ext( msc->msc_ld, msgid, NULL, NULL );
+                               break;
+                       }
+
+                       /* FIXME: some times the request times out
+                        * while the other party is not willing to
+                        * send a response any more.  Give it a second
+                        * chance with a freshly bound connection */
+                       rebinding = 1;
+                       nretries = mt->mt_nretries;
+                       /* fallthru */
 
                case -1:
                        ldap_get_option( msc->msc_ld, LDAP_OPT_ERROR_NUMBER,
                                        &rs->sr_err );
 
+                       if ( rebinding ) {
+                               ldap_abandon_ext( msc->msc_ld, msgid, NULL, NULL );
+                       }
+
                        Debug( LDAP_DEBUG_ANY, "### %s meta_back_single_bind: err=%d nretries=%d\n",
                                op->o_log_prefix, rs->sr_err, nretries );
 
@@ -365,6 +381,7 @@ retry:;
 
                        rc = LDAP_BUSY;
                        if ( rebinding ) {
+                               ldap_abandon_ext( msc->msc_ld, msgid, NULL, NULL );
                                break;
                        }
 
@@ -380,6 +397,10 @@ retry:;
                        ldap_get_option( msc->msc_ld,
                                        LDAP_OPT_ERROR_NUMBER, &rs->sr_err );
 
+                       if ( rebinding ) {
+                               ldap_abandon_ext( msc->msc_ld, msgid, NULL, NULL );
+                       }
+
                        Debug( LDAP_DEBUG_ANY, "### %s meta_back_single_dobind: err=%d nretries=%d\n",
                                        op->o_log_prefix, rs->sr_err, nretries );
 
index 888cb7af65739af540e4b200adfa2f2c956bea0b..e88b7e9162ded79998bb4b0f695af524881a1fdb 100644 (file)
@@ -388,6 +388,7 @@ really_bad:;
 
                                gotit = 1;
 
+#if 0
                                /*
                                 * If scope is BASE, we need to jump out
                                 * as soon as one entry is found; if
@@ -395,6 +396,10 @@ really_bad:;
                                 * this should correspond to the sole
                                 * entry that has the base DN
                                 */
+                               /* FIXME: this defeats the purpose of
+                                * doing a search with scope == base and
+                                * sizelimit = 1 to determine if a
+                                * candidate is actually unique */
                                if ( op->ors_scope == LDAP_SCOPE_BASE
                                                && rs->sr_nentries > 0 )
                                {
@@ -403,6 +408,7 @@ really_bad:;
                                        sres = LDAP_SUCCESS;
                                        break;
                                }
+#endif
 
                        } else if ( rc == LDAP_RES_SEARCH_REFERENCE ) {
                                char            **references = NULL;
@@ -843,12 +849,13 @@ meta_send_entry(
                }
 
                if ( ber_scanf( &ber, "[W]", &attr->a_vals ) == LBER_ERROR 
-                               || attr->a_vals == NULL ) {
+                               || attr->a_vals == NULL )
+               {
                        attr->a_vals = (struct berval *)&slap_dummy_bv;
 
                } else if ( attr->a_desc == slap_schema.si_ad_objectClass
-                               || attr->a_desc == slap_schema.si_ad_structuralObjectClass ) {
-
+                               || attr->a_desc == slap_schema.si_ad_structuralObjectClass )
+               {
                        for ( last = 0; !BER_BVISNULL( &attr->a_vals[ last ] ); ++last );
 
                        for ( bv = attr->a_vals; !BER_BVISNULL( bv ); bv++ ) {