]> git.sur5r.net Git - openldap/commitdiff
don't set dummy cookie when dealing with last database (ITS#6507)
authorPierangelo Masarati <ando@openldap.org>
Thu, 8 Apr 2010 17:16:38 +0000 (17:16 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 8 Apr 2010 17:16:38 +0000 (17:16 +0000)
servers/slapd/backglue.c

index 2f7908c348d1a76037073aaf5443272b61dafac9..8911f1595e82d48ed374ecf63bcaf103d6a41a57 100644 (file)
@@ -585,12 +585,13 @@ glue_op_search ( Operation *op, SlapReply *rs )
                                                                tag = ber_scanf( ber, "{im}", &size, &cookie );
                                                                assert( tag != LBER_ERROR );
 
-                                                               if ( BER_BVISEMPTY( &cookie ) ) {
+                                                               if ( BER_BVISEMPTY( &cookie ) && op->o_bd != gi->gi_n[0].gn_be ) {
                                                                        /* delete old, create new cookie with NOID */
                                                                        PagedResultsCookie respcookie = (PagedResultsCookie)NOID;
                                                                        ber_len_t oidlen = strlen( gs.ctrls[c]->ldctl_oid );
                                                                        LDAPControl *newctrl;
 
+                                                                       /* it's next database's turn */
                                                                        if ( btmp == b0 ) {
                                                                                op->o_conn->c_pagedresults_state.ps_be = gi->gi_n[gi->gi_nodes - 1].gn_be;
 
@@ -619,7 +620,8 @@ glue_op_search ( Operation *op, SlapReply *rs )
 
                                                                        ber_free_buf( ber );
 
-                                                               } else {
+                                                               } else if ( op->o_bd != gi->gi_n[0].gn_be ) {
+                                                                       /* if cookie not empty, it's again this database's turn */
                                                                        op->o_conn->c_pagedresults_state.ps_be = op->o_bd;
                                                                }
                                                        }