torture: Address flapping samba4.rpc.altercontext test
authorAndrew Bartlett <abartlet@samba.org>
Wed, 15 May 2019 04:07:16 +0000 (16:07 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 20 May 2019 05:17:42 +0000 (05:17 +0000)
NT_STATUS_CONNECTION_DISCONNECTED and NT_STATUS_CONNECTION_RESET are
equivilent for the purposes of this test, both come from the server
shutting down the connection, the difference comes from two different
unix error numbers that can come from this.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon May 20 05:17:42 UTC 2019 on sn-devel-184

source4/torture/rpc/alter_context.c
source4/torture/rpc/lsa.c

index 60e03db29149d53f9e9328570e49edacca476263..22abd97e2fc39777a4182d80fae94bd8a6332a05 100644 (file)
@@ -85,7 +85,8 @@ 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_CONNECTION_DISCONNECTED);
+                                              NT_STATUS_CONNECTION_DISCONNECTED,
+                                              NT_STATUS_CONNECTION_RESET);
 
                torture_assert(torture, !dcerpc_binding_handle_is_connected(p->binding_handle),
                               "dcerpc disonnected");
index bc1e9553039fb854329f43ba1754bbb7993cf77e..6cdab54c6ca5824be106a23cbd8a15225141af0e 100644 (file)
@@ -154,7 +154,8 @@ static bool test_OpenPolicy_fail(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,
+                            NTSTATUS expected_status2)
 {
        struct lsa_ObjectAttribute attr;
        struct lsa_QosInfo qos;
@@ -184,9 +185,15 @@ bool test_lsa_OpenPolicy2_ex(struct dcerpc_binding_handle *b,
        r.out.handle = *handle;
 
        status = dcerpc_lsa_OpenPolicy2_r(b, tctx, &r);
-       torture_assert_ntstatus_equal(tctx, status, expected_status,
-                                  "OpenPolicy2 failed");
-       if (!NT_STATUS_IS_OK(expected_status)) {
+
+       /* Allow two possible failure status codes */
+       if (!NT_STATUS_EQUAL(status, expected_status2)) {
+               torture_assert_ntstatus_equal(tctx, status,
+                                             expected_status,
+                                             "OpenPolicy2 failed");
+       }
+       if (!NT_STATUS_IS_OK(expected_status) ||
+           !NT_STATUS_IS_OK(expected_status2)) {
                return true;
        }
 
@@ -202,7 +209,8 @@ 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, NT_STATUS_OK);
 }
 
 static bool test_OpenPolicy2_fail(struct dcerpc_binding_handle *b,