s4:torture/samba3rpc: let rpc.authcontext be more robust against low level changes...
[mat/samba.git] / source4 / torture / rpc / samba3rpc.c
index 6c96b9d7cf8411b36b58ac58719803db5786fc1d..dbed3efdb2a47bbf537ebdfe890da6d144369bfc 100644 (file)
@@ -186,18 +186,26 @@ bool torture_bind_authcontext(struct torture_context *torture)
 
        status = dcerpc_lsa_OpenPolicy2_r(lsa_handle, mem_ctx, &openpolicy);
 
-       smb1cli_session_set_id(tmp->smbXcli, tmp_vuid);
-       cli->tree->session = tmp;
-       talloc_free(lsa_pipe);
-       lsa_pipe = NULL;
+       torture_assert(torture, smbXcli_conn_is_connected(cli->transport->conn),
+                      "smb still connected");
+       torture_assert(torture, !dcerpc_binding_handle_is_connected(lsa_handle),
+                      "dcerpc disonnected");
 
-       if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
+       if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
                torture_comment(torture, "dcerpc_lsa_OpenPolicy2 with wrong vuid gave %s, "
-                        "expected NT_STATUS_INVALID_HANDLE\n",
+                        "expected NT_STATUS_IO_DEVICE_ERROR\n",
                         nt_errstr(status));
-               goto done;
+               status = NT_STATUS_IO_DEVICE_ERROR;
        }
 
+       torture_assert_ntstatus_equal(torture, status, NT_STATUS_IO_DEVICE_ERROR,
+                                     "lsa io device error");
+
+       smb1cli_session_set_id(tmp->smbXcli, tmp_vuid);
+       cli->tree->session = tmp;
+       talloc_free(lsa_pipe);
+       lsa_pipe = NULL;
+
        ret = true;
  done:
        talloc_free(mem_ctx);