From 9ad04b695b7b9b35eae37da375be07bd23d7fa8c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 26 Jan 2008 23:49:33 +0100 Subject: ldb: Add ldb_oom() calls in a couple of places. (This used to be commit 1163c2ad54b122487fa25960b8989f0f6d0b8c64) --- source4/dsdb/samdb/ldb_modules/extended_dn.c | 7 ++++++- source4/dsdb/samdb/ldb_modules/instancetype.c | 2 ++ source4/dsdb/samdb/ldb_modules/kludge_acl.c | 5 +++++ source4/dsdb/samdb/ldb_modules/samldb.c | 6 +++++- 4 files changed, 18 insertions(+), 2 deletions(-) (limited to 'source4/dsdb') diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn.c b/source4/dsdb/samdb/ldb_modules/extended_dn.c index b62e806398d..802f86570bb 100644 --- a/source4/dsdb/samdb/ldb_modules/extended_dn.c +++ b/source4/dsdb/samdb/ldb_modules/extended_dn.c @@ -256,6 +256,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req) ac = talloc(req, struct extended_context); if (ac == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -273,6 +274,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req) down_req = talloc_zero(req, struct ldb_request); if (down_req == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -291,8 +293,10 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req) } if (ac->remove_guid || ac->remove_sid) { new_attrs = copy_attrs(down_req, req->op.search.attrs); - if (new_attrs == NULL) + if (new_attrs == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; + } if (ac->remove_guid) { if (!add_attrs(down_req, &new_attrs, "objectGUID")) @@ -339,6 +343,7 @@ static int extended_init(struct ldb_module *module) req = talloc(module, struct ldb_request); if (req == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c index 064c28ec650..65df294e90e 100644 --- a/source4/dsdb/samdb/ldb_modules/instancetype.c +++ b/source4/dsdb/samdb/ldb_modules/instancetype.c @@ -72,6 +72,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req) down_req = talloc(req, struct ldb_request); if (down_req == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -81,6 +82,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req) down_req->op.add.message = msg = ldb_msg_copy_shallow(down_req, req->op.add.message); if (msg == NULL) { talloc_free(down_req); + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source4/dsdb/samdb/ldb_modules/kludge_acl.c b/source4/dsdb/samdb/ldb_modules/kludge_acl.c index 97130495a3a..ea33548b919 100644 --- a/source4/dsdb/samdb/ldb_modules/kludge_acl.c +++ b/source4/dsdb/samdb/ldb_modules/kludge_acl.c @@ -316,6 +316,7 @@ static int kludge_acl_search(struct ldb_module *module, struct ldb_request *req) ac = talloc(req, struct kludge_acl_context); if (ac == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -329,6 +330,7 @@ static int kludge_acl_search(struct ldb_module *module, struct ldb_request *req) down_req = talloc_zero(req, struct ldb_request); if (down_req == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -417,6 +419,7 @@ static int kludge_acl_init(struct ldb_module *module) data = talloc(module, struct kludge_private_data); if (data == NULL) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -424,6 +427,7 @@ static int kludge_acl_init(struct ldb_module *module) module->private_data = data; if (!mem_ctx) { + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -453,6 +457,7 @@ static int kludge_acl_init(struct ldb_module *module) data->password_attrs = talloc_array(data, const char *, password_attributes->num_values + 1); if (!data->password_attrs) { talloc_free(mem_ctx); + ldb_oom(module->ldb); return LDB_ERR_OPERATIONS_ERROR; } for (i=0; i < password_attributes->num_values; i++) { diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 8a80260a692..baf419c750d 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -72,7 +72,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, if (new_id == 0) { /* out of IDs ! */ - ldb_debug(ldb, LDB_DEBUG_FATAL, "Are we out of valid IDs ?\n"); + ldb_set_errstring(ldb, "Are we out of valid IDs ?\n"); return LDB_ERR_OPERATIONS_ERROR; } @@ -81,6 +81,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, ZERO_STRUCT(msg); msg.dn = ldb_dn_copy(mem_ctx, dn); if (!msg.dn) { + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } msg.num_elements = 2; @@ -91,6 +92,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, els[0].flags = LDB_FLAG_MOD_DELETE; els[0].name = talloc_strdup(mem_ctx, "nextRid"); if (!els[0].name) { + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } @@ -101,12 +103,14 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, vals[0].data = (uint8_t *)talloc_asprintf(mem_ctx, "%u", old_id); if (!vals[0].data) { + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } vals[0].length = strlen((char *)vals[0].data); vals[1].data = (uint8_t *)talloc_asprintf(mem_ctx, "%u", new_id); if (!vals[1].data) { + ldb_oom(ldb); return LDB_ERR_OPERATIONS_ERROR; } vals[1].length = strlen((char *)vals[1].data); -- cgit