s4-torture: Make sure lsa_OpenPolicy2 fails over TCP/IP.
authorAndreas Schneider <asn@samba.org>
Tue, 26 Jun 2012 08:38:08 +0000 (10:38 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 6 Jul 2012 08:00:56 +0000 (10:00 +0200)
source4/torture/rpc/alter_context.c
source4/torture/rpc/lsa.c

index cbfe034d06dd8f526bd01397fb52ae145a28983c..4160ddd8b30ec0ffb6b13a65653e77e77aa0b1fd 100644 (file)
@@ -90,7 +90,7 @@ bool torture_rpc_alter_context(struct torture_context *torture)
        if (NT_STATUS_EQUAL(status, NT_STATUS_RPC_PROTOCOL_ERROR)) {
 
                ret &= test_lsa_OpenPolicy2_ex(p->binding_handle, torture, &handle,
-                                              NT_STATUS_PIPE_DISCONNECTED);
+                                              NT_STATUS_PIPE_DISCONNECTED, false);
                return ret;
        }
        torture_assert_ntstatus_ok(torture, status, "dcerpc_alter_context failed");
index d2f1bcef2339ff97d2b28d821c20fc954e2e2ea4..7599fa9a94deee2539c986bccc2ae50e33945c2a 100644 (file)
@@ -91,7 +91,8 @@ static bool test_OpenPolicy(struct dcerpc_binding_handle *b,
 bool test_lsa_OpenPolicy2_ex(struct dcerpc_binding_handle *b,
                             struct torture_context *tctx,
                             struct policy_handle **handle,
-                            NTSTATUS expected_status)
+                            NTSTATUS expected_status,
+                            bool test_fail)
 {
        struct lsa_ObjectAttribute attr;
        struct lsa_QosInfo qos;
@@ -131,11 +132,13 @@ bool test_lsa_OpenPolicy2_ex(struct dcerpc_binding_handle *b,
        if (!NT_STATUS_IS_OK(r.out.result)) {
                if (NT_STATUS_EQUAL(r.out.result, NT_STATUS_ACCESS_DENIED) ||
                    NT_STATUS_EQUAL(r.out.result, NT_STATUS_RPC_PROTSEQ_NOT_SUPPORTED)) {
-                       torture_comment(tctx, "not considering %s to be an error\n",
-                                       nt_errstr(r.out.result));
-                       talloc_free(*handle);
-                       *handle = NULL;
-                       return true;
+                       if (test_fail) {
+                               torture_comment(tctx, "not considering %s to be an error\n",
+                                               nt_errstr(r.out.result));
+                               talloc_free(*handle);
+                               *handle = NULL;
+                               return true;
+                       }
                }
                torture_comment(tctx, "OpenPolicy2 failed - %s\n",
                                nt_errstr(r.out.result));
@@ -150,7 +153,7 @@ bool test_lsa_OpenPolicy2(struct dcerpc_binding_handle *b,
                          struct torture_context *tctx,
                          struct policy_handle **handle)
 {
-       return test_lsa_OpenPolicy2_ex(b, tctx, handle, NT_STATUS_OK);
+       return test_lsa_OpenPolicy2_ex(b, tctx, handle, NT_STATUS_OK, false);
 }
 
 static bool test_LookupNames(struct dcerpc_binding_handle *b,
@@ -3083,6 +3086,11 @@ bool torture_rpc_lsa(struct torture_context *tctx)
                        ret = false;
                }
 
+               if (!test_lsa_OpenPolicy2_ex(b, tctx, &handle,
+                                            NT_STATUS_OK, true)) {
+                       ret = false;
+               }
+
                if (!test_many_LookupSids(p, tctx, handle)) {
                        ret = false;
                }