summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/autoidl.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-03-22 08:00:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:11 -0500
commit645711c602313940dcf80ec786557920ecfbf884 (patch)
tree77c5f5c5f1285677eaaf7a3fa62bf0b2540e153f /source4/torture/rpc/autoidl.c
parent376b03ebd895b221b70058ee18bea50587388182 (diff)
downloadsamba-645711c602313940dcf80ec786557920ecfbf884.tar.gz
samba-645711c602313940dcf80ec786557920ecfbf884.tar.bz2
samba-645711c602313940dcf80ec786557920ecfbf884.zip
r5941: Commit this patch much earlier than I would normally prefer, but metze needs a working tree...
The main volume of this patch was what I started working on today: - Cleans up memory handling around DCE/RPC pipes, to have a parent talloc context. - Uses sepereate inner loops for some of the DCE/RPC tests The other and more important part of this patch fixes issues surrounding the new credentials framwork: This makes the struct cli_credentials always a talloc() structure, rather than on the stack. Parts of the cli_credentials code already assumed this. There were other issues, particularly in the DCERPC over SMB handling, as well as little things that had to be tidied up before test_w2k3.sh would start to pass. Andrew Bartlett (This used to be commit 0453f9d05d2e336fba1f85dbf2718d01fa2bf778)
Diffstat (limited to 'source4/torture/rpc/autoidl.c')
-rw-r--r--source4/torture/rpc/autoidl.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/source4/torture/rpc/autoidl.c b/source4/torture/rpc/autoidl.c
index 0df88d2bf6..3bf8f0e2c8 100644
--- a/source4/torture/rpc/autoidl.c
+++ b/source4/torture/rpc/autoidl.c
@@ -84,15 +84,17 @@ static void fill_blob_handle(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
memcpy(blob->data, b2.data, 20);
}
-static void reopen(struct dcerpc_pipe **p, const struct dcerpc_interface_table *iface)
+static void reopen(TALLOC_CTX *mem_ctx,
+ struct dcerpc_pipe **p,
+ const struct dcerpc_interface_table *iface)
{
NTSTATUS status;
- if (*p) {
- dcerpc_pipe_close(*p);
- }
+ talloc_free(*p);
- status = torture_rpc_connection(p, iface->endpoints->names[0], iface->uuid, iface->if_version);
+ status = torture_rpc_connection(mem_ctx,
+ p, iface->endpoints->names[0],
+ iface->uuid, iface->if_version);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to reopen '%s' - %s\n", iface->name, nt_errstr(status));
exit(1);
@@ -118,7 +120,7 @@ static void try_expand(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_table
NTSTATUS status;
struct dcerpc_pipe *p = NULL;
- reopen(&p, iface);
+ reopen(mem_ctx, &p, iface);
/* work out how much to expand to get a non fault */
for (n=0;n<2000;n++) {
@@ -144,11 +146,11 @@ static void try_expand(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_table
#endif
}
if (p->last_fault_code == 5) {
- reopen(&p, iface);
+ reopen(mem_ctx, &p, iface);
}
}
- dcerpc_pipe_close(p);
+ talloc_free(p);
}
@@ -160,7 +162,7 @@ static void test_ptr_scan(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_tab
NTSTATUS status;
struct dcerpc_pipe *p = NULL;
- reopen(&p, iface);
+ reopen(mem_ctx, &p, iface);
stub_in = data_blob(NULL, base_in->length);
memcpy(stub_in.data, base_in->data, base_in->length);
@@ -175,7 +177,7 @@ static void test_ptr_scan(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_tab
printf("possible ptr at ofs %d - fault %s\n",
ofs-min_ofs, dcerpc_errstr(mem_ctx, p->last_fault_code));
if (p->last_fault_code == 5) {
- reopen(&p, iface);
+ reopen(mem_ctx, &p, iface);
}
if (depth == 0) {
try_expand(mem_ctx, iface, opnum, &stub_in, ofs+4, depth+1);
@@ -188,7 +190,7 @@ static void test_ptr_scan(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_tab
SIVAL(stub_in.data, ofs, 0);
}
- dcerpc_pipe_close(p);
+ talloc_free(p);
}
@@ -200,7 +202,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_ta
struct dcerpc_pipe *p = NULL;
struct policy_handle handle;
- reopen(&p, iface);
+ reopen(mem_ctx, &p, iface);
get_policy_handle(p, mem_ctx, &handle);
@@ -216,7 +218,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_ta
printf("opnum %d min_input %d - output %d\n",
opnum, stub_in.length, stub_out.length);
dump_data(0, stub_out.data, stub_out.length);
- dcerpc_pipe_close(p);
+ talloc_free(p);
test_ptr_scan(mem_ctx, iface, opnum, &stub_in, 0, stub_in.length, 0);
return;
}
@@ -229,7 +231,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_ta
printf("opnum %d min_input %d - output %d (with handle)\n",
opnum, stub_in.length, stub_out.length);
dump_data(0, stub_out.data, stub_out.length);
- dcerpc_pipe_close(p);
+ talloc_free(p);
test_ptr_scan(mem_ctx, iface, opnum, &stub_in, 0, stub_in.length, 0);
return;
}
@@ -237,7 +239,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_ta
if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
printf("opnum %d size %d fault %s\n", opnum, i, dcerpc_errstr(mem_ctx, p->last_fault_code));
if (p->last_fault_code == 5) {
- reopen(&p, iface);
+ reopen(mem_ctx, &p, iface);
}
continue;
}
@@ -246,7 +248,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_ta
}
printf("opnum %d minimum not found!?\n", opnum);
- dcerpc_pipe_close(p);
+ talloc_free(p);
}
@@ -272,5 +274,6 @@ BOOL torture_rpc_autoidl(void)
test_auto_scan(mem_ctx, iface);
+ talloc_free(mem_ctx);
return True;
}