From 0bf6043df9a769784e427217737f917501f26466 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 Apr 2010 09:03:43 +0200 Subject: 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 --- source4/torture/rpc/alter_context.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'source4/torture') 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"); @@ -63,8 +75,26 @@ bool torture_rpc_alter_context(struct torture_context *torture) syntax = p->syntax; 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"); -- cgit