ranged_results: fix use of uninitialised variable (end)
authorAndrew Bartlett <abartlet@samba.org>
Tue, 22 Jan 2008 21:57:16 +0000 (08:57 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 22 Jan 2008 21:57:16 +0000 (08:57 +1100)
This matches the range parsing in the search and callback - end was
uninitilaised, causing occasional failures in make test.

Andrew Bartlett

source/dsdb/samdb/ldb_modules/ranged_results.c

index 345b8b84407b22b424a52b271a21892ce978a031..c527afc6db30a9e8094825ed19964d19d056d92d 100644 (file)
@@ -153,8 +153,10 @@ static int rr_search(struct ldb_module *module, struct ldb_request *req)
                if (strncasecmp(p, ";range=", strlen(";range=")) != 0) {
                        continue;
                }
-               if (sscanf(p, ";range=%u-*", &start) == 1) {
-               } else if (sscanf(p, ";range=%u-%u", &start, &end) != 2) {
+               if (sscanf(p, ";range=%u-%u", &start, &end) == 2) {
+               } else if (sscanf(p, ";range=%u-*", &start) == 1) {
+                       end = (unsigned int)-1;
+               } else {
                        ldb_asprintf_errstring(module->ldb, "range request error: range requst malformed");
                        return LDB_ERR_UNWILLING_TO_PERFORM;
                }