summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-12-16 10:57:17 +0000
committerAndrew Tridgell <tridge@samba.org>2003-12-16 10:57:17 +0000
commit6ba28732ec830e824ba5ffc7acbe7a3efc501038 (patch)
tree7278bebe0d4edc6abe2f591738bd3aeb570579fe /source4/torture
parentecc25195945bdaa6d9ac20b7ac7bf2a1fb6c62f3 (diff)
downloadsamba-6ba28732ec830e824ba5ffc7acbe7a3efc501038.tar.gz
samba-6ba28732ec830e824ba5ffc7acbe7a3efc501038.tar.bz2
samba-6ba28732ec830e824ba5ffc7acbe7a3efc501038.zip
fixed the RPC-MGMT and RPC-SCANNER tests to work with the new
dcerpc_binding_string code (This used to be commit 1fa68c18facfb6c96d5a274cfd9560cb4b2956f6)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/mgmt.c44
-rw-r--r--source4/torture/rpc/scanner.c43
2 files changed, 61 insertions, 26 deletions
diff --git a/source4/torture/rpc/mgmt.c b/source4/torture/rpc/mgmt.c
index 3a50732c7e..b41e24976f 100644
--- a/source4/torture/rpc/mgmt.c
+++ b/source4/torture/rpc/mgmt.c
@@ -173,14 +173,29 @@ BOOL torture_rpc_mgmt(int dummy)
TALLOC_CTX *mem_ctx;
BOOL ret = True;
int i;
- char *host = lp_parm_string(-1, "torture", "host");
- uint32 port;
+ char *binding = lp_parm_string(-1, "torture", "binding");
+ struct dcerpc_binding b;
mem_ctx = talloc_init("torture_rpc_mgmt");
- for (i=0;dcerpc_pipes[i];i++) {
- char *transport = lp_parm_string(-1, "torture", "transport");
+ if (!binding) {
+ 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)) {
+ printf("Failed to parse binding '%s'\n", binding);
+ return False;
+ }
+ b.options = talloc_array_p(mem_ctx, const char *, 2);
+ if (!b.options) {
+ return False;
+ }
+
+
+ for (i=0;dcerpc_pipes[i];i++) {
/* some interfaces are not mappable */
if (dcerpc_pipes[i]->num_calls == 0 ||
strcmp(dcerpc_pipes[i]->name, "mgmt") == 0) {
@@ -189,20 +204,23 @@ BOOL torture_rpc_mgmt(int dummy)
printf("\nTesting pipe '%s'\n", dcerpc_pipes[i]->name);
- /* on TCP we need to find the right endpoint */
- if (strcasecmp(transport, "ncacn_ip_tcp") == 0) {
- status = dcerpc_epm_map_tcp_port(host,
- dcerpc_pipes[i]->uuid,
- dcerpc_pipes[i]->if_version,
+ if (b.transport == NCACN_IP_TCP) {
+ uint32 port;
+ status = dcerpc_epm_map_tcp_port(b.host,
+ dcerpc_pipes[i]->uuid,
+ dcerpc_pipes[i]->if_version,
&port);
if (!NT_STATUS_IS_OK(status)) {
- ret = False;
+ printf("Failed to map port for uuid %s\n", dcerpc_pipes[i]->uuid);
continue;
}
-
- lp_set_cmdline("torture:share",
- talloc_asprintf(mem_ctx, "%u", port));
+ b.options[0] = talloc_asprintf(mem_ctx, "%u", port);
+ } else {
+ b.options[0] = dcerpc_pipes[i]->name;
}
+ b.options[1] = NULL;
+
+ lp_set_cmdline("torture:binding", dcerpc_binding_string(mem_ctx, &b));
status = torture_rpc_connection(&p,
dcerpc_pipes[i]->name,
diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c
index 99c047bf2e..944bb4372d 100644
--- a/source4/torture/rpc/scanner.c
+++ b/source4/torture/rpc/scanner.c
@@ -134,14 +134,28 @@ BOOL torture_rpc_scanner(int dummy)
TALLOC_CTX *mem_ctx;
BOOL ret = True;
int i;
- char *host = lp_parm_string(-1, "torture", "host");
- uint32 port;
+ char *binding = lp_parm_string(-1, "torture", "binding");
+ struct dcerpc_binding b;
mem_ctx = talloc_init("torture_rpc_scanner");
- for (i=0;dcerpc_pipes[i];i++) {
- char *transport = lp_parm_string(-1, "torture", "transport");
+ if (!binding) {
+ 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)) {
+ printf("Failed to parse binding '%s'\n", binding);
+ return False;
+ }
+ b.options = talloc_array_p(mem_ctx, const char *, 2);
+ if (!b.options) {
+ return False;
+ }
+
+ for (i=0;dcerpc_pipes[i];i++) {
/* some interfaces are not mappable */
if (dcerpc_pipes[i]->num_calls == 0 ||
strcmp(dcerpc_pipes[i]->name, "mgmt") == 0) {
@@ -150,20 +164,23 @@ BOOL torture_rpc_scanner(int dummy)
printf("\nTesting pipe '%s'\n", dcerpc_pipes[i]->name);
- /* on TCP we need to find the right endpoint */
- if (strcasecmp(transport, "ncacn_ip_tcp") == 0) {
- status = dcerpc_epm_map_tcp_port(host,
- dcerpc_pipes[i]->uuid,
- dcerpc_pipes[i]->if_version,
+ if (b.transport == NCACN_IP_TCP) {
+ uint32 port;
+ status = dcerpc_epm_map_tcp_port(b.host,
+ dcerpc_pipes[i]->uuid,
+ dcerpc_pipes[i]->if_version,
&port);
if (!NT_STATUS_IS_OK(status)) {
- ret = False;
+ printf("Failed to map port for uuid %s\n", dcerpc_pipes[i]->uuid);
continue;
}
-
- lp_set_cmdline("torture:share",
- talloc_asprintf(mem_ctx, "%u", port));
+ b.options[0] = talloc_asprintf(mem_ctx, "%u", port);
+ } else {
+ b.options[0] = dcerpc_pipes[i]->name;
}
+ b.options[1] = NULL;
+
+ lp_set_cmdline("torture:binding", dcerpc_binding_string(mem_ctx, &b));
status = torture_rpc_connection(&p,
dcerpc_pipes[i]->name,