]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: Don't try to close the connection after running disconnect tests
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 11 Apr 2023 08:57:31 +0000 (20:57 +1200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 12 Apr 2023 13:52:32 +0000 (13:52 +0000)
dcerpc_mdssvc_close() would always fail with
STATUS_CONNECTION_DISCONNECTED, causing the testsuite as a whole to
fail.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/torture/rpc/mdssvc.c

index 132d4e509773da58776ca6b5d4e427dafa62b47c..2d2a83064120c42371c552da52edfea4da22b269 100644 (file)
@@ -162,13 +162,17 @@ static bool torture_rpc_mdssvc_close(struct torture_context *tctx,
 {
        struct torture_mdsscv_state *state = talloc_get_type_abort(
                data, struct torture_mdsscv_state);
-       struct dcerpc_binding_handle *b = state->p->binding_handle;
        NTSTATUS status;
        bool ok = true;
 
        torture_comment(tctx, "test_teardown_mdssvc_disconnect\n");
 
-       status = dcerpc_mdssvc_close(b,
+       if (state->p == NULL) {
+               /* We have already been disconnected. */
+               goto done;
+       }
+
+       status = dcerpc_mdssvc_close(state->p->binding_handle,
                                     state,
                                     &state->ph,
                                     0,
@@ -497,6 +501,10 @@ static bool test_mdssvc_invalid_ph_unknown1(struct torture_context *tctx,
                tctx, status, NT_STATUS_RPC_PROTOCOL_ERROR, ok, done,
                "dcerpc_mdssvc_unknown1 failed\n");
 
+       /* Free and set to NULL the no-longer-usable pipe. */
+       b = NULL;
+       TALLOC_FREE(state->p);
+
 done:
        return ok;
 }
@@ -565,6 +573,10 @@ static bool test_mdssvc_invalid_ph_cmd(struct torture_context *tctx,
                tctx, status, NT_STATUS_RPC_PROTOCOL_ERROR, ok, done,
                "dcerpc_mdssvc_unknown1 failed\n");
 
+       /* Free and set to NULL the no-longer-usable pipe. */
+       b = NULL;
+       TALLOC_FREE(state->p);
+
 done:
        return ok;
 }
@@ -602,6 +614,10 @@ static bool test_mdssvc_invalid_ph_close(struct torture_context *tctx,
                tctx, status, NT_STATUS_RPC_PROTOCOL_ERROR, ok, done,
                "dcerpc_mdssvc_unknown1 failed\n");
 
+       /* Free and set to NULL the no-longer-usable pipe. */
+       b = NULL;
+       TALLOC_FREE(state->p);
+
 done:
        return ok;
 }