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/resolve_oids.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/resolve_oids.c')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/resolve_oids.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/resolve_oids.c b/source4/dsdb/samdb/ldb_modules/resolve_oids.c index 5ff246b191..aab997d996 100644 --- a/source4/dsdb/samdb/ldb_modules/resolve_oids.c +++ b/source4/dsdb/samdb/ldb_modules/resolve_oids.c @@ -464,7 +464,7 @@ static int resolve_oids_search(struct ldb_module *module, struct ldb_request *re uint32_t i; ldb = ldb_module_get_ctx(module); - schema = dsdb_get_schema(ldb); + schema = dsdb_get_schema(ldb, NULL); if (!schema) { return ldb_next_request(module, req); @@ -487,7 +487,7 @@ static int resolve_oids_search(struct ldb_module *module, struct ldb_request *re for (i=0; attrs1 && attrs1[i]; i++) { const char *p; - struct dsdb_attribute *a; + const struct dsdb_attribute *a; p = strchr(attrs1[i], '.'); if (p == NULL) { @@ -521,6 +521,8 @@ static int resolve_oids_search(struct ldb_module *module, struct ldb_request *re return LDB_ERR_OPERATIONS_ERROR; } + talloc_reference(tree, schema); + ret = resolve_oids_parse_tree_replace(ldb, schema, tree); if (ret != LDB_SUCCESS) { @@ -576,7 +578,7 @@ static int resolve_oids_add(struct ldb_module *module, struct ldb_request *req) struct resolve_oids_context *ac; ldb = ldb_module_get_ctx(module); - schema = dsdb_get_schema(ldb); + schema = dsdb_get_schema(ldb, NULL); if (!schema) { return ldb_next_request(module, req); @@ -609,6 +611,11 @@ static int resolve_oids_add(struct ldb_module *module, struct ldb_request *req) return LDB_ERR_OPERATIONS_ERROR; } + if (!talloc_reference(msg, schema)) { + ldb_oom(ldb); + return LDB_ERR_OPERATIONS_ERROR; + } + ret = resolve_oids_message_replace(ldb, schema, msg); if (ret != LDB_SUCCESS) { return ret; @@ -637,7 +644,7 @@ static int resolve_oids_modify(struct ldb_module *module, struct ldb_request *re struct resolve_oids_context *ac; ldb = ldb_module_get_ctx(module); - schema = dsdb_get_schema(ldb); + schema = dsdb_get_schema(ldb, NULL); if (!schema) { return ldb_next_request(module, req); @@ -671,6 +678,11 @@ static int resolve_oids_modify(struct ldb_module *module, struct ldb_request *re return LDB_ERR_OPERATIONS_ERROR; } + if (!talloc_reference(msg, schema)) { + ldb_oom(ldb); + return LDB_ERR_OPERATIONS_ERROR; + } + ret = resolve_oids_message_replace(ldb, schema, msg); if (ret != LDB_SUCCESS) { return ret; |