]> git.sur5r.net Git - openldap/commitdiff
fix sizelimit bug (ITS#3720)
authorPierangelo Masarati <ando@openldap.org>
Thu, 12 May 2005 22:37:56 +0000 (22:37 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 12 May 2005 22:37:56 +0000 (22:37 +0000)
servers/slapd/back-meta/search.c

index ae30ba1d9f5c3c7670dbea7d12d22dbf77e02817..d5113fb3f3b66fe441c9766d856b091e680931e8 100644 (file)
@@ -342,16 +342,6 @@ meta_back_search( Operation *op, SlapReply *rs )
                                break;
                        }
                        
-                       if ( op->ors_slimit > 0 && rs->sr_nentries == op->ors_slimit )
-                       {
-                               rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
-                               savepriv = op->o_private;
-                               op->o_private = (void *)i;
-                               send_ldap_result( op, rs );
-                               op->o_private = savepriv;
-                               goto finish;
-                       }
-
                        /*
                         * FIXME: handle time limit as well?
                         * Note that target servers are likely 
@@ -388,6 +378,19 @@ really_bad:;
                                goto finish;
 
                        } else if ( rc == LDAP_RES_SEARCH_ENTRY ) {
+                               if ( op->ors_slimit > 0 && rs->sr_nentries == op->ors_slimit )
+                               {
+                                       ldap_msgfree( res );
+                                       res = NULL;
+
+                                       rs->sr_err = LDAP_SIZELIMIT_EXCEEDED;
+                                       savepriv = op->o_private;
+                                       op->o_private = (void *)i;
+                                       send_ldap_result( op, rs );
+                                       op->o_private = savepriv;
+                                       goto finish;
+                               }
+
                                is_ok++;
 
                                e = ldap_first_entry( msc->msc_ld, res );