s4: ldb: Ignore case of "range" in sscanf as we've already checked for its presence.
authorJeremy Allison <jra@samba.org>
Tue, 28 Jun 2016 22:38:22 +0000 (15:38 -0700)
committerJeremy Allison <jra@samba.org>
Wed, 29 Jun 2016 21:09:17 +0000 (23:09 +0200)
https://bugzilla.samba.org/show_bug.cgi?id=11838

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/ranged_results.c

index 60d7503e5d9091fa7b45f8f4b47221bce4220baf..13bf3a2d0a93f2e72846fba06b8db63d5ae91f7f 100644 (file)
@@ -201,6 +201,8 @@ static int rr_search(struct ldb_module *module, struct ldb_request *req)
        /* Strip the range request from the attribute */
        for (i = 0; req->op.search.attrs && req->op.search.attrs[i]; i++) {
                char *p;
+               size_t range_len = strlen(";range=");
+
                new_attrs = talloc_realloc(req, new_attrs, const char *, i+2);
                new_attrs[i] = req->op.search.attrs[i];
                new_attrs[i+1] = NULL;
@@ -208,12 +210,12 @@ static int rr_search(struct ldb_module *module, struct ldb_request *req)
                if (!p) {
                        continue;
                }
-               if (strncasecmp(p, ";range=", strlen(";range=")) != 0) {
+               if (strncasecmp(p, ";range=", range_len) != 0) {
                        continue;
                }
                end = (unsigned int)-1;
-               if (sscanf(p, ";range=%u-*", &start) != 1) {
-                       if (sscanf(p, ";range=%u-%u", &start, &end) != 2) {
+               if (sscanf(p + range_len, "%u-*", &start) != 1) {
+                       if (sscanf(p + range_len, "%u-%u", &start, &end) != 2) {
                                ldb_asprintf_errstring(ldb,
                                        "range request error: "
                                        "range request malformed");