]> git.sur5r.net Git - openldap/commitdiff
Backout fast sync patch
authorKurt Zeilenga <kurt@openldap.org>
Mon, 18 Apr 2005 01:55:21 +0000 (01:55 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 18 Apr 2005 01:55:21 +0000 (01:55 +0000)
libraries/libldap/addentry.c
libraries/libldap/error.c
libraries/libldap/ldap-int.h
libraries/libldap/result.c

index 4edeb28aee1bc856a726872c670d6f475be7f999..7b8cd08c4a2fcc6acf34b468ec6e444c8f26f8b9 100644 (file)
@@ -43,15 +43,10 @@ ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e )
        if ( tmp == NULL )
                return( NULL );
 
-       if ( prev == NULL ) {
-               if ( tmp->lm_chain )
-                       tmp->lm_chain->lm_chain_tail = (*list)->lm_chain_tail;
+       if ( prev == NULL )
                *list = tmp->lm_chain;
-       } else {
+       else
                prev->lm_chain = tmp->lm_chain;
-               if ( prev->lm_chain == NULL )
-                       (*list)->lm_chain_tail = prev;
-       }
        tmp->lm_chain = NULL;
 
        return( tmp );
@@ -64,6 +59,5 @@ ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e )
        assert( e != NULL );
 
        e->lm_chain = *list;
-       e->lm_chain_tail = (*list)->lm_chain_tail;
        *list = e;
 }
