]> git.sur5r.net Git - openldap/commitdiff
ldapsearch doesn't handle correctly setting paged results size to 0 to abort
authorPierangelo Masarati <ando@openldap.org>
Tue, 24 Aug 2004 09:17:10 +0000 (09:17 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 24 Aug 2004 09:17:10 +0000 (09:17 +0000)
clients/tools/ldapsearch.c

index f8b21b34d63649ffb373ce384a6aefe48dbfca49..44284cbd3d34dd802ac3de3cdefa3c2818e2c1d0 100644 (file)
@@ -660,7 +660,7 @@ getNextPage:
                || domainScope
 #endif
 #ifdef LDAP_CONTROL_PAGEDRESULTS
-               || pageSize
+               || pagedResults
 #endif
                || ldapsync
                || subentries || valuesReturnFilter )
@@ -844,7 +844,7 @@ getNextPage:
                                valuesReturnFilter > 1 ? _("critical ") : "", vrFilter );
                }
 #ifdef LDAP_CONTROL_PAGEDRESULTS
-               if ( pageSize ) {
+               if ( pagedResults ) {
                        printf(_("\n# with pagedResults %scontrol: size=%d"),
                                (pagedResults > 1) ? _("critical ") : "", 
                                pageSize );
@@ -912,7 +912,7 @@ getNextPage:
                        }
                }
 
-               goto getNextPage;       
+               goto getNextPage;
        }
 #endif
 
@@ -1050,6 +1050,8 @@ static int dosearch(
                                        } else {
                                                morePagedResults = 0;
                                        }
+                               } else {
+                                       morePagedResults = 0;
                                }
 #endif
 
@@ -1103,18 +1105,18 @@ static int dosearch(
 done:
        ldap_msgfree( res );
 #ifdef LDAP_CONTROL_PAGEDRESULTS
-       if ( pageSize != 0 ) { 
-               npagedresponses = npagedresponses + nresponses;
-               npagedentries = npagedentries + nentries;
-               npagedreferences = npagedreferences + nreferences;
-               npagedextended = npagedextended + nextended;
-               npagedpartial = npagedpartial + npartial;
+       if ( pagedResults ) { 
+               npagedresponses += nresponses;
+               npagedentries += nentries;
+               npagedextended += nextended;
+               npagedpartial += npartial;
+               npagedreferences += nreferences;
                if ( ( morePagedResults == 0 ) && ( ldif < 2 ) ) {
                        printf( _("\n# numResponses: %d\n"), npagedresponses );
-                       if( nentries ) printf( _("# numEntries: %d\n"), npagedentries );
-                       if( nextended ) printf( _("# numExtended: %d\n"), npagedextended );
-                       if( npartial ) printf( _("# numPartial: %d\n"), npagedpartial );
-                       if( nreferences ) printf( _("# numReferences: %d\n"), npagedreferences );
+                       if( npagedentries ) printf( _("# numEntries: %d\n"), npagedentries );
+                       if( npagedextended ) printf( _("# numExtended: %d\n"), npagedextended );
+                       if( npagedpartial ) printf( _("# numPartial: %d\n"), npagedpartial );
+                       if( npagedreferences ) printf( _("# numReferences: %d\n"), npagedreferences );
                }
        } else
 #endif