summaryrefslogtreecommitdiffstats
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-01-30 19:05:06 +0100
committerGünther Deschner <gd@samba.org>2014-02-13 11:54:17 +0100
commit451d7039fe3f8c2f2e60258a765c55f3d1fc39a4 (patch)
treee5ad0c33205db0cf74f724fe237e8c8968781585 /source4/torture/rpc
parent41eaba77361c984f6d57143a5e1c7c25663c0d84 (diff)
downloadsamba-451d7039fe3f8c2f2e60258a765c55f3d1fc39a4.tar.gz
samba-451d7039fe3f8c2f2e60258a765c55f3d1fc39a4.tar.xz
samba-451d7039fe3f8c2f2e60258a765c55f3d1fc39a4.zip
s4:torture/rpc: make use of dcerpc_binding_[g|s]et_transport()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/lsa.c25
-rw-r--r--source4/torture/rpc/lsa_lookup.c9
-rw-r--r--source4/torture/rpc/scanner.c4
-rw-r--r--source4/torture/rpc/schannel.c15
4 files changed, 31 insertions, 22 deletions
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 7385ad4b911..ed618b7a64a 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -948,6 +948,7 @@ bool test_many_LookupSids(struct dcerpc_pipe *p,
struct lsa_SidArray sids;
int i;
struct dcerpc_binding_handle *b = p->binding_handle;
+ enum dcerpc_transport_t transport = dcerpc_binding_get_transport(p->binding);
torture_comment(tctx, "\nTesting LookupSids with lots of SIDs\n");
@@ -993,14 +994,14 @@ bool test_many_LookupSids(struct dcerpc_pipe *p,
}
}
- if (p->binding->transport == NCACN_NP) {
+ if (transport == NCACN_NP) {
if (!test_LookupSids3_fail(b, tctx, &sids)) {
return false;
}
if (!test_LookupNames4_fail(b, tctx)) {
return false;
}
- } else if (p->binding->transport == NCACN_IP_TCP) {
+ } else if (transport == NCACN_IP_TCP) {
struct lsa_TransNameArray2 names;
names.count = 0;
@@ -3303,15 +3304,17 @@ bool torture_rpc_lsa(struct torture_context *tctx)
struct test_join *join = NULL;
struct cli_credentials *machine_creds;
struct dcerpc_binding_handle *b;
+ enum dcerpc_transport_t transport;
status = torture_rpc_connection(tctx, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
b = p->binding_handle;
+ transport = dcerpc_binding_get_transport(p->binding);
/* Test lsaLookupSids3 and lsaLookupNames4 over tcpip */
- if (p->binding->transport == NCACN_IP_TCP) {
+ if (transport == NCACN_IP_TCP) {
if (!test_OpenPolicy_fail(b, tctx)) {
ret = false;
}
@@ -3394,14 +3397,16 @@ bool torture_rpc_lsa_get_user(struct torture_context *tctx)
struct dcerpc_pipe *p;
bool ret = true;
struct dcerpc_binding_handle *b;
+ enum dcerpc_transport_t transport;
status = torture_rpc_connection(tctx, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
b = p->binding_handle;
+ transport = dcerpc_binding_get_transport(p->binding);
- if (p->binding->transport == NCACN_IP_TCP) {
+ if (transport == NCACN_IP_TCP) {
if (!test_GetUserName_fail(b, tctx)) {
ret = false;
}
@@ -3423,9 +3428,9 @@ static bool testcase_LookupNames(struct torture_context *tctx,
struct lsa_TransNameArray tnames;
struct lsa_TransNameArray2 tnames2;
struct dcerpc_binding_handle *b = p->binding_handle;
+ enum dcerpc_transport_t transport = dcerpc_binding_get_transport(p->binding);
- if (p->binding->transport != NCACN_NP &&
- p->binding->transport != NCALRPC) {
+ if (transport != NCACN_NP && transport != NCALRPC) {
torture_comment(tctx, "testcase_LookupNames is only available "
"over NCACN_NP or NCALRPC");
return true;
@@ -3514,9 +3519,9 @@ static bool testcase_TrustedDomains(struct torture_context *tctx,
struct lsa_trustdom_state *state =
talloc_get_type_abort(data, struct lsa_trustdom_state);
struct dcerpc_binding_handle *b = p->binding_handle;
+ enum dcerpc_transport_t transport = dcerpc_binding_get_transport(p->binding);
- if (p->binding->transport != NCACN_NP &&
- p->binding->transport != NCALRPC) {
+ if (transport != NCACN_NP && transport != NCALRPC) {
torture_comment(tctx, "testcase_TrustedDomains is only available "
"over NCACN_NP or NCALRPC");
return true;
@@ -3581,9 +3586,9 @@ static bool testcase_Privileges(struct torture_context *tctx,
{
struct policy_handle *handle;
struct dcerpc_binding_handle *b = p->binding_handle;
+ enum dcerpc_transport_t transport = dcerpc_binding_get_transport(p->binding);
- if (p->binding->transport != NCACN_NP &&
- p->binding->transport != NCALRPC) {
+ if (transport != NCACN_NP && transport != NCALRPC) {
torture_skip(tctx, "testcase_Privileges is only available "
"over NCACN_NP or NCALRPC");
}
diff --git a/source4/torture/rpc/lsa_lookup.c b/source4/torture/rpc/lsa_lookup.c
index 587ab630bd7..59decda1710 100644
--- a/source4/torture/rpc/lsa_lookup.c
+++ b/source4/torture/rpc/lsa_lookup.c
@@ -221,15 +221,16 @@ bool torture_rpc_lsa_lookup(struct torture_context *torture)
struct dom_sid *trusted_sid = NULL;
struct dom_sid *sids[NUM_SIDS];
struct dcerpc_binding_handle *b;
+ enum dcerpc_transport_t transport;
status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
if (!NT_STATUS_IS_OK(status)) {
torture_fail(torture, "unable to connect to table");
}
b = p->binding_handle;
+ transport = dcerpc_binding_get_transport(p->binding);
- if (p->binding->transport != NCACN_NP &&
- p->binding->transport != NCALRPC) {
+ if (transport != NCACN_NP && transport != NCALRPC) {
torture_comment(torture,
"torture_rpc_lsa_lookup is only available "
"over NCACN_NP or NCALRPC");
@@ -343,9 +344,9 @@ static bool test_LookupSidsReply(struct torture_context *tctx,
const char *dom_sid = "S-1-5-21-1111111111-2222222222-3333333333";
const char *dom_admin_sid;
struct dcerpc_binding_handle *b = p->binding_handle;
+ enum dcerpc_transport_t transport = dcerpc_binding_get_transport(p->binding);
- if (p->binding->transport != NCACN_NP &&
- p->binding->transport != NCALRPC) {
+ if (transport != NCACN_NP && transport != NCALRPC) {
torture_comment(tctx,
"test_LookupSidsReply is only available "
"over NCACN_NP or NCALRPC");
diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c
index 5edd5040351..e910bddedc5 100644
--- a/source4/torture/rpc/scanner.c
+++ b/source4/torture/rpc/scanner.c
@@ -122,11 +122,13 @@ bool torture_rpc_scanner(struct torture_context *torture)
bool ret = true;
const struct ndr_interface_list *l;
struct dcerpc_binding *b;
+ enum dcerpc_transport_t transport;
status = torture_rpc_binding(torture, &b);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
+ transport = dcerpc_binding_get_transport(b);
for (l=ndr_table_list();l;l=l->next) {
loop_ctx = talloc_named(torture, 0, "torture_rpc_scanner loop context");
@@ -139,7 +141,7 @@ bool torture_rpc_scanner(struct torture_context *torture)
printf("\nTesting pipe '%s'\n", l->table->name);
- if (b->transport == NCACN_IP_TCP) {
+ if (transport == NCACN_IP_TCP) {
status = dcerpc_epm_map_binding(torture, b, l->table,
torture->ev,
torture->lp_ctx);
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index 0098dcf648d..a1856c13f6e 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -426,8 +426,9 @@ static bool test_schannel(struct torture_context *tctx,
"Failed to process schannel secured NETLOGON EX ops");
/* we *MUST* use ncacn_np for openpolicy etc. */
- transport = b->transport;
- b->transport = NCACN_NP;
+ transport = dcerpc_binding_get_transport(b);
+ status = dcerpc_binding_set_transport(b, NCACN_NP);
+ torture_assert_ntstatus_ok(tctx, status, "set transport");
/* Swap the binding details from SAMR to LSARPC */
status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, tctx->ev, tctx->lp_ctx);
@@ -444,11 +445,9 @@ static bool test_schannel(struct torture_context *tctx,
talloc_free(p_lsa);
p_lsa = NULL;
- b->transport = transport;
-
/* we *MUST* use ncacn_ip_tcp for lookupsids3/lookupnames4 */
- transport = b->transport;
- b->transport = NCACN_IP_TCP;
+ status = dcerpc_binding_set_transport(b, NCACN_IP_TCP);
+ torture_assert_ntstatus_ok(tctx, status, "set transport");
torture_assert_ntstatus_ok(tctx,
dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, tctx->ev, tctx->lp_ctx),
@@ -463,7 +462,9 @@ static bool test_schannel(struct torture_context *tctx,
test_many_LookupSids(p_lsa, tctx, NULL),
"LsaLookupSids3 failed!\n");
- b->transport = transport;
+ status = dcerpc_binding_set_transport(b, transport);
+ torture_assert_ntstatus_ok(tctx, status, "set transport");
+
/* Drop the socket, we want to start from scratch */
talloc_free(p);