]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#4545 better fix. this code still needs cleaning up.
authorHoward Chu <hyc@openldap.org>
Thu, 14 Dec 2006 06:58:57 +0000 (06:58 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 14 Dec 2006 06:58:57 +0000 (06:58 +0000)
libraries/libldap/result.c

index df0b056038e360a6146fa742dd14cb8ddbe781aa..3445d79ae6f2bae12d7f26602ed27f700fede6ac 100644 (file)
@@ -688,9 +688,6 @@ nextresp2:
                                        if ( LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS)
                                                         || lr->lr_parent != NULL )
                                        {
-                                               /* Assume referral not chased and return it to app */
-                                               v3ref = V3REF_TOAPP;
-
                                                /* Get the referral list */
                                                if ( ber_scanf( &tmpber, "{v}", &refs) == LBER_ERROR) {
                                                        rc = LDAP_DECODING_ERROR;
@@ -708,12 +705,15 @@ nextresp2:
                                                                0, &lr->lr_res_error, &hadref );
                                                        lr->lr_status = LDAP_REQST_COMPLETED;
                                                        Debug( LDAP_DEBUG_TRACE,
-                                                               "read1msg: referral chased, "
+                                                               "read1msg: referral %s chased, "
                                                                "mark request completed, ld %p msgid %d\n",
-                                                               (void *)ld, lr->lr_msgid, 0);
+                                                               hadref ? "" : "not",
+                                                               (void *)ld, lr->lr_msgid);
                                                        if ( refer_cnt > 0 ) {
                                                                /* Referral successfully chased */
                                                                v3ref = V3REF_SUCCESS;
+                                                       } else {
+                                                               refer_cnt = 0;
                                                        }
                                                }
                                        }
@@ -728,20 +728,6 @@ nextresp2:
                                        LDAP_FREE( lr->lr_res_error );
                                        lr->lr_res_error = NULL;
                                }
-
-                               /* Since it's not a SearchReference, it must be a
-                                * result. Since we're not chasing the referral,
-                                * this request is done.
-                                */
-                               if ( v3ref == V3REF_TOAPP ) {
-                                       lr->lr_status = LDAP_REQST_COMPLETED;
-                                       Debug( LDAP_DEBUG_TRACE,
-                                               "request done: ld %p msgid %d, "
-                                               "referral returned to app\n",
-                                               (void *)ld, lr->lr_msgid, 0);
-                                       ldap_return_request( ld, lr, 1 );
-                                       lr = NULL;
-                               }
                        }
                }
        }
@@ -751,11 +737,12 @@ nextresp2:
         * and checks if all referrals have been chased.
         */
        if ( tag != LDAP_RES_SEARCH_ENTRY &&
-               v3ref != V3REF_TOAPP &&
+               tag != LDAP_RES_SEARCH_REFERENCE &&
                tag != LDAP_RES_INTERMEDIATE )
        {
                /* For a v3 search referral/reference, only come here if already chased it */
                if ( ld->ld_version >= LDAP_VERSION2 &&
+                       v3ref != V3REF_TOAPP &&
                        ( lr->lr_parent != NULL ||
                        LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_REFERRALS) ) )
                {