ldb: Add ldb_oom() calls in a couple of places.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 26 Jan 2008 22:49:33 +0000 (23:49 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 26 Jan 2008 22:49:33 +0000 (23:49 +0100)
(This used to be commit 1163c2ad54b122487fa25960b8989f0f6d0b8c64)

source4/dsdb/samdb/ldb_modules/extended_dn.c
source4/dsdb/samdb/ldb_modules/instancetype.c
source4/dsdb/samdb/ldb_modules/kludge_acl.c
source4/dsdb/samdb/ldb_modules/samldb.c

index b62e806398dbf4520d4a5312e74626c42abd2a92..802f86570bb34555e0ed7883852c056d851c2a93 100644 (file)
@@ -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;
        }
 
index 064c28ec6501b83ea6af601ae614a53027d6b332..65df294e90e00f88f2b56a8b5c38b52ac79c19f7 100644 (file)
@@ -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;
        }
 
index 97130495a3adde2df3d54a8427cc366c0080a530..ea33548b919bcfad154c08296129531d004a8da3 100644 (file)
@@ -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++) {
index 8a80260a692d50e8d7fa7a15da84aeb2d3c3d65f..baf419c750def7db6486ab1c11c45a2ad819a7cc 100644 (file)
@@ -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);