static bool paged_controls_same(struct ldb_request *req,
				struct ldb_control **down_controls) {
	int i;
	unsigned int num_down_controls, num_non_null_req_controls;
	struct ldb_control *ctrl;

	num_down_controls = 0;
	for (i=0; down_controls[i] != NULL; i++) {
		num_down_controls++;

		ctrl = ldb_request_get_control(req, down_controls[i]->oid);
		if (ctrl == NULL) {
			return false;
		}
	}

	num_non_null_req_controls = 0;
	for (i=0; req->controls[i] != NULL; i++) {
		if (req->controls[i]->oid != NULL &&
		    strcmp(req->controls[i]->oid,
			   LDB_CONTROL_ASQ_OID) != 0) {
			num_non_null_req_controls++;
		}
	}

	/* At this point we have the number of non-null entries for both
	 * control lists and we know that:
	 * 1. down_controls does not contain the paged control or ASQ
	 * 	(because paged_results_copy_down_controls excludes it)
	 * 2. req->controls does contain the paged control
	 * 	(because this function is only called if this is true)
	 * 3. down_controls is a subset of non-null controls in req->controls
	 * 	(checked above)
	 * So to confirm that the two lists are identical except for the paged
	 * control and possibly ASQ, all we need to check is: */
	if (num_non_null_req_controls == num_down_controls + 1) {
		return true;
	}
	return false;
}
static bool paged_controls_same(struct ldb_request *req,
				struct ldb_control **down_controls) {
	int i;
	unsigned int num_down_controls, num_non_null_req_controls;
	struct ldb_control *ctrl;

	num_down_controls = 0;
	for (i=0; down_controls[i] != NULL; i++) {
		num_down_controls++;

		ctrl = ldb_request_get_control(req, down_controls[i]->oid);
		if (ctrl == NULL) {
			return false;
		}
	}

	num_non_null_req_controls = 0;
	for (i=0; req->controls[i] != NULL; i++) {
		if (req->controls[i]->oid != NULL &&
		    strcmp(req->controls[i]->oid,
			   LDB_CONTROL_ASQ_OID) != 0) {
			num_non_null_req_controls++;
		}
	}

	 
	if (num_non_null_req_controls == num_down_controls + 1) {
		return true;
	}
	return false;
}