The branch, master has been updated
       via  7ce0b7c9 s4-torture: add test for ClusterControl to clusapi 
testsuite.
       via  db49f1f clusapi: add and use clusapi_ClusterControlCode to IDL.
       via  6f08d8ab s3-rpcclient: add cmd_clusapi_get_cluster_version2.
       via  0a95932 s4-torture: add test for clusapi_QueryValue.
       via  aa96377 clusapi: use winreg_AccessMask in clusapi.idl.
       via  2ac148d s4-torture: add more tests for dcerpc_clusapi_CreateEnum.
       via  97bef66 s4-torture: make sure to always seal the clusapi connection 
in witness test.
       via  d6a4a2d s4-torture: do some more inspection on expected 
witness_AsyncNotify replies.
       via  d270028 s4-torture: add test for ClusterControl to clusapi 
testsuite.
      from  ff3b446 s4-torture: use smb_krb5_principal_set_type() in lsa forest 
krb5 tests.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 7ce0b7c95845ab001cf76bf5e9a0891ed601cc98
Author: Günther Deschner <[email protected]>
Date:   Thu Jul 9 15:44:41 2015 +0200

    s4-torture: add test for ClusterControl to clusapi testsuite.
    
    Guenther
    
    Signed-off-by: Günther Deschner <[email protected]>
    Reviewed-by: Jose A. Rivera <[email protected]>
    
    Autobuild-User(master): José A. Rivera <[email protected]>
    Autobuild-Date(master): Wed Jul 15 00:25:38 CEST 2015 on sn-devel-104

commit db49f1f014f2d76deddd7c86050f53c94494f712
Author: Günther Deschner <[email protected]>
Date:   Thu Jul 9 15:12:58 2015 +0200

    clusapi: add and use clusapi_ClusterControlCode to IDL.
    
    Guenther
    
    Signed-off-by: Günther Deschner <[email protected]>
    Reviewed-by: Jose A. Rivera <[email protected]>

commit 6f08d8ab23c37f7511260c4a488e236263584b8b
Author: Günther Deschner <[email protected]>
Date:   Thu Jul 9 15:56:44 2015 +0200

    s3-rpcclient: add cmd_clusapi_get_cluster_version2.
    
    Guenther
    
    Signed-off-by: Günther Deschner <[email protected]>
    Reviewed-by: Jose A. Rivera <[email protected]>

commit 0a95932aaded561ee88cee963e7ecaf77884fadf
Author: Günther Deschner <[email protected]>
Date:   Mon Jul 6 13:59:27 2015 +0200

    s4-torture: add test for clusapi_QueryValue.
    
    Guenther
    
    Signed-off-by: Günther Deschner <[email protected]>
    Reviewed-by: Jose A. Rivera <[email protected]>

commit aa96377b27c5078b37cbc2167cadd61067411406
Author: Günther Deschner <[email protected]>
Date:   Sat Jul 4 01:26:44 2015 +0200

    clusapi: use winreg_AccessMask in clusapi.idl.
    
    Make winreg_AccessMask public to access it outside winreg.idl.
    
    Guenther
    
    Signed-off-by: Günther Deschner <[email protected]>
    Reviewed-by: Jose A. Rivera <[email protected]>

commit 2ac148d6a2e9010eb7dcd754122f64594b1aabcd
Author: Günther Deschner <[email protected]>
Date:   Sat Jul 4 01:26:01 2015 +0200

    s4-torture: add more tests for dcerpc_clusapi_CreateEnum.
    
    Guenther
    
    Signed-off-by: Günther Deschner <[email protected]>
    Reviewed-by: Jose A. Rivera <[email protected]>

commit 97bef6613eb987a74b755c95340aea7149b3fe36
Author: Günther Deschner <[email protected]>
Date:   Wed Jul 1 19:29:28 2015 +0200

    s4-torture: make sure to always seal the clusapi connection in witness test.
    
    clusapi only works via DCE/RPC sealed connections in Windows 2012R2.
    
    Guenther
    
    Signed-off-by: Günther Deschner <[email protected]>
    Reviewed-by: Jose A. Rivera <[email protected]>

