From 8331b4c4f8ff1cab6fef2e402a3fda3a95ea091d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 30 Nov 2009 17:47:56 +1100 Subject: s4-ldb: check for -ve value for page size 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 | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4/lib/ldb') diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c index 774109ff06..ff1b92ff97 100644 --- a/source4/lib/ldb/modules/paged_results.c +++ b/source4/lib/ldb/modules/paged_results.c @@ -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) { -- cgit