s4-ldb: check for -ve value for page size
authorAndrew Tridgell <tridge@samba.org>
Mon, 30 Nov 2009 06:47:56 +0000 (17:47 +1100)
committerAndrew Tridgell <tridge@samba.org>
Mon, 30 Nov 2009 07:15:31 +0000 (18:15 +1100)
This comes from a tip from Howard Chu. Apparently some clients
will send a -ve page size value.

source4/lib/ldb/modules/paged_results.c

index 774109ff06d6fa22aa2922939e22e41f1510475c..ff1b92ff97e16cf51e36919cc5e8c44b2c673e99 100644 (file)
@@ -326,6 +326,11 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req)
        ac->module = module;
        ac->req = req;
        ac->size = paged_ctrl->size;
+       if (ac->size < 0) {
+               /* apparently some clients send more than 2^31. This
+                  violates the ldap standard, but we need to cope */
+               ac->size = 0x7FFFFFFF;
+       }
 
        /* check if it is a continuation search the store */
        if (paged_ctrl->cookie_len == 0) {