* Author: Simo Sorce
*/
-#include "ldb_includes.h"
+#include "replace.h"
+#include "system/filesys.h"
+#include "system/time.h"
#include "ldb_module.h"
struct message_store {
};
struct private_data {
-
- int next_free_id;
+ unsigned int next_free_id;
struct results_store *store;
};
static struct results_store *new_store(struct private_data *priv)
{
struct results_store *newr;
- int new_id = priv->next_free_id++;
+ unsigned int new_id = priv->next_free_id++;
/* TODO: we should have a limit on the number of
* outstanding paged searches
{
struct ldb_paged_control *paged;
struct message_store *msg;
- int i, num_ctrls, ret;
+ unsigned int i, num_ctrls;
+ int ret;
if (ac->store == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
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) {
ac,
paged_search_callback,
req);
+ ldb_req_mark_trusted(search_req);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
/* save it locally and remove it from the list */
/* we do not need to replace them later as we
* are keeping the original req intact */
- if (!save_controls(control, search_req, &saved_controls)) {
+ if (!ldb_save_controls(control, search_req, &saved_controls)) {
return LDB_ERR_OPERATIONS_ERROR;
}
ret = ldb_mod_register_control(module, LDB_CONTROL_PAGED_RESULTS_OID);
if (ret != LDB_SUCCESS) {
ldb_debug(ldb, LDB_DEBUG_WARNING,
- "paged_request:"
- "Unable to register control with rootdse!\n");
+ "paged_results:"
+ "Unable to register control with rootdse!");
}
return ldb_next_init(module);
}
-const struct ldb_module_ops ldb_paged_results_module_ops = {
+static const struct ldb_module_ops ldb_paged_results_module_ops = {
.name = "paged_results",
.search = paged_search,
.init_context = paged_request_init
};
+
+int ldb_paged_results_init(const char *version)
+{
+ LDB_MODULE_CHECK_VERSION(version);
+ return ldb_register_module(&ldb_paged_results_module_ops);
+}