static const struct ldb_module_ops rootdse_ops = {
.name = "rootdse",
- .init_context = rootdse_init,
+ .init_context = rootdse_init,
.request = rootdse_request
};
#define FIRST_OP(ldb, op) do { \
module = ldb->modules; \
while (module && module->ops->op == NULL) module = module->next; \
- if (module == NULL) return -1; \
+ if (module == NULL) return LDB_ERR_OPERATIONS_ERROR; \
} while (0)
/*
int ldb_async_wait(struct ldb_context *ldb, struct ldb_async_handle *handle, enum ldb_async_wait_type type)
{
- if (ldb->async_wait != NULL)
- return ldb->async_wait(handle, type);
+ struct ldb_module *module;
+
+ FIRST_OP(ldb, async_wait);
- return LDB_ERR_OPERATIONS_ERROR;
+ return module->ops->async_wait(module, handle, type);
}
/*
#define FIND_OP(module, op) do { \
module = module->next; \
while (module && module->ops->op == NULL) module = module->next; \
- if (module == NULL) return LDB_ERR_OTHER; \
+ if (module == NULL) return LDB_ERR_OPERATIONS_ERROR; \
} while (0)
FIND_OP(module, del_transaction);
return module->ops->del_transaction(module);
}
+
+int ldb_next_async_wait(struct ldb_module *module, struct ldb_async_handle *handle, enum ldb_async_wait_type type)
+{
+ FIND_OP(module, async_wait);
+ return module->ops->async_wait(module, handle, type);
+}
int (*start_transaction)(struct ldb_module *);
int (*end_transaction)(struct ldb_module *);
int (*del_transaction)(struct ldb_module *);
+ int (*async_wait)(struct ldb_module *, struct ldb_async_handle *, enum ldb_async_wait_type);
};
int transaction_active;
- int (*async_wait)(struct ldb_async_handle *, enum ldb_async_wait_type);
-
/* a backend supplied highestCommittedUSN function */
uint64_t (*sequence_number)(struct ldb_context *);
};
}
}
-static int ildb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type)
+static int ildb_async_wait(struct ldb_module *module, struct ldb_async_handle *handle, enum ldb_async_wait_type type)
{
struct ildb_async_context *ac = talloc_get_type(handle->private_data, struct ildb_async_context);
.start_transaction = ildb_start_trans,
.end_transaction = ildb_end_trans,
.del_transaction = ildb_del_trans,
+ .async_wait = ildb_async_wait,
.init_context = ildb_init
};
}
}
- ldb->async_wait = &ildb_async_wait;
-
return 0;
failed:
return handle->status;
}
-static int lldb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type)
+static int lldb_async_wait(struct ldb_module *module, struct ldb_async_handle *handle, enum ldb_async_wait_type type)
{
struct lldb_async_context *ac = talloc_get_type(handle->private_data, struct lldb_async_context);
struct lldb_private *lldb = talloc_get_type(ac->module->private_data, struct lldb_private);
.start_transaction = lldb_start_trans,
.end_transaction = lldb_end_trans,
.del_transaction = lldb_del_trans,
+ .async_wait = lldb_async_wait
};
ldb->modules->private_data = lldb;
ldb->modules->ops = &lldb_ops;
- ldb->async_wait = &lldb_async_wait;
-
return 0;
failed:
static int ltdb_search_sync_callback(struct ldb_context *ldb, void *context, struct ldb_async_result *ares)
{
- struct ldb_result *res;
+ struct ldb_result *res = NULL;
if (!context) {
ldb_set_errstring(ldb, talloc_strdup(ldb, "NULL Context in callback"));
return LDB_SUCCESS;
}
-static int ltdb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type)
+static int ltdb_async_wait(struct ldb_module *module, struct ldb_async_handle *handle, enum ldb_async_wait_type type)
{
return handle->status;
}
.request = ltdb_request,
.start_transaction = ltdb_start_trans,
.end_transaction = ltdb_end_trans,
- .del_transaction = ltdb_del_trans
+ .del_transaction = ltdb_del_trans,
+ .async_wait = ltdb_async_wait
};
ldb->modules->ops = <db_ops;
ldb->sequence_number = ltdb_sequence_number;
- ldb->async_wait = <db_async_wait;
-
return 0;
}