]> git.sur5r.net Git - openldap/commitdiff
don't return adminLimitExceeded unless LDAPv3; use largest among candidates timeouts
authorPierangelo Masarati <ando@openldap.org>
Fri, 26 Jan 2007 01:59:30 +0000 (01:59 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 26 Jan 2007 01:59:30 +0000 (01:59 +0000)
servers/slapd/back-ldap/search.c
servers/slapd/back-meta/search.c

index ea3934437a1472ba24f5e815176795500a21c4e2..1154d44d826706c17a5013187d9a5c52d13620e0 100644 (file)
@@ -289,7 +289,8 @@ retry:
                                if ( rc == 0 ) {
                                        (void)ldap_back_cancel( lc, op, rs, msgid, LDAP_BACK_DONTSEND );
                                        rs->sr_text = "Operation timed out";
-                                       rc = rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED;
+                                       rc = rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
+                                               LDAP_ADMINLIMIT_EXCEEDED : LDAP_OTHER;
                                        goto finish;
                                }
 
index 618c5224fadcb54a5c2ad449c607f52c7e69699e..ba163e9f093469de4a8e22e6bf62d6b45d081197 100644 (file)
@@ -666,7 +666,8 @@ meta_back_search( Operation *op, SlapReply *rs )
        struct timeval  save_tv = { 0, 0 },
                        tv;
        time_t          stoptime = (time_t)(-1),
-                       lastres_time = slap_get_time();
+                       lastres_time = slap_get_time(),
+                       timeout = 0;
        int             rc = 0, sres = LDAP_SUCCESS;
        char            *matched = NULL;
        int             last = 0, ncandidates = 0,
@@ -717,6 +718,13 @@ getconn:;
                candidates[ i ].sr_text = NULL;
                candidates[ i ].sr_ref = NULL;
                candidates[ i ].sr_ctrls = NULL;
+
+               /* get largest timeout among candidates */
+               if ( mi->mi_targets[ i ]->mt_timeout[ SLAP_OP_SEARCH ]
+                       && mi->mi_targets[ i ]->mt_timeout[ SLAP_OP_SEARCH ] > timeout )
+               {
+                       timeout = mi->mi_targets[ i ]->mt_timeout[ SLAP_OP_SEARCH ];
+               }
        }
 
        for ( i = 0; i < mi->mi_ntargets; i++ ) {
@@ -865,13 +873,13 @@ getconn:;
                time_t  curr_time = 0;
 
                /* check timeout */
-               if ( mi->mi_timeout[ SLAP_OP_SEARCH ]
-                       && lastres_time > 0
-                       && ( slap_get_time() - lastres_time ) > mi->mi_timeout[ SLAP_OP_SEARCH ] )
+               if ( timeout && lastres_time > 0
+                       && ( slap_get_time() - lastres_time ) > timeout )
                {
                        doabandon = 1;
                        rs->sr_text = "Operation timed out";
-                       rc = rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED;
+                       rc = rs->sr_err = op->o_protocol >= LDAP_VERSION3 ?
+                               LDAP_ADMINLIMIT_EXCEEDED : LDAP_OTHER;
                        savepriv = op->o_private;
                        op->o_private = (void *)i;
                        send_ldap_result( op, rs );