1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

s4-dsdb: added dsdb_module_add()

added a ldb add function for modules

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andrew Tridgell 2010-01-06 09:17:19 +11:00
parent fcfb5d7b63
commit f137f93e09

View File

@ -391,6 +391,52 @@ int dsdb_module_rename(struct ldb_module *module,
return ret; return ret;
} }
/*
a ldb_add request operating on modules below the
current module
*/
int dsdb_module_add(struct ldb_module *module,
const struct ldb_message *message,
uint32_t dsdb_flags)
{
struct ldb_request *req;
int ret;
struct ldb_context *ldb = ldb_module_get_ctx(module);
TALLOC_CTX *tmp_ctx = talloc_new(module);
ret = ldb_build_add_req(&req, ldb, tmp_ctx,
message,
NULL,
NULL,
ldb_op_default_callback,
NULL);
if (ret != LDB_SUCCESS) {
talloc_free(tmp_ctx);
return ret;
}
ret = dsdb_request_add_controls(module, req, dsdb_flags);
if (ret != LDB_SUCCESS) {
talloc_free(tmp_ctx);
return ret;
}
/* Run the new request */
if (dsdb_flags & DSDB_FLAG_OWN_MODULE) {
const struct ldb_module_ops *ops = ldb_module_get_ops(module);
ret = ops->add(module, req);
} else {
ret = ldb_next_request(module, req);
}
if (ret == LDB_SUCCESS) {
ret = ldb_wait(req->handle, LDB_WAIT_ALL);
}
talloc_free(tmp_ctx);
return ret;
}
const struct dsdb_class * get_last_structural_class(const struct dsdb_schema *schema,const struct ldb_message_element *element) const struct dsdb_class * get_last_structural_class(const struct dsdb_schema *schema,const struct ldb_message_element *element)
{ {
const struct dsdb_class *last_class = NULL; const struct dsdb_class *last_class = NULL;