index 8d74980d3146efe083bd14f2f7052d431c208277..f789f633630636c6d572b323680ff4087e18b077 100644 (file)
@@ -267,24 +267,13 @@ ldap_parse_result(
        ldap_pvt_thread_mutex_lock( &ld->ld_res_mutex );
 #endif
        /* Find the next result... */
-       if ( r->lm_chain == NULL ) {
-               if ((r->lm_msgtype == LDAP_RES_SEARCH_ENTRY) ||
-                       (r->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) ||
-                       (r->lm_msgtype == LDAP_RES_INTERMEDIATE)) {
-                       lm = NULL;      
-               } else {
-                       lm = r;
-               }
-       } else {
-               if ((r->lm_chain_tail->lm_chain->lm_msgtype
-                               == LDAP_RES_SEARCH_ENTRY) ||
-                       (r->lm_chain_tail->lm_chain->lm_msgtype
-                               == LDAP_RES_SEARCH_REFERENCE) ||
-                       (r->lm_chain_tail->lm_chain->lm_msgtype
-                               == LDAP_RES_INTERMEDIATE)) {
-                       lm = NULL;
-               } else {
-                       lm = r->lm_chain_tail->lm_chain;
+       for ( lm = r; lm != NULL; lm = lm->lm_chain ) {
+               /* skip over entries and references */
+               if( lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY &&
+                       lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE &&
+                       lm->lm_msgtype != LDAP_RES_INTERMEDIATE )
+               {
+                       break;
                }
        }
 
@@ -391,24 +380,15 @@ ldap_parse_result(
                }
 
                /* Find the next result... */
-               lm = lm->lm_chain;
-               if ( lm ) {
-                       if ( lm->lm_chain == NULL ) {
-                               if ((lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY) &&
-                                       (lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE) &&
-                                       (lm->lm_msgtype != LDAP_RES_INTERMEDIATE)) {
-                                       /* more results to return */
-                                       errcode = LDAP_MORE_RESULTS_TO_RETURN;
-                               }
-                       } else {
-                               if ((lm->lm_chain_tail->lm_chain->lm_msgtype
-                                               != LDAP_RES_SEARCH_ENTRY) &&
-                                       (lm->lm_chain_tail->lm_chain->lm_msgtype
-                                               != LDAP_RES_SEARCH_REFERENCE) &&
-                                       (lm->lm_chain_tail->lm_chain->lm_msgtype
-                                               != LDAP_RES_INTERMEDIATE)) {
-                                       errcode = LDAP_MORE_RESULTS_TO_RETURN;
-                               }
+               for ( lm = lm->lm_chain; lm != NULL; lm = lm->lm_chain ) {
+                       /* skip over entries and references */
+                       if( lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY &&
+                               lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE &&
+                               lm->lm_msgtype != LDAP_RES_INTERMEDIATE )
+                       {
+                               /* more results to return */
+                               errcode = LDAP_MORE_RESULTS_TO_RETURN;
+                               break;
                        }
                }
        }
index 017b37c38fd08104e93950d189915fce99e95cf7..cbaa57db8f71b08570673642b6b4f7852a3a7d4d 100644 (file)
@@ -134,7 +134,6 @@ struct ldapmsg {
        ber_tag_t               lm_msgtype;     /* the message type */
        BerElement      *lm_ber;        /* the ber encoded message contents */
        struct ldapmsg  *lm_chain;      /* for search - next msg in the resp */
-       struct ldapmsg  *lm_chain_tail;
        struct ldapmsg  *lm_next;       /* next response */
        time_t  lm_time;        /* used to maintain cache */
 };
index 37f6fe386e285d9f84cb42d30857b5199f5e3b01..1c48c338a78087cb5cd3a7cfe3e851d52ba96baa 100644 (file)
@@ -191,24 +191,12 @@ chkResponseList(
                                break;
                        }
 
-                       if ( lm->lm_chain == NULL ) {
-                               if ((lm->lm_msgtype == LDAP_RES_SEARCH_ENTRY) ||
-                                       (lm->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) ||
-                                       (lm->lm_msgtype == LDAP_RES_INTERMEDIATE)) {
-                                       tmp = NULL;
-                               } else {
-                                       tmp = lm;
-                               }
-                       } else {
-                               if ((lm->lm_chain_tail->lm_chain->lm_msgtype
-                                               == LDAP_RES_SEARCH_ENTRY) ||
-                                       (lm->lm_chain_tail->lm_chain->lm_msgtype
-                                               == LDAP_RES_SEARCH_REFERENCE) ||
-                                       (lm->lm_chain_tail->lm_chain->lm_msgtype
-                                               == LDAP_RES_INTERMEDIATE)) {
-                                       tmp = NULL;
-                               } else {
-                                       tmp = lm->lm_chain_tail->lm_chain;
+                       for ( tmp = lm; tmp != NULL; tmp = tmp->lm_chain ) {
+                               if ( tmp->lm_msgtype != LDAP_RES_SEARCH_ENTRY
+                                   && tmp->lm_msgtype != LDAP_RES_SEARCH_REFERENCE
+                                       && tmp->lm_msgtype != LDAP_RES_INTERMEDIATE )
+                               {
+                                       break;
                                }
                        }
 
@@ -429,7 +417,7 @@ try_read1msg(
        LDAPMessage **result )
 {
        BerElement      *ber;
-       LDAPMessage     *new, *l, *prev, *tmp, *chain_head;
+       LDAPMessage     *new, *l, *prev, *tmp;
        ber_int_t       id;
        ber_tag_t       tag;
        ber_len_t       len;
@@ -903,11 +891,8 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
                                firstmsg = 0;
                                new->lm_next = ld->ld_responses;
                                ld->ld_responses = new;
-                               new->lm_chain_tail = new;
-                               chain_head = new;
                        } else {
                                tmp->lm_chain = new;
-                               chain_head->lm_chain_tail = tmp;
                        }
                        tmp = new;
                        /* "ok" means there's more to parse */
@@ -929,7 +914,6 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
                 * first response off the head of the chain.
                 */
                        tmp->lm_chain = new;
-                       chain_head->lm_chain_tail = tmp;
                        *result = chkResponseList( ld, msgid, all );
                        ld->ld_errno = LDAP_SUCCESS;
                        return( (*result)->lm_msgtype );
@@ -973,7 +957,6 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
 
                new->lm_next = ld->ld_responses;
                ld->ld_responses = new;
-               new->lm_chain_tail = new;
                goto exit;
        }
 
@@ -987,31 +970,13 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
 #endif
 
        /* part of a search response - add to end of list of entries */
-       if (l->lm_chain == NULL) {
-               if ((l->lm_msgtype == LDAP_RES_SEARCH_ENTRY) ||
-                       (l->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) ||
-                       (l->lm_msgtype == LDAP_RES_INTERMEDIATE)) {
-                       /* do not advance lm_chain_tail in this case */
-                       l->lm_chain = new;
-               } else {
-                       /*FIXME: ldap_msgfree( l );*/
-                       l = new;
-                       l->lm_chain_tail = new;
-               }
-       } else {
-               if ((l->lm_chain_tail->lm_chain->lm_msgtype
-                               == LDAP_RES_SEARCH_ENTRY) ||
-                       (l->lm_chain_tail->lm_chain->lm_msgtype
-                               == LDAP_RES_SEARCH_REFERENCE) ||
-                       (l->lm_chain_tail->lm_chain->lm_msgtype
-                               == LDAP_RES_INTERMEDIATE)) {
-                       l->lm_chain_tail->lm_chain->lm_chain = new;
-                       l->lm_chain_tail = l->lm_chain_tail->lm_chain;
-               } else {
-                       /*FIXME: ldap_msgfree( l->lm_chain_tail->lm_chain );*/
-                       l->lm_chain_tail->lm_chain = new;
-               }
-       }
+       for ( tmp = l; (tmp->lm_chain != NULL) &&
+               ((tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY) ||
+                (tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) ||
+                        (tmp->lm_chain->lm_msgtype == LDAP_RES_INTERMEDIATE ));
+           tmp = tmp->lm_chain )
+               ;       /* NULL */
+       tmp->lm_chain = new;
 
        /* return the whole chain if that's what we were looking for */
        if ( foundit ) {