commit d6a4a2ddb3882179408359011363d4fd855a6ece
Author: Günther Deschner <[email protected]>
Date:   Wed Jul 1 15:40:06 2015 +0200

    s4-torture: do some more inspection on expected witness_AsyncNotify replies.
    
    Guenther
    
    Signed-off-by: Günther Deschner <[email protected]>
    Reviewed-by: Jose A. Rivera <[email protected]>

commit d2700282ec4683710703c002552113aea6aee722
Author: Günther Deschner <[email protected]>
Date:   Wed Jul 1 15:14:19 2015 +0200

    s4-torture: add test for ClusterControl to clusapi testsuite.
    
    Guenther
    
    Signed-off-by: Günther Deschner <[email protected]>
    Reviewed-by: Jose A. Rivera <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 librpc/idl/clusapi.idl          |  39 ++++++--
 librpc/idl/winreg.idl           |   2 +-
 source3/rpcclient/cmd_clusapi.c |  41 +++++++++
 source4/torture/rpc/clusapi.c   | 193 +++++++++++++++++++++++++++++++++++++---
 source4/torture/rpc/witness.c   |  66 ++++++++++++--
 5 files changed, 314 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/idl/clusapi.idl b/librpc/idl/clusapi.idl
index 3e87114..5cb7610 100644
--- a/librpc/idl/clusapi.idl
+++ b/librpc/idl/clusapi.idl
@@ -1,4 +1,4 @@
-import "security.idl";
+import "security.idl", "winreg.idl";
 
 #include "idl_types.h"
 
