]> git.sur5r.net Git - openldap/commitdiff
ITS#6985 fix sssvlv target offset, ordering match
authorHoward Chu <hyc@openldap.org>
Mon, 18 Jul 2011 19:41:51 +0000 (12:41 -0700)
committerQuanah Gibson-Mount <quanah@openldap.org>
Wed, 7 Sep 2011 00:24:07 +0000 (17:24 -0700)
servers/slapd/overlays/sssvlv.c

index ce3da34f5be4282aaec30290bf35f46876cb5ba0..aded94abcf0b36a8139d052f8248828cd812a4b9 100644 (file)
@@ -515,8 +515,10 @@ range_err:
                }
                cur_node = tavl_find3( so->so_tree, sn, node_cmp, &j );
                /* didn't find >= match */
-               if ( j > 0 )
-                       cur_node = NULL;
+               if ( j > 0 ) {
+                       if ( cur_node )
+                               cur_node = tavl_next( cur_node, TAVL_DIR_RIGHT );
+               }
                op->o_tmpfree( sn, op->o_tmpmemctx );
 
                if ( !cur_node ) {
@@ -534,7 +536,7 @@ range_err:
                        }
                        for (i=0; tmp_node != cur_node;
                                tmp_node = tavl_next( tmp_node, dir ), i++);
-                       so->so_vlv_target = i;
+                       so->so_vlv_target = (dir == TAVL_DIR_RIGHT) ? i+1 : so->so_nentries - i;
                }
                if ( bv.bv_val != vc->vc_value.bv_val )
                        op->o_tmpfree( bv.bv_val, op->o_tmpmemctx );