r24900: - if we use try to create a 3rd dcerpc_pipe then use a 3rd variable
authorStefan Metzmacher <metze@samba.org>
Sun, 2 Sep 2007 17:27:40 +0000 (17:27 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:03:34 +0000 (15:03 -0500)
  instead of overwritting the one of the 2nd connection
- make it possible to specify the expected ntstatus for
  DsRoleGetPrimaryDomainInformation as the alter_context
  wants it to fail when used on the wrong pipe

metze
(This used to be commit c7c72ab36b15c5ffac1740b7df93fa92fe4620e9)

source4/torture/rpc/alter_context.c
source4/torture/rpc/dssetup.c

index f5e8282344650a2d679a1351fdc29aba569b62a8..78437130746708ca32620a089d294bfd3315bab1 100644 (file)
@@ -28,8 +28,8 @@
 
 bool torture_rpc_alter_context(struct torture_context *torture)
 {
 
 bool torture_rpc_alter_context(struct torture_context *torture)
 {
-        NTSTATUS status;
-        struct dcerpc_pipe *p, *p2;
+       NTSTATUS status;
+       struct dcerpc_pipe *p, *p2, *p3;
        struct policy_handle *handle;
        struct ndr_interface_table tmptbl;
        struct ndr_syntax_id syntax;
        struct policy_handle *handle;
        struct ndr_interface_table tmptbl;
        struct ndr_syntax_id syntax;
@@ -51,7 +51,7 @@ bool torture_rpc_alter_context(struct torture_context *torture)
        tmptbl = ndr_table_dssetup;
        tmptbl.syntax_id.if_version += 100;
        torture_comment(torture, "Opening bad secondary connection\n");
        tmptbl = ndr_table_dssetup;
        tmptbl.syntax_id.if_version += 100;
        torture_comment(torture, "Opening bad secondary connection\n");
-       status = dcerpc_secondary_context(p, &p2, &tmptbl);
+       status = dcerpc_secondary_context(p, &p3, &tmptbl);
        torture_assert_ntstatus_equal(torture, status, NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX,
                                      "dcerpc_alter_context with wrong version should fail");
 
        torture_assert_ntstatus_equal(torture, status, NT_STATUS_RPC_UNSUPPORTED_NAME_SYNTAX,
                                      "dcerpc_alter_context with wrong version should fail");
 
@@ -59,9 +59,7 @@ bool torture_rpc_alter_context(struct torture_context *torture)
        ret &= test_DsRoleGetPrimaryDomainInformation(torture, p2);
 
        if (handle) {
        ret &= test_DsRoleGetPrimaryDomainInformation(torture, p2);
 
        if (handle) {
-               if (!test_lsa_Close(p, torture, handle)) {
-                       ret = false;
-               }
+               ret &= test_lsa_Close(p, torture, handle);
        }
 
        syntax = p->syntax;
        }
 
        syntax = p->syntax;
@@ -72,18 +70,12 @@ bool torture_rpc_alter_context(struct torture_context *torture)
        torture_assert_ntstatus_ok(torture, status, "dcerpc_alter_context failed");
 
        torture_comment(torture, "testing DSSETUP pipe operations - should fault\n");
        torture_assert_ntstatus_ok(torture, status, "dcerpc_alter_context failed");
 
        torture_comment(torture, "testing DSSETUP pipe operations - should fault\n");
-       if (test_DsRoleGetPrimaryDomainInformation(torture, p)) {
-               ret = false;
-       }
+       ret &= test_DsRoleGetPrimaryDomainInformation_ext(torture, p, NT_STATUS_NET_WRITE_FAULT);
 
 
-       if (!test_lsa_OpenPolicy2(p, torture, &handle)) {
-               ret = false;
-       }
+       ret &= test_lsa_OpenPolicy2(p, torture, &handle);
 
        if (handle) {
 
        if (handle) {
-               if (!test_lsa_Close(p, torture, handle)) {
-                       ret = false;
-               }
+               ret &= test_lsa_Close(p, torture, handle);
        }
 
        torture_comment(torture, "testing DSSETUP pipe operations\n");
        }
 
        torture_comment(torture, "testing DSSETUP pipe operations\n");
index 006d69acaf72cb3cf9b12c224862f828f51b37d6..aa5f12eb92cd37e258f1a95567b21a59c6c09dbf 100644 (file)
@@ -25,8 +25,9 @@
 #include "torture/rpc/rpc.h"
 
 
 #include "torture/rpc/rpc.h"
 
 
-bool test_DsRoleGetPrimaryDomainInformation(struct torture_context *tctx, 
-                                           struct dcerpc_pipe *p)
+bool test_DsRoleGetPrimaryDomainInformation_ext(struct torture_context *tctx, 
+                                               struct dcerpc_pipe *p,
+                                               NTSTATUS ext_status)
 {
        struct dssetup_DsRoleGetPrimaryDomainInformation r;
        NTSTATUS status;
 {
        struct dssetup_DsRoleGetPrimaryDomainInformation r;
        NTSTATUS status;
@@ -37,13 +38,21 @@ bool test_DsRoleGetPrimaryDomainInformation(struct torture_context *tctx,
                torture_comment(tctx, "dcerpc_dssetup_DsRoleGetPrimaryDomainInformation level %d\n", i);
 
                status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation(p, tctx, &r);
                torture_comment(tctx, "dcerpc_dssetup_DsRoleGetPrimaryDomainInformation level %d\n", i);
 
                status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation(p, tctx, &r);
-               torture_assert_ntstatus_ok(tctx, status, "DsRoleGetPrimaryDomainInformation failed");
-               torture_assert_werr_ok(tctx, r.out.result, "DsRoleGetPrimaryDomainInformation failed");
+               torture_assert_ntstatus_equal(tctx, ext_status, status, "DsRoleGetPrimaryDomainInformation failed");
+               if (NT_STATUS_IS_OK(ext_status)) {
+                       torture_assert_werr_ok(tctx, r.out.result, "DsRoleGetPrimaryDomainInformation failed");
+               }
        }
 
        return true;
 }
 
        }
 
        return true;
 }
 
+bool test_DsRoleGetPrimaryDomainInformation(struct torture_context *tctx, 
+                                           struct dcerpc_pipe *p)
+{
+       return test_DsRoleGetPrimaryDomainInformation_ext(tctx, p, NT_STATUS_OK);
+}
+
 struct torture_suite *torture_rpc_dssetup(TALLOC_CTX *mem_ctx)
 {
        struct torture_suite *suite = torture_suite_create(mem_ctx, "DSSETUP");
 struct torture_suite *torture_rpc_dssetup(TALLOC_CTX *mem_ctx)
 {
        struct torture_suite *suite = torture_suite_create(mem_ctx, "DSSETUP");