summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/scanner.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/scanner.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/scanner.c')
-rw-r--r--source4/torture/rpc/scanner.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c
index 3d78d7a888..d7a5d03271 100644
--- a/source4/torture/rpc/scanner.c
+++ b/source4/torture/rpc/scanner.c
@@ -39,7 +39,8 @@ static BOOL test_num_calls(const struct dcerpc_interface_table *iface,
uuid = GUID_string(mem_ctx, &id->uuid);
- status = torture_rpc_connection(&p, iface->name,
+ status = torture_rpc_connection(mem_ctx,
+ &p, iface->name,
uuid, id->if_version);
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to '%s' on '%s' - %s\n",
@@ -80,7 +81,7 @@ static BOOL test_num_calls(const struct dcerpc_interface_table *iface,
}
done:
- torture_rpc_close(p);
+ talloc_free(p);
return True;
}
@@ -132,7 +133,7 @@ BOOL torture_rpc_scanner(void)
{
NTSTATUS status;
struct dcerpc_pipe *p;
- TALLOC_CTX *mem_ctx;
+ TALLOC_CTX *mem_ctx, *loop_ctx;
BOOL ret = True;
const struct dcerpc_interface_list *l;
const char *binding = lp_parm_string(-1, "torture", "binding");
@@ -141,20 +142,24 @@ BOOL torture_rpc_scanner(void)
mem_ctx = talloc_init("torture_rpc_scanner");
if (!binding) {
+ talloc_free(mem_ctx);
printf("You must supply a ncacn binding string\n");
return False;
}
status = dcerpc_parse_binding(mem_ctx, binding, &b);
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(mem_ctx);
printf("Failed to parse binding '%s'\n", binding);
return False;
}
for (l=librpc_dcerpc_pipes();l;l=l->next) {
+ loop_ctx = talloc_named(mem_ctx, 0, "torture_rpc_scanner loop context");
/* some interfaces are not mappable */
if (l->table->num_calls == 0 ||
strcmp(l->table->name, "mgmt") == 0) {
+ talloc_free(loop_ctx);
continue;
}
@@ -165,6 +170,7 @@ BOOL torture_rpc_scanner(void)
l->table->uuid,
l->table->if_version);
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(loop_ctx);
printf("Failed to map port for uuid %s\n", l->table->uuid);
continue;
}
@@ -174,11 +180,13 @@ BOOL torture_rpc_scanner(void)
lp_set_cmdline("torture:binding", dcerpc_binding_string(mem_ctx, b));
- status = torture_rpc_connection(&p,
+ status = torture_rpc_connection(loop_ctx,
+ &p,
l->table->name,
DCERPC_MGMT_UUID,
DCERPC_MGMT_VERSION);
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(loop_ctx);
ret = False;
continue;
}
@@ -186,8 +194,6 @@ BOOL torture_rpc_scanner(void)
if (!test_inq_if_ids(p, mem_ctx, l->table)) {
ret = False;
}
-
- torture_rpc_close(p);
}
return ret;