summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-04-09 09:03:43 +0200
committerStefan Metzmacher <metze@samba.org>2010-04-09 16:28:31 +0200
commit0bf6043df9a769784e427217737f917501f26466 (patch)
treeed8d089b55375e3802dc1ee8451155a323919d56
parent5844a7dfe6a952500456a6bc3acbe9566d830a2a (diff)
downloadsamba-0bf6043df9a769784e427217737f917501f26466.tar.gz
samba-0bf6043df9a769784e427217737f917501f26466.tar.bz2
samba-0bf6043df9a769784e427217737f917501f26466.zip
RPC-ALTERCONTEXT: let the test pass against w2k3 and w2k8
The behavior between w2k3 and w2k8 differs: - w2k3 just ignores alter_context requests which try to change an existing presentation context. - w2k8 returns DERPC_NCA_S_PROTO_ERROR and closes the transport connection. metze
-rw-r--r--source4/torture/rpc/alter_context.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/torture/rpc/alter_context.c b/source4/torture/rpc/alter_context.c
index 08d938ebbb..c3a992b05f 100644
--- a/source4/torture/rpc/alter_context.c
+++ b/source4/torture/rpc/alter_context.c
@@ -38,14 +38,26 @@ bool torture_rpc_alter_context(struct torture_context *torture)
status = torture_rpc_connection(torture, &p, &ndr_table_lsarpc);
torture_assert_ntstatus_ok(torture, status, "connecting");
+ torture_comment(torture, "Testing change of primary context\n");
+ status = dcerpc_alter_context(p, torture, &p->syntax, &p->transfer_syntax);
+ torture_assert_ntstatus_ok(torture, status, "dcerpc_alter_context failed");
+
if (!test_lsa_OpenPolicy2(p->binding_handle, torture, &handle)) {
ret = false;
}
+ torture_comment(torture, "Testing change of primary context\n");
+ status = dcerpc_alter_context(p, torture, &p->syntax, &p->transfer_syntax);
+ torture_assert_ntstatus_ok(torture, status, "dcerpc_alter_context failed");
+
torture_comment(torture, "Opening secondary DSSETUP context\n");
status = dcerpc_secondary_context(p, &p2, &ndr_table_dssetup);
torture_assert_ntstatus_ok(torture, status, "dcerpc_alter_context failed");
+ torture_comment(torture, "Testing change of primary context\n");
+ status = dcerpc_alter_context(p2, torture, &p2->syntax, &p2->transfer_syntax);
+ torture_assert_ntstatus_ok(torture, status, "dcerpc_alter_context failed");
+
tmptbl = ndr_table_dssetup;
tmptbl.syntax_id.if_version += 100;
torture_comment(torture, "Opening bad secondary connection\n");
@@ -64,7 +76,25 @@ bool torture_rpc_alter_context(struct torture_context *torture)
transfer_syntax = p->transfer_syntax;
torture_comment(torture, "Testing change of primary context\n");
+ status = dcerpc_alter_context(p, torture, &p->syntax, &p->transfer_syntax);
+ torture_assert_ntstatus_ok(torture, status, "dcerpc_alter_context failed");
+
+ ret &= test_lsa_OpenPolicy2(p->binding_handle, torture, &handle);
+
+ if (handle) {
+ ret &= test_lsa_Close(p->binding_handle, torture, handle);
+ }
+
+ torture_comment(torture, "Testing change of primary context\n");
status = dcerpc_alter_context(p, torture, &p2->syntax, &p2->transfer_syntax);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
+ torture_assert_int_equal(torture, p->last_fault_code, DCERPC_NCA_S_PROTO_ERROR,
+ "dcerpc_alter_context should generate a proto error");
+
+ ret &= test_lsa_OpenPolicy2_ex(p->binding_handle, torture, &handle,
+ NT_STATUS_PIPE_DISCONNECTED);
+ return ret;
+ }
torture_assert_ntstatus_ok(torture, status, "dcerpc_alter_context failed");
torture_comment(torture, "testing DSSETUP pipe operations - should fault\n");