@@ -464,14 +464,14 @@ import "security.idl";
 #if 0
        HKEY_RPC
        clusapi_GetRootKey(
-               [ in ] uint32 samDesired,
+               [ in ] winreg_AccessMask samDesired,
                [ out ] WERROR *Status,
                [ out ] WERROR *rpc_status
        );
 #else
        void
        clusapi_GetRootKey(
-               [ in ] uint32 samDesired,
+               [ in ] winreg_AccessMask samDesired,
                [ out ] WERROR *Status,
                [ out ] WERROR *rpc_status,
                [ out ] HKEY_RPC *phKey
@@ -485,7 +485,7 @@ import "security.idl";
                [ in ] HKEY_RPC hKey,
                [ in, string ] [charset(UTF16)] uint16 *lpSubKey,
                [ in ] uint32 dwOptions,
-               [ in ] uint32 samDesired,
+               [ in ] winreg_AccessMask samDesired,
                [ in, unique ] RPC_SECURITY_ATTRIBUTES *lpSecurityAttributes,
                [ out ] uint32 *lpdwDisposition,
                [ out ] WERROR *Status,
@@ -497,7 +497,7 @@ import "security.idl";
                [ in ] HKEY_RPC hKey,
                [ in, string ] [charset(UTF16)] uint16 *lpSubKey,
                [ in ] uint32 dwOptions,
-               [ in ] uint32 samDesired,
+               [ in ] winreg_AccessMask samDesired,
                [ in, unique ] RPC_SECURITY_ATTRIBUTES *lpSecurityAttributes,
                [ out ] uint32 *lpdwDisposition,
                [ out ] WERROR *Status,
@@ -512,7 +512,7 @@ import "security.idl";
        clusapi_OpenKey(
                [ in ] HKEY_RPC hKey,
                [ in, string ] [charset(UTF16)] uint16 *lpSubKey,
-               [ in ] uint32 samDesired,
+               [ in ] winreg_AccessMask samDesired,
                [ out ] WERROR *Status,
                [ out ] WERROR *rpc_status
        );
@@ -521,7 +521,7 @@ import "security.idl";
        clusapi_OpenKey(
                [ in ] HKEY_RPC hKey,
                [ in, string ] [charset(UTF16)] uint16 *lpSubKey,
-               [ in ] uint32 samDesired,
+               [ in ] winreg_AccessMask samDesired,
                [ out ] WERROR *Status,
                [ out ] WERROR *rpc_status,
                [ out ] HKEY_RPC *phKey
@@ -1507,10 +1507,33 @@ import "security.idl";
        /*****************/
        /* Function 0x6A */
 
+       typedef [v1_enum] enum {
+               CLUSCTL_CLUSTER_UNKNOWN                         = 0x07000000,
+               CLUSCTL_CLUSTER_GET_FQDN                        = 0x0700003D,
+               CLUSCTL_CLUSTER_CHECK_VOTER_EVICT               = 0x07000045,
+               CLUSCTL_CLUSTER_CHECK_VOTER_DOWN                = 0x07000049,
+               CLUSCTL_CLUSTER_SHUTDOWN                        = 0x0700004D,
+               CLUSCTL_CLUSTER_ENUM_COMMON_PROPERTIES          = 0x07000051,
+               CLUSCTL_CLUSTER_GET_RO_COMMON_PROPERTIES        = 0x07000055,
+               CLUSCTL_CLUSTER_GET_COMMON_PROPERTIES           = 0x07000059,
+               CLUSCTL_CLUSTER_SET_COMMON_PROPERTIES           = 0x0740005E,
+               CLUSCTL_CLUSTER_VALIDATE_COMMON_PROPERTIES      = 0x07000061,
+               CLUSCTL_CLUSTER_GET_COMMON_PROPERTY_FMTS        = 0x07000065,
+               CLUSCTL_CLUSTER_ENUM_PRIVATE_PROPERTIES         = 0x07000079,
+               CLUSCTL_CLUSTER_GET_RO_PRIVATE_PROPERTIES       = 0x0700007D,
+               CLUSCTL_CLUSTER_GET_PRIVATE_PROPERTIES          = 0x07000081,
+               CLUSCTL_CLUSTER_SET_PRIVATE_PROPERTIES          = 0x07400086,
+               CLUSCTL_CLUSTER_VALIDATE_PRIVATE_PROPERTIES     = 0x07000089,
+               CLUSCTL_CLUSTER_GET_SHARED_VOLUME_ID            = 0x07000291,
+               CLUSCTL_CLUSTER_UPGRADE_CLUSTER_VERSION         = 0x074000ce,
+               CLUSCTL_CLUSTER_CLEAR_UPGRADE_IN_PROGRESS       = 0x074000d2,
+               CLUSCTL_CLUSTER_IS_READY_FOR_UPGRADE            = 0x070000d5
+       } clusapi_ClusterControlCode;
+
        WERROR
        clusapi_ClusterControl(
                [ in ] HCLUSTER_RPC hCluster,
-               [ in ] uint32 dwControlCode,
+               [ in ] clusapi_ClusterControlCode dwControlCode,
                [ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
                [ in ] uint32 nInBufferSize,
                [ out, size_is(nOutBufferSize),
diff --git a/librpc/idl/winreg.idl b/librpc/idl/winreg.idl
index c5da328..fb70f7d 100644
--- a/librpc/idl/winreg.idl
+++ b/librpc/idl/winreg.idl
@@ -18,7 +18,7 @@ import "lsa.idl", "security.idl", "misc.idl";
         * Access Bits for registry ACLS
         */
 
-       typedef [bitmap32bit] bitmap {
+       typedef [public,bitmap32bit] bitmap {
                KEY_QUERY_VALUE                 = 0x00001,
                KEY_SET_VALUE                   = 0x00002,
                KEY_CREATE_SUB_KEY              = 0x00004,
diff --git a/source3/rpcclient/cmd_clusapi.c b/source3/rpcclient/cmd_clusapi.c
index 441a9d8..b7451dc 100644
--- a/source3/rpcclient/cmd_clusapi.c
+++ b/source3/rpcclient/cmd_clusapi.c
@@ -405,6 +405,46 @@ static WERROR cmd_clusapi_get_resource_state(struct 
rpc_pipe_client *cli,
        return WERR_OK;
 }
 
+static WERROR cmd_clusapi_get_cluster_version2(struct rpc_pipe_client *cli,
+                                              TALLOC_CTX *mem_ctx,
+                                              int argc,
+                                              const char **argv)
+{
+       struct dcerpc_binding_handle *b = cli->binding_handle;
+       NTSTATUS status;
+       uint16_t lpwMajorVersion;
+       uint16_t lpwMinorVersion;
+       uint16_t lpwBuildNumber;
+       const char *lpszVendorId;
+       const char *lpszCSDVersion;
+       struct CLUSTER_OPERATIONAL_VERSION_INFO *ppClusterOpVerInfo;
+       WERROR rpc_status;
+       WERROR result;
+
+       status = dcerpc_clusapi_GetClusterVersion2(b, mem_ctx,
+                                                  &lpwMajorVersion,
+                                                  &lpwMinorVersion,
+                                                  &lpwBuildNumber,
+                                                  &lpszVendorId,
+                                                  &lpszCSDVersion,
+                                                  &ppClusterOpVerInfo,
+                                                  &rpc_status,
+                                                  &result);
+       if (!NT_STATUS_IS_OK(status)) {
+               return ntstatus_to_werror(status);
+       }
+
+       if (!W_ERROR_IS_OK(result)) {
+               printf("result: %s\n", win_errstr(result));
+               return result;
+       }
+
+       printf("rpc_status: %s\n", win_errstr(rpc_status));
+
+       return WERR_OK;
+}
+
+
 struct cmd_set clusapi_commands[] = {
 
        { "CLUSAPI" },
@@ -417,5 +457,6 @@ struct cmd_set clusapi_commands[] = {
        { "clusapi_online_resource", RPC_RTYPE_WERROR, NULL, 
cmd_clusapi_online_resource, &ndr_table_clusapi, NULL, "bla", "" },
        { "clusapi_offline_resource", RPC_RTYPE_WERROR, NULL, 
cmd_clusapi_offline_resource, &ndr_table_clusapi, NULL, "bla", "" },
        { "clusapi_get_resource_state", RPC_RTYPE_WERROR, NULL, 
cmd_clusapi_get_resource_state, &ndr_table_clusapi, NULL, "bla", "" },
+       { "clusapi_get_cluster_version2", RPC_RTYPE_WERROR, NULL, 
cmd_clusapi_get_cluster_version2, &ndr_table_clusapi, NULL, "bla", "" },
        { NULL }
 };
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c
index 8d4dbec..f6f3ff5 100644
--- a/source4/torture/rpc/clusapi.c
+++ b/source4/torture/rpc/clusapi.c
@@ -22,6 +22,7 @@
 #include "librpc/gen_ndr/ndr_clusapi_c.h"
 #include "torture/rpc/torture_rpc.h"
 #include "param/param.h"
+#include "libcli/registry/util_reg.h"
 
 struct torture_clusapi_context {
        struct dcerpc_pipe *p;
@@ -273,20 +274,53 @@ static bool test_CreateEnum(struct torture_context *tctx,
                talloc_get_type_abort(data, struct torture_clusapi_context);
        struct dcerpc_binding_handle *b = t->p->binding_handle;
        struct clusapi_CreateEnum r;
-       uint32_t dwType = CLUSTER_ENUM_RESOURCE;
+       uint32_t dwType[] = {
+               CLUSTER_ENUM_NODE,
+               CLUSTER_ENUM_RESTYPE,
+               CLUSTER_ENUM_RESOURCE,
+               CLUSTER_ENUM_GROUP,
+               CLUSTER_ENUM_NETWORK,
+               CLUSTER_ENUM_NETINTERFACE,
+               CLUSTER_ENUM_INTERNAL_NETWORK,
+               CLUSTER_ENUM_SHARED_VOLUME_RESOURCE
+       };
+       uint32_t dwType_invalid[] = {
+               0x00000040,
+               0x00000080,
+               0x00000100 /* and many more ... */
+       };
        struct ENUM_LIST *ReturnEnum;
        WERROR rpc_status;
+       int i;
 
-       r.in.dwType = dwType;
-       r.out.ReturnEnum = &ReturnEnum;
-       r.out.rpc_status = &rpc_status;
+       for (i=0; i < ARRAY_SIZE(dwType); i++) {
 
-       torture_assert_ntstatus_ok(tctx,
-               dcerpc_clusapi_CreateEnum_r(b, tctx, &r),
-               "CreateEnum failed");
-       torture_assert_werr_ok(tctx,
-               r.out.result,
-               "CreateEnum failed");
+               r.in.dwType = dwType[i];
+               r.out.ReturnEnum = &ReturnEnum;
+               r.out.rpc_status = &rpc_status;
+
+               torture_assert_ntstatus_ok(tctx,
+                       dcerpc_clusapi_CreateEnum_r(b, tctx, &r),
+                       "CreateEnum failed");
+               torture_assert_werr_ok(tctx,
+                       r.out.result,
+                       "CreateEnum failed");
+       }
+
+       for (i=0; i < ARRAY_SIZE(dwType_invalid); i++) {
+
+               r.in.dwType = dwType_invalid[i];
+               r.out.ReturnEnum = &ReturnEnum;
+               r.out.rpc_status = &rpc_status;
+
+               torture_assert_ntstatus_ok(tctx,
+                       dcerpc_clusapi_CreateEnum_r(b, tctx, &r),
+                       "CreateEnum failed");
+               torture_assert_werr_equal(tctx,
+                       r.out.result,
+                       WERR_INVALID_PARAMETER,
+                       "CreateEnum failed");
+       }
 
        return true;
 }
@@ -1771,6 +1805,73 @@ static bool test_SetServiceAccountPassword(struct 
torture_context *tctx,
        return true;
 }
 
+static bool test_ClusterControl_int(struct torture_context *tctx,
+                                   struct dcerpc_pipe *p,
+                                   struct policy_handle *Cluster)
+{
+       struct dcerpc_binding_handle *b = p->binding_handle;
+       struct clusapi_ClusterControl r;
+       uint32_t lpBytesReturned;
+       uint32_t lpcbRequired;
+       WERROR rpc_status;
+
+       r.in.hCluster = *Cluster;
+       r.in.dwControlCode = 0;
+       r.in.lpInBuffer = NULL;
+       r.in.nInBufferSize = 0;
+       r.in.nOutBufferSize = 0;
+       r.out.lpOutBuffer = NULL;
+       r.out.lpBytesReturned = &lpBytesReturned;
+       r.out.lpcbRequired = &lpcbRequired;
+       r.out.rpc_status = &rpc_status;
+
+       torture_assert_ntstatus_ok(tctx,
+               dcerpc_clusapi_ClusterControl_r(b, tctx, &r),
+               "ClusterControl failed");
+       torture_assert_werr_equal(tctx,
+               r.out.result,
+               WERR_INVALID_FUNCTION,
+               "ClusterControl failed");
+
+       r.in.dwControlCode = CLUSCTL_CLUSTER_GET_RO_COMMON_PROPERTIES;
+
+       torture_assert_ntstatus_ok(tctx,
+               dcerpc_clusapi_ClusterControl_r(b, tctx, &r),
+               "ClusterControl failed");
+
+       if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
+               r.out.lpOutBuffer = talloc_zero_array(tctx, uint8_t, 
*r.out.lpcbRequired);
+               r.in.nOutBufferSize = *r.out.lpcbRequired;
+               torture_assert_ntstatus_ok(tctx,
+                       dcerpc_clusapi_ClusterControl_r(b, tctx, &r),
+                       "ClusterControl failed");
+       }
+       torture_assert_werr_ok(tctx,
+               r.out.result,
+               "ClusterControl failed");
+
+       return true;
+}
+
+static bool test_ClusterControl(struct torture_context *tctx,
+                               void *data)
+{
+       struct torture_clusapi_context *t =
+               talloc_get_type_abort(data, struct torture_clusapi_context);
+       struct policy_handle Cluster;
+       bool ret;
+
+       if (!test_OpenCluster_int(tctx, t->p, &Cluster)) {
+               return false;
+       }
+
+       ret = test_ClusterControl_int(tctx, t->p, &Cluster);
+
+       test_CloseCluster_int(tctx, t->p, &Cluster);
+
+       return ret;
+}
+
 static bool test_OpenNetwork_int(struct torture_context *tctx,
                                 struct dcerpc_pipe *p,
                                 const char *lpszNetworkName,
@@ -2573,6 +2674,73 @@ static bool test_EnumKey(struct torture_context *tctx,
        return ret;
 }
 
+static bool test_QueryValue_int(struct torture_context *tctx,
+                               struct dcerpc_pipe *p,
+                               struct policy_handle *hKey,
+                               const char *ValueName)
+{
+       struct dcerpc_binding_handle *b = p->binding_handle;
+       struct clusapi_QueryValue r;
+       uint32_t lpValueType;
+       uint32_t lpcbRequired;
+       WERROR rpc_status;
+
+       r.in.hKey = *hKey;
+       r.in.lpValueName = ValueName;
+       r.in.cbData = 0;
+       r.out.lpValueType = &lpValueType;
+       r.out.lpData = NULL;
+       r.out.lpcbRequired = &lpcbRequired;
+       r.out.rpc_status = &rpc_status;
+
+       torture_assert_ntstatus_ok(tctx,
+               dcerpc_clusapi_QueryValue_r(b, tctx, &r),
+               "QueryValue failed");
+
+       if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
+
+               r.in.cbData = lpcbRequired;
+               r.out.lpData = talloc_zero_array(tctx, uint8_t, r.in.cbData);
+
+               torture_assert_ntstatus_ok(tctx,
+                       dcerpc_clusapi_QueryValue_r(b, tctx, &r),
+                       "QueryValue failed");
+       }
+
+       torture_assert_werr_ok(tctx,
+               r.out.result,
+               "QueryValue failed");
+
+       if (lpValueType == REG_SZ) {
+               const char *s;
+               DATA_BLOB blob = data_blob_const(r.out.lpData, lpcbRequired);
+               pull_reg_sz(tctx, &blob, &s);
+               torture_comment(tctx, "got: %s\n", s);
+       }
+
+       return true;
+}
+
+static bool test_QueryValue(struct torture_context *tctx,
+                           void *data)
+{
+       struct torture_clusapi_context *t =
+               talloc_get_type_abort(data, struct torture_clusapi_context);
+       struct policy_handle hKey;
+       bool ret = true;
+
+       if (!test_GetRootKey_int(tctx, t->p, &hKey)) {
+               return false;
+       }
+
+       ret = test_QueryValue_int(tctx, t->p, &hKey, "ClusterInstanceID");
+
+       test_CloseKey_int(tctx, t->p, &hKey);
+
+       return ret;
+}
+
+
 static bool test_one_key(struct torture_context *tctx,
                         struct dcerpc_pipe *p,
                         struct policy_handle *hKey,
@@ -2716,6 +2884,9 @@ void torture_tcase_cluster(struct torture_tcase *tcase)
                                      test_BackupClusterDatabase);
        torture_tcase_add_simple_test(tcase, "SetServiceAccountPassword",
                                      test_SetServiceAccountPassword);
+       torture_tcase_add_simple_test(tcase, "ClusterControl",
+                                     test_ClusterControl);
+
 }
 
 void torture_tcase_resource(struct torture_tcase *tcase)
@@ -2847,6 +3018,8 @@ void torture_tcase_registry(struct torture_tcase *tcase)
                                      test_CloseKey);
        torture_tcase_add_simple_test(tcase, "EnumKey",
                                      test_EnumKey);
+       torture_tcase_add_simple_test(tcase, "QueryValue",
+                                     test_QueryValue);
        torture_tcase_add_simple_test(tcase, "all_keys",
                                      test_all_keys);
 }
diff --git a/source4/torture/rpc/witness.c b/source4/torture/rpc/witness.c
index f040e0b..6f50a63 100644
--- a/source4/torture/rpc/witness.c
+++ b/source4/torture/rpc/witness.c
@@ -26,6 +26,7 @@
 #include "librpc/gen_ndr/ndr_clusapi_c.h"
 #include "param/param.h"
 #include <tevent.h>
+#include "lib/cmdline/popt_common.h"
 
 struct torture_test_clusapi_state {
        struct dcerpc_pipe *p;
@@ -516,17 +517,30 @@ static bool test_witness_RegisterEx(struct 
torture_context *tctx,
 static bool setup_clusapi_connection(struct torture_context *tctx,
                                     struct torture_test_witness_state *s)
 {
-       NTSTATUS status;
+       struct dcerpc_binding *binding;
 
        if (s->clusapi.p) {
                return true;
        }
 
-       status = torture_rpc_connection_transport(tctx, &s->clusapi.p, 
&ndr_table_clusapi, NCACN_IP_TCP, 0);
-       if (!NT_STATUS_IS_OK(status)) {
-               torture_comment(tctx, "clusapi interface not available\n");
-               return true;
-       }
+       torture_assert_ntstatus_ok(tctx,
+               torture_rpc_binding(tctx, &binding),
+               "failed to retrieve torture binding");
+
+       torture_assert_ntstatus_ok(tctx,
+               dcerpc_binding_set_transport(binding, NCACN_IP_TCP),
+               "failed to set transport");
+
+       torture_assert_ntstatus_ok(tctx,
+               dcerpc_binding_set_flags(binding, DCERPC_SEAL, 0),
+               "failed to set dcerpc flags");
+
+       torture_assert_ntstatus_ok(tctx,
+               dcerpc_pipe_connect_b(tctx, &s->clusapi.p, binding,
+                                     &ndr_table_clusapi,
+                                     cmdline_credentials,
+                                     tctx->ev, tctx->lp_ctx),
+               "failed to connect dcerpc pipe");
 
        return true;
 }
@@ -587,7 +601,9 @@ static bool test_GetResourceState_int(struct 
torture_context *tctx,
 
 static bool toggle_cluster_resource_state(struct torture_context *tctx,
                                          struct dcerpc_pipe *p,
-                                         const char *resource_name)
+                                         const char *resource_name,
+                                         enum clusapi_ClusterResourceState 
*old_state,
+                                         enum clusapi_ClusterResourceState 
*new_state)
 {
        struct policy_handle hResource;
        enum clusapi_ClusterResourceState State;
@@ -599,6 +615,10 @@ static bool toggle_cluster_resource_state(struct 
torture_context *tctx,
                test_GetResourceState_int(tctx, p, &hResource, &State),
                "failed to query resource state");
 
+       if (old_state) {
+               *old_state = State;
+       }
+
        switch (State) {
        case ClusterResourceOffline:
                if (!test_OnlineResource_int(tctx, p, &hResource)) {
@@ -619,6 +639,14 @@ static bool toggle_cluster_resource_state(struct 
torture_context *tctx,
                break;
        }
 
+       torture_assert(tctx,
+               test_GetResourceState_int(tctx, p, &hResource, &State),
+               "failed to query resource state");
+
+       if (new_state) {
+               *new_state = State;
+       }
+
        test_CloseResource_int(tctx, p, &hResource);
 
        return true;
@@ -645,6 +673,7 @@ static bool test_witness_AsyncNotify(struct torture_context 
*tctx,
                struct witness_interfaceInfo interface = 
state->list->interfaces[i];


-- 
Samba Shared Repository

Reply via email to