diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-03-16 14:52:39 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-03-16 19:26:03 +1100 |
commit | 2de07761e071ccf09c0ea9e0fdc6a61303356549 (patch) | |
tree | 8d95f00365a32c81e001768fc2aa0aa8c866accb /source4/dsdb/samdb/ldb_modules/schema_data.c | |
parent | bf0b4d7ee3f52f77d706ccea12abb2f033b4abd9 (diff) | |
download | samba-2de07761e071ccf09c0ea9e0fdc6a61303356549.tar.gz samba-2de07761e071ccf09c0ea9e0fdc6a61303356549.tar.bz2 samba-2de07761e071ccf09c0ea9e0fdc6a61303356549.zip |
s4:dsdb Change dsdb_get_schema() callers to use new talloc argument
This choses an appropriate talloc context to attach the schema too,
long enough lived to ensure it does not go away before the operation
compleates.
Andrew Bartlett
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/schema_data.c')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/schema_data.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/schema_data.c b/source4/dsdb/samdb/ldb_modules/schema_data.c index 20c85e28bd..c71a01d630 100644 --- a/source4/dsdb/samdb/ldb_modules/schema_data.c +++ b/source4/dsdb/samdb/ldb_modules/schema_data.c @@ -105,7 +105,7 @@ static int schema_data_init(struct ldb_module *module) } ldb = ldb_module_get_ctx(module); - schema_dn = samdb_schema_dn(ldb); + schema_dn = ldb_get_schema_basedn(ldb); if (!schema_dn) { ldb_reset_err_string(ldb); ldb_debug(ldb, LDB_DEBUG_WARNING, @@ -154,7 +154,7 @@ static int schema_data_add(struct ldb_module *module, struct ldb_request *req) return ldb_next_request(module, req); } - schema = dsdb_get_schema(ldb); + schema = dsdb_get_schema(ldb, req); if (!schema) { return ldb_next_request(module, req); } @@ -417,7 +417,7 @@ static int schema_data_search(struct ldb_module *module, struct ldb_request *req int ret; struct schema_data_search_data *search_context; struct ldb_request *down_req; - struct dsdb_schema *schema = dsdb_get_schema(ldb); + struct dsdb_schema *schema = dsdb_get_schema(ldb, NULL); if (!schema || !ldb_module_get_private(module)) { /* If there is no schema, there is little we can do */ @@ -442,7 +442,11 @@ static int schema_data_search(struct ldb_module *module, struct ldb_request *req search_context->module = module; search_context->req = req; - search_context->schema = schema; + search_context->schema = talloc_reference(search_context, schema); + if (!search_context->schema) { + ldb_oom(ldb); + return LDB_ERR_OPERATIONS_ERROR; + } ret = ldb_build_search_req_ex(&down_req, ldb, search_context, req->op.search.base, |