[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha2-587-gf5ea5de

Jelmer Vernooij jelmer at samba.org
Mon Jan 28 14:01:54 GMT 2008


The branch, v4-0-test has been updated
       via  f5ea5de797f4fe35baf4f2bcd2913902c6703f44 (commit)
       via  1163c2ad54b122487fa25960b8989f0f6d0b8c64 (commit)
      from  079200b824de6dd8c7de3e5b76ed1805fde02965 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit f5ea5de797f4fe35baf4f2bcd2913902c6703f44
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Jan 28 02:49:44 2008 +0100

    torture: Fix too early free in spoolss notify test.

commit 1163c2ad54b122487fa25960b8989f0f6d0b8c64
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sat Jan 26 23:49:33 2008 +0100

    ldb: Add ldb_oom() calls in a couple of places.

-----------------------------------------------------------------------

Summary of changes:
 source/dsdb/samdb/ldb_modules/extended_dn.c  |    7 ++++++-
 source/dsdb/samdb/ldb_modules/instancetype.c |    2 ++
 source/dsdb/samdb/ldb_modules/kludge_acl.c   |    5 +++++
 source/dsdb/samdb/ldb_modules/samldb.c       |    6 +++++-
 source/torture/rpc/spoolss_notify.c          |   11 ++++++-----
 5 files changed, 24 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/dsdb/samdb/ldb_modules/extended_dn.c b/source/dsdb/samdb/ldb_modules/extended_dn.c
index b62e806..802f865 100644
--- a/source/dsdb/samdb/ldb_modules/extended_dn.c
+++ b/source/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/source/dsdb/samdb/ldb_modules/instancetype.c b/source/dsdb/samdb/ldb_modules/instancetype.c
index 064c28e..65df294 100644
--- a/source/dsdb/samdb/ldb_modules/instancetype.c
+++ b/source/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/source/dsdb/samdb/ldb_modules/kludge_acl.c b/source/dsdb/samdb/ldb_modules/kludge_acl.c
index 9713049..ea33548 100644
--- a/source/dsdb/samdb/ldb_modules/kludge_acl.c
+++ b/source/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/source/dsdb/samdb/ldb_modules/samldb.c b/source/dsdb/samdb/ldb_modules/samldb.c
index 8a80260..baf419c 100644
--- a/source/dsdb/samdb/ldb_modules/samldb.c
+++ b/source/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);
diff --git a/source/torture/rpc/spoolss_notify.c b/source/torture/rpc/spoolss_notify.c
index 0065101..96db7d1 100644
--- a/source/torture/rpc/spoolss_notify.c
+++ b/source/torture/rpc/spoolss_notify.c
@@ -69,7 +69,8 @@ static NTSTATUS spoolss__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_
 	return NT_STATUS_OK;
 }
 
-/* FIXME: What context does this belong in ? -- JRV20070903 */
+/* Note that received_packets are allocated in talloc_autofree_context(), 
+ * because no other context appears to stay around long enough. */
 static struct received_packet {
 	uint16_t opnum;
 	void *r;
@@ -82,9 +83,9 @@ static NTSTATUS spoolss__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_
 	uint16_t opnum = dce_call->pkt.u.request.opnum;
 	struct received_packet *rp;
 
-	rp = talloc_zero(mem_ctx, struct received_packet);
+	rp = talloc_zero(talloc_autofree_context(), struct received_packet);
 	rp->opnum = opnum;
-	rp->r = talloc_reference(mem_ctx, r);
+	rp->r = talloc_reference(rp, r);
 
 	DLIST_ADD_END(received_packets, rp, struct received_packet *);
 
@@ -195,6 +196,8 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
 	const char *address;
 	struct interface *ifaces;
 
+	received_packets = NULL;
+
 	ntvfs_init(tctx->lp_ctx);
 
 	ZERO_STRUCT(q);
@@ -239,7 +242,6 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
 	torture_assert_ntstatus_ok(tctx, status, 
 				   "unable to initialize DCE/RPC server");
 
-
 	r.in.flags = 0;
 	r.in.str = talloc_asprintf(tctx, "\\\\%s", address);
 	r.in.options = 0;
@@ -261,7 +263,6 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
 	r.in.t1 = &t1;
 	r.in.handle = &handle;
 
-
 	status = dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx(p, tctx, &r);
 
 	torture_assert_ntstatus_ok(tctx, status, "FFPCNEx failed");


-- 
Samba Shared Repository


More information about the samba-cvs mailing list