]> git.sur5r.net Git - openldap/commitdiff
immediately return sizelimitExceeded if appropriate
authorPierangelo Masarati <ando@openldap.org>
Mon, 3 Apr 2006 21:14:14 +0000 (21:14 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 3 Apr 2006 21:14:14 +0000 (21:14 +0000)
servers/slapd/back-meta/search.c

index 1137fe20abec5b6176a7f9e848dffe584d520e44..32e2b27fc98a544d1c498ec1a938cd990e3c8934 100644 (file)
@@ -580,16 +580,16 @@ really_bad:;
                                 * back-meta would need to merge them
                                 * consistently (think of pagedResults...)
                                 */
-                               if ( ldap_parse_result( msc->msc_ld,
+                               rs->sr_err = ldap_parse_result( msc->msc_ld,
                                                        res,
                                                        &candidates[ i ].sr_err,
                                                        (char **)&candidates[ i ].sr_matched,
                                                        NULL /* (char **)&candidates[ i ].sr_text */ ,
                                                        &references,
                                                        NULL /* &candidates[ i ].sr_ctrls (unused) */ ,
-                                                       1 ) != LDAP_SUCCESS )
-                               {
-                                       res = NULL;
+                                                       1 );
+                               res = NULL;
+                               if ( rs->sr_err != LDAP_SUCCESS ) {
                                        ldap_get_option( msc->msc_ld,
                                                        LDAP_OPT_ERROR_NUMBER,
                                                        &rs->sr_err );
@@ -598,10 +598,6 @@ really_bad:;
                                        goto really_bad;
                                }
 
-                               rs->sr_err = candidates[ i ].sr_err;
-                               sres = slap_map_api2result( rs );
-                               res = NULL;
-
                                /* massage matchedDN if need be */
                                if ( candidates[ i ].sr_matched != NULL ) {
                                        struct berval   match, mmatch;
@@ -693,6 +689,24 @@ really_bad:;
                                        is_ok++;
                                        break;
 
+                               case LDAP_SIZELIMIT_EXCEEDED:
+                                       /* if a target returned sizelimitExceeded
+                                        * and the entry count is equal to the
+                                        * proxy's limit, the target would have
+                                        * returned more, and the error must be
+                                        * propagated to the client; otherwise,
+                                        * the target enforced a limit lower
+                                        * than what requested by the proxy;
+                                        * ignore it */
+                                       if ( rs->sr_nentries == op->ors_slimit ) {
+                                               savepriv = op->o_private;
+                                               op->o_private = (void *)i;
+                                               send_ldap_result( op, rs );
+                                               op->o_private = savepriv;
+                                               goto finish;
+                                       }
+                                       break;
+
                                default:
                                        if ( META_BACK_ONERR_STOP( mi ) ) {
                                                savepriv = op->o_private;