[PATCHES] cluster api testing patches
Günther Deschner
gd at samba.org
Tue Aug 4 11:27:55 UTC 2015
On 31/07/15 18:01, Jeremy Allison wrote:
> On Fri, Jul 31, 2015 at 02:54:06PM +0200, Andreas Schneider wrote:
>> On Thursday 30 July 2015 13:51:45 Jeremy Allison wrote:
>>> On Fri, Jul 24, 2015 at 03:04:40PM +0200, Guenther Deschner wrote:
>>>> Hi,
>>>>
>>>> attached are some more patches for testing the cluster management
>>>> interface, notably the marshalling of the PROPERTY_LIST buffers.
>>>>
>>>> Please review and push.
>>>
>>> Guenther, doing:
>>>
>>> make test TESTS=samba3.local.ndr
>>>
>>> reliably gives:
>>>
>>> [1(0)/2 at 0s] samba3.local.ndr(nt4_dc)
>>> UNEXPECTED(failure): samba3.local.ndr.clusapi_PROPERTY_LIST(nt4_dc)
>>> REASON: Exception: Exception: ../source4/torture/ndr/clusapi.c:327:
>>> r->propertyValues[8].PropertyValues.Buffer of len 4 did not match
>>> blob_dword_null: Buffer
>>>
>>> Can you investigate and fix ?
>>
>> gd is not available the next week(s) ... :)
>
> Oh, sorry. I'm off myself for the next 3 weeks,
> so he can fix and resubmit (and I'll push) once
> he and I get back :-)
Right, sorry, fixed patchset attached.
Please review & push,
Thanks,
Guenther
--
Günther Deschner GPG-ID: 8EE11688
Red Hat gdeschner at redhat.com
Samba Team gd at samba.org
-------------- next part --------------
>From 603707f3d42de5ad6a3f237c98094fb263025222 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Wed, 1 Jul 2015 16:58:06 +0200
Subject: [PATCH 01/16] s4-torture: add more tests for clusapi_OpenResource().
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source4/torture/rpc/clusapi.c | 44 +++++++++++++++++++++++++++++++++++++------
1 file changed, 38 insertions(+), 6 deletions(-)
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c
index f6f3ff5..b3a7369 100644
--- a/source4/torture/rpc/clusapi.c
+++ b/source4/torture/rpc/clusapi.c
@@ -387,10 +387,12 @@ static bool test_SetQuorumResource(struct torture_context *tctx,
return true;
}
-bool test_OpenResource_int(struct torture_context *tctx,
- struct dcerpc_pipe *p,
- const char *lpszResourceName,
- struct policy_handle *hResource)
+static bool test_OpenResource_int_exp(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ const char *lpszResourceName,
+ struct policy_handle *hResource,
+ WERROR expected_Status,
+ WERROR expected_rpc_status)
{
struct dcerpc_binding_handle *b = p->binding_handle;
struct clusapi_OpenResource r;
@@ -405,13 +407,27 @@ bool test_OpenResource_int(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx,
dcerpc_clusapi_OpenResource_r(b, tctx, &r),
"OpenResource failed");
- torture_assert_werr_ok(tctx,
- *r.out.Status,
+ torture_assert_werr_equal(tctx,
+ *r.out.Status, expected_Status,
+ "OpenResource failed");
+ torture_assert_werr_equal(tctx,
+ *r.out.rpc_status, expected_rpc_status,
"OpenResource failed");
return true;
}
+bool test_OpenResource_int(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ const char *lpszResourceName,
+ struct policy_handle *hResource)
+{
+ return test_OpenResource_int_exp(tctx, p,
+ lpszResourceName,
+ hResource,
+ WERR_OK, WERR_OK);
+}
+
static bool test_OpenResourceEx_int(struct torture_context *tctx,
struct dcerpc_pipe *p,
const char *lpszResourceName,
@@ -476,6 +492,22 @@ static bool test_OpenResource(struct torture_context *tctx,
test_CloseResource_int(tctx, t->p, &hResource);
+ if (!test_OpenResource_int_exp(tctx, t->p, "", &hResource, WERR_RESOURCE_NOT_FOUND, WERR_OK)) {
+ return false;
+ }
+
+ torture_assert(tctx,
+ ndr_policy_handle_empty(&hResource),
+ "expected empty policy handle");
+
+ if (!test_OpenResource_int_exp(tctx, t->p, "jfUF38fjSNcfn", &hResource, WERR_RESOURCE_NOT_FOUND, WERR_OK)) {
+ return false;
+ }
+
+ torture_assert(tctx,
+ ndr_policy_handle_empty(&hResource),
+ "expected empty policy handle");
+
return true;
}
--
2.4.3
>From 6614566145ae3952f9717ab6d8d97028b257063e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 9 Jul 2015 17:23:32 +0200
Subject: [PATCH 02/16] s3-clusapi: add test for
GetResourceDependencyExpression.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source4/torture/rpc/clusapi.c | 47 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c
index b3a7369..f1508bf 100644
--- a/source4/torture/rpc/clusapi.c
+++ b/source4/torture/rpc/clusapi.c
@@ -972,6 +972,48 @@ static bool test_CreateResEnum(struct torture_context *tctx,
return ret;
}
+static bool test_GetResourceDependencyExpression_int(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ struct policy_handle *hResource)
+{
+ struct dcerpc_binding_handle *b = p->binding_handle;
+ struct clusapi_GetResourceDependencyExpression r;
+ const char *lpszDependencyExpression;
+ WERROR rpc_status;
+
+ r.in.hResource = *hResource;
+ r.out.lpszDependencyExpression = &lpszDependencyExpression;
+ r.out.rpc_status = &rpc_status;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_clusapi_GetResourceDependencyExpression_r(b, tctx, &r),
+ "GetResourceDependencyExpression failed");
+ torture_assert_werr_ok(tctx,
+ r.out.result,
+ "GetResourceDependencyExpression failed");
+
+ return true;
+}
+
+static bool test_GetResourceDependencyExpression(struct torture_context *tctx,
+ void *data)
+{
+ struct torture_clusapi_context *t =
+ talloc_get_type_abort(data, struct torture_clusapi_context);
+ struct policy_handle hResource;
+ bool ret = true;
+
+ if (!test_OpenResource_int(tctx, t->p, "Cluster Name", &hResource)) {
+ return false;
+ }
+
+ ret = test_GetResourceDependencyExpression_int(tctx, t->p, &hResource);
+
+ test_CloseResource_int(tctx, t->p, &hResource);
+
+ return ret;
+}
+
static bool test_one_resource(struct torture_context *tctx,
struct dcerpc_pipe *p,
const char *resource_name)
@@ -999,6 +1041,9 @@ static bool test_one_resource(struct torture_context *tctx,
torture_assert(tctx,
test_CreateResEnum_int(tctx, p, &hResource),
"failed to query resource enum");
+ torture_assert(tctx,
+ test_GetResourceDependencyExpression_int(tctx, p, &hResource),
+ "failed to query resource dependency expression");
test_CloseResource_int(tctx, p, &hResource);
@@ -2957,6 +3002,8 @@ void torture_tcase_resource(struct torture_tcase *tcase)
test = torture_tcase_add_simple_test(tcase, "OfflineResource",
test_OfflineResource);
test->dangerous = true;
+ torture_tcase_add_simple_test(tcase, "GetResourceDependencyExpression",
+ test_GetResourceDependencyExpression);
torture_tcase_add_simple_test(tcase, "all_resources",
test_all_resources);
}
--
2.4.3
>From 1dc898e063c6bc294467d54b55b6b166182a05bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 9 Jul 2015 17:25:24 +0200
Subject: [PATCH 03/16] s4-torture: add test for GetResourceNetworkName.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source4/torture/rpc/clusapi.c | 47 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c
index f1508bf..4f21eab 100644
--- a/source4/torture/rpc/clusapi.c
+++ b/source4/torture/rpc/clusapi.c
@@ -1014,6 +1014,48 @@ static bool test_GetResourceDependencyExpression(struct torture_context *tctx,
return ret;
}
+static bool test_GetResourceNetworkName_int(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ struct policy_handle *hResource)
+{
+ struct dcerpc_binding_handle *b = p->binding_handle;
+ struct clusapi_GetResourceNetworkName r;
+ const char *lpszName;
+ WERROR rpc_status;
+
+ r.in.hResource = *hResource;
+ r.out.lpszName = &lpszName;
+ r.out.rpc_status = &rpc_status;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_clusapi_GetResourceNetworkName_r(b, tctx, &r),
+ "GetResourceNetworkName failed");
+ torture_assert_werr_ok(tctx,
+ r.out.result,
+ "GetResourceNetworkName failed");
+
+ return true;
+}
+
+static bool test_GetResourceNetworkName(struct torture_context *tctx,
+ void *data)
+{
+ struct torture_clusapi_context *t =
+ talloc_get_type_abort(data, struct torture_clusapi_context);
+ struct policy_handle hResource;
+ bool ret = true;
+
+ if (!test_OpenResource_int(tctx, t->p, "Network Name", &hResource)) {
+ return false;
+ }
+
+ ret = test_GetResourceNetworkName_int(tctx, t->p, &hResource);
+
+ test_CloseResource_int(tctx, t->p, &hResource);
+
+ return ret;
+}
+
static bool test_one_resource(struct torture_context *tctx,
struct dcerpc_pipe *p,
const char *resource_name)
@@ -1044,6 +1086,9 @@ static bool test_one_resource(struct torture_context *tctx,
torture_assert(tctx,
test_GetResourceDependencyExpression_int(tctx, p, &hResource),
"failed to query resource dependency expression");
+ torture_assert(tctx,
+ test_GetResourceNetworkName_int(tctx, p, &hResource),
+ "failed to query resource network name");
test_CloseResource_int(tctx, p, &hResource);
@@ -3004,6 +3049,8 @@ void torture_tcase_resource(struct torture_tcase *tcase)
test->dangerous = true;
torture_tcase_add_simple_test(tcase, "GetResourceDependencyExpression",
test_GetResourceDependencyExpression);
+ torture_tcase_add_simple_test(tcase, "GetResourceNetworkName",
+ test_GetResourceNetworkName);
torture_tcase_add_simple_test(tcase, "all_resources",
test_all_resources);
}
--
2.4.3
>From 5ae6d37a2f091a9e176ca16c1f5f3585e603b401 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Fri, 10 Jul 2015 15:49:33 +0200
Subject: [PATCH 04/16] clusapi: add PROPERTY_LIST IDL.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Note this is hand-marshalled in Windows, seen in ClusterControl reqplies for a
CLUSCTL_CLUSTER_GET_RO_COMMON_PROPERTIES control.
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
librpc/idl/clusapi.idl | 74 ++++++++++++++++++++++++++++++++------------------
1 file changed, 48 insertions(+), 26 deletions(-)
diff --git a/librpc/idl/clusapi.idl b/librpc/idl/clusapi.idl
index 5cb7610..e6ddd42 100644
--- a/librpc/idl/clusapi.idl
+++ b/librpc/idl/clusapi.idl
@@ -1530,6 +1530,54 @@ import "security.idl", "winreg.idl";
CLUSCTL_CLUSTER_IS_READY_FOR_UPGRADE = 0x070000d5
} clusapi_ClusterControlCode;
+ typedef [v1_enum] enum {
+ CLUSPROP_SYNTAX_ENDMARK = 0x00000000,
+ CLUSPROP_SYNTAX_NAME = 0x00040003,
+ CLUSPROP_SYNTAX_RESCLASS = 0x00020002,
+ CLUSPROP_SYNTAX_LIST_VALUE_SZ = 0x00010003,
+ CLUSPROP_SYNTAX_LIST_VALUE_EXPAND_SZ = 0x00010004,
+ CLUSPROP_SYNTAX_LIST_VALUE_DWORD = 0x00010002,
+ CLUSPROP_SYNTAX_LIST_VALUE_BINARY = 0x00010001,
+ CLUSPROP_SYNTAX_LIST_VALUE_MULTI_SZ = 0x00010005,
+ CLUSPROP_SYNTAX_LIST_VALUE_LONG = 0x00010007,
+ CLUSPROP_SYNTAX_LIST_VALUE_EXPANDED_SZ = 0x00010008,
+ CLUSPROP_SYNTAX_LIST_VALUE_SECURITY_DESCRIPTOR = 0x00010009,
+ CLUSPROP_SYNTAX_LIST_VALUE_LARGE_INTEGER = 0x0001000a,
+ CLUSPROP_SYNTAX_LIST_VALUE_ULARGE_INTEGER = 0x00010006,
+ CLUSPROP_SYNTAX_LIST_VALUE_WORD = 0x0001000b,
+ CLUSPROP_SYNTAX_LIST_VALUE_FILETIME = 0x0001000c,
+ CLUSPROP_SYNTAX_DISK_SIGNATURE = 0x00050002,
+ CLUSPROP_SYNTAX_SCSI_ADDRESS = 0x00060002,
+ CLUSPROP_SYNTAX_DISK_NUMBER = 0x00070002,
+ CLUSPROP_SYNTAX_PARTITION_INFO = 0x00080001,
+ CLUSPROP_SYNTAX_DISK_SERIALNUMBER = 0x000a0003,
+ CLUSPROP_SYNTAX_DISK_GUID = 0x000b0003,
+ CLUSPROP_SYNTAX_DISK_SIZE = 0x000c0006,
+ CLUSPROP_SYNTAX_PARTITION_INFO_EX = 0x000d0001
+ } CLUSTER_PROPERTY_SYNTAX;
+
+ typedef struct {
+ CLUSTER_PROPERTY_SYNTAX Syntax;
+ uint32 Size;
+ [subcontext(0),subcontext_size(Size)] [flag(NDR_REMAINING)] DATA_BLOB Buffer;
+ [flag(NDR_ALIGN4)] DATA_BLOB Padding;
+ } clusapi_propertyValues;
+
+ typedef struct {
+ [value(CLUSPROP_SYNTAX_NAME)] CLUSTER_PROPERTY_SYNTAX syntax_name;
+ [value(strlen_m_term(buffer)*2)] uint32 size;
+ nstring buffer;
+ [flag(NDR_ALIGN2)] DATA_BLOB padding;
+ clusapi_propertyValues PropertyValues;
+ [value(CLUSPROP_SYNTAX_ENDMARK)] CLUSTER_PROPERTY_SYNTAX end_mark;
+ } clusapi_propertyValue;
+
+ typedef struct {
+ uint32 propertyCount;
+ clusapi_propertyValue propertyValues[propertyCount];
+ [value(CLUSPROP_SYNTAX_ENDMARK)] CLUSTER_PROPERTY_SYNTAX end_mark;
+ } clusapi_PROPERTY_LIST;
+
WERROR
clusapi_ClusterControl(
[ in ] HCLUSTER_RPC hCluster,
@@ -2197,32 +2245,6 @@ import "security.idl", "winreg.idl";
} CLUSTER_PROPERTY_FORMAT;
typedef enum {
- CLUSPROP_SYNTAX_ENDMARK = 0x00000000,
- CLUSPROP_SYNTAX_NAME = 0x00040003,
- CLUSPROP_SYNTAX_RESCLASS = 0x00020002,
- CLUSPROP_SYNTAX_LIST_VALUE_SZ = 0x00010003,
- CLUSPROP_SYNTAX_LIST_VALUE_EXPAND_SZ = 0x00010004,
- CLUSPROP_SYNTAX_LIST_VALUE_DWORD = 0x00010002,
- CLUSPROP_SYNTAX_LIST_VALUE_BINARY = 0x00010001,
- CLUSPROP_SYNTAX_LIST_VALUE_MULTI_SZ = 0x00010005,
- CLUSPROP_SYNTAX_LIST_VALUE_LONG = 0x00010007,
- CLUSPROP_SYNTAX_LIST_VALUE_EXPANDED_SZ = 0x00010008,
- CLUSPROP_SYNTAX_LIST_VALUE_SECURITY_DESCRIPTOR = 0x00010009,
- CLUSPROP_SYNTAX_LIST_VALUE_LARGE_INTEGER = 0x0001000a,
- CLUSPROP_SYNTAX_LIST_VALUE_ULARGE_INTEGER = 0x00010006,
- CLUSPROP_SYNTAX_LIST_VALUE_WORD = 0x0001000b,
- CLUSPROP_SYNTAX_LIST_VALUE_FILETIME = 0x0001000c,
- CLUSPROP_SYNTAX_DISK_SIGNATURE = 0x00050002,
- CLUSPROP_SYNTAX_SCSI_ADDRESS = 0x00060002,
- CLUSPROP_SYNTAX_DISK_NUMBER = 0x00070002,
- CLUSPROP_SYNTAX_PARTITION_INFO = 0x00080001,
- CLUSPROP_SYNTAX_DISK_SERIALNUMBER = 0x000a0003,
- CLUSPROP_SYNTAX_DISK_GUID = 0x000b0003,
- CLUSPROP_SYNTAX_DISK_SIZE = 0x000c0006,
- CLUSPROP_SYNTAX_PARTITION_INFO_EX = 0x000d0001
- } CLUSTER_PROPERTY_SYNTAX;
-
- typedef enum {
CLUS_CHAR_UNKNOWN = 0x00000000,
CLUS_CHAR_QUORUM = 0x00000001,
CLUS_CHAR_DELETE_REQUIRES_ALL_NODES = 0x00000002,
--
2.4.3
>From 06900ade7d2017157546fc381482e2427a09709c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Mon, 13 Jul 2015 21:08:23 +0200
Subject: [PATCH 05/16] s4-torture: add test for clusapi_CreateEnumEx().
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source4/torture/rpc/clusapi.c | 86 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c
index 4f21eab..8163029 100644
--- a/source4/torture/rpc/clusapi.c
+++ b/source4/torture/rpc/clusapi.c
@@ -325,6 +325,90 @@ static bool test_CreateEnum(struct torture_context *tctx,
return true;
}
+static bool test_CreateEnumEx_int(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ struct policy_handle *Cluster)
+{
+ struct dcerpc_binding_handle *b = p->binding_handle;
+ struct clusapi_CreateEnumEx r;
+ 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 *ReturnIdEnum;
+ struct ENUM_LIST *ReturnNameEnum;
+ WERROR rpc_status;
+ int i;
+
+ for (i=0; i < ARRAY_SIZE(dwType); i++) {
+
+ r.in.hCluster = *Cluster;
+ r.in.dwType = dwType[i];
+ r.in.dwOptions = 0;
+ r.out.ReturnIdEnum = &ReturnIdEnum;
+ r.out.ReturnNameEnum = &ReturnNameEnum;
+ r.out.rpc_status = &rpc_status;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_clusapi_CreateEnumEx_r(b, tctx, &r),
+ "CreateEnumEx failed");
+ torture_assert_werr_ok(tctx,
+ r.out.result,
+ "CreateEnumEx failed");
+ }
+
+ for (i=0; i < ARRAY_SIZE(dwType_invalid); i++) {
+
+ r.in.hCluster = *Cluster;
+ r.in.dwType = dwType_invalid[i];
+ r.in.dwOptions = 0;
+ r.out.ReturnIdEnum = &ReturnIdEnum;
+ r.out.ReturnNameEnum = &ReturnNameEnum;
+ r.out.rpc_status = &rpc_status;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_clusapi_CreateEnumEx_r(b, tctx, &r),
+ "CreateEnumEx failed");
+ torture_assert_werr_equal(tctx,
+ r.out.result,
+ WERR_INVALID_PARAMETER,
+ "CreateEnumEx failed");
+ }
+
+ return true;
+}
+
+static bool test_CreateEnumEx(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_CreateEnumEx_int(tctx, t->p, &Cluster);
+
+ test_CloseCluster_int(tctx, t->p, &Cluster);
+
+ return ret;
+}
+
+
static bool test_GetQuorumResource(struct torture_context *tctx,
void *data)
{
@@ -3000,6 +3084,8 @@ void torture_tcase_cluster(struct torture_tcase *tcase)
test_GetClusterVersion);
torture_tcase_add_simple_test(tcase, "CreateEnum",
test_CreateEnum);
+ torture_tcase_add_simple_test(tcase, "CreateEnumEx",
+ test_CreateEnumEx);
torture_tcase_add_simple_test(tcase, "GetClusterVersion2",
test_GetClusterVersion2);
torture_tcase_add_simple_test(tcase, "BackupClusterDatabase",
--
2.4.3
>From 5c7c2750a9fb680911326de57046e93ea615e5b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Mon, 13 Jul 2015 21:09:16 +0200
Subject: [PATCH 06/16] clusapi: use ClusterEnumType in clusapi_CreateEnumEx.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
librpc/idl/clusapi.idl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/librpc/idl/clusapi.idl b/librpc/idl/clusapi.idl
index e6ddd42..a46204f 100644
--- a/librpc/idl/clusapi.idl
+++ b/librpc/idl/clusapi.idl
@@ -1859,7 +1859,7 @@ import "security.idl", "winreg.idl";
WERROR
clusapi_CreateEnumEx(
[in] HCLUSTER_RPC hCluster,
- [in] uint32 dwType,
+ [in] ClusterEnumType dwType,
[in] uint32 dwOptions,
[out] ENUM_LIST **ReturnIdEnum,
[out] ENUM_LIST **ReturnNameEnum,
--
2.4.3
>From 570ca326867bf3c5879784b0e1b9c62f17321eb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Tue, 14 Jul 2015 15:55:57 +0200
Subject: [PATCH 07/16] s4-torture: add ndr testsuite for complex
clusapi_PROPERTY_LIST structs.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
librpc/idl/clusapi.idl | 2 +-
source4/torture/ndr/clusapi.c | 157 ++++++++++++++++++++++++++++++++++++++++++
source4/torture/ndr/ndr.c | 1 +
source4/torture/wscript_build | 21 +++++-
4 files changed, 179 insertions(+), 2 deletions(-)
create mode 100644 source4/torture/ndr/clusapi.c
diff --git a/librpc/idl/clusapi.idl b/librpc/idl/clusapi.idl
index a46204f..35169ed 100644
--- a/librpc/idl/clusapi.idl
+++ b/librpc/idl/clusapi.idl
@@ -1572,7 +1572,7 @@ import "security.idl", "winreg.idl";
[value(CLUSPROP_SYNTAX_ENDMARK)] CLUSTER_PROPERTY_SYNTAX end_mark;
} clusapi_propertyValue;
- typedef struct {
+ typedef [public] struct {
uint32 propertyCount;
clusapi_propertyValue propertyValues[propertyCount];
[value(CLUSPROP_SYNTAX_ENDMARK)] CLUSTER_PROPERTY_SYNTAX end_mark;
diff --git a/source4/torture/ndr/clusapi.c b/source4/torture/ndr/clusapi.c
new file mode 100644
index 0000000..193d206
--- /dev/null
+++ b/source4/torture/ndr/clusapi.c
@@ -0,0 +1,157 @@
+/*
+ Unix SMB/CIFS implementation.
+ test suite for clusapi ndr operations
+
+ Copyright (C) Guenther Deschner 2015
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "torture/ndr/ndr.h"
+#include "librpc/gen_ndr/ndr_clusapi.h"
+#include "torture/ndr/proto.h"
+#include "param/param.h"
+#include "libcli/registry/util_reg.h"
+
+static const uint8_t clusapi_PROPERTY_LIST_data[] = {
+ 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x46, 0x00, 0x69, 0x00, 0x78, 0x00, 0x51, 0x00, 0x75, 0x00, 0x6f, 0x00,
+ 0x72, 0x00, 0x75, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x04, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x50, 0x00, 0x72, 0x00,
+ 0x65, 0x00, 0x76, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x51, 0x00,
+ 0x75, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x75, 0x00, 0x6d, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00,
+ 0x49, 0x00, 0x67, 0x00, 0x6e, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x65, 0x00,
+ 0x50, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x73, 0x00,
+ 0x74, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x53, 0x00, 0x74, 0x00,
+ 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x4f, 0x00, 0x6e, 0x00, 0x53, 0x00,
+ 0x74, 0x00, 0x61, 0x00, 0x72, 0x00, 0x74, 0x00, 0x75, 0x00, 0x70, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00,
+ 0x24, 0x00, 0x00, 0x00, 0x53, 0x00, 0x68, 0x00, 0x61, 0x00, 0x72, 0x00,
+ 0x65, 0x00, 0x64, 0x00, 0x56, 0x00, 0x6f, 0x00, 0x6c, 0x00, 0x75, 0x00,
+ 0x6d, 0x00, 0x65, 0x00, 0x73, 0x00, 0x52, 0x00, 0x6f, 0x00, 0x6f, 0x00,
+ 0x74, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x24, 0x00, 0x00, 0x00,
+ 0x43, 0x00, 0x3a, 0x00, 0x5c, 0x00, 0x43, 0x00, 0x6c, 0x00, 0x75, 0x00,
+ 0x73, 0x00, 0x74, 0x00, 0x65, 0x00, 0x72, 0x00, 0x53, 0x00, 0x74, 0x00,
+ 0x6f, 0x00, 0x72, 0x00, 0x61, 0x00, 0x67, 0x00, 0x65, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x2a, 0x00, 0x00, 0x00,
+ 0x57, 0x00, 0x69, 0x00, 0x74, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x73, 0x00,
+ 0x73, 0x00, 0x44, 0x00, 0x79, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x6d, 0x00,
+ 0x69, 0x00, 0x63, 0x00, 0x57, 0x00, 0x65, 0x00, 0x69, 0x00, 0x67, 0x00,
+ 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x04, 0x00, 0x22, 0x00, 0x00, 0x00, 0x41, 0x00, 0x64, 0x00,
+ 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x41, 0x00, 0x63, 0x00, 0x63, 0x00,
+ 0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x50, 0x00, 0x6f, 0x00, 0x69, 0x00,
+ 0x6e, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+};
+
+static bool clusapi_PROPERTY_LIST_check(struct torture_context *tctx,
+ struct clusapi_PROPERTY_LIST *r)
+{
+ DATA_BLOB blob_dword_null = data_blob_talloc_zero(tctx, 4);
+ DATA_BLOB blob_dword_one = data_blob(NULL, 4);
+ const char *str;
+
+ SIVAL(blob_dword_one.data, 0, 1);
+
+ torture_assert_int_equal(tctx, r->propertyCount, 6, "propertyCount");
+
+ torture_assert_int_equal(tctx, r->propertyValues[0].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[0].size, 20, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[0].buffer, "FixQuorum", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[0].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[0].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[0].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[0].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ torture_assert_data_blob_equal(tctx, r->propertyValues[0].PropertyValues.Buffer, blob_dword_null, "Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[0].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[0].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[1].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[1].size, 28, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[1].buffer, "PreventQuorum", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[1].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[1].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[1].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[1].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ torture_assert_data_blob_equal(tctx, r->propertyValues[1].PropertyValues.Buffer, blob_dword_null, "Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[1].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[1].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[2].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[2].size, 62, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[2].buffer, "IgnorePersistentStateOnStartup", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[2].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[2].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[2].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[2].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ torture_assert_data_blob_equal(tctx, r->propertyValues[2].PropertyValues.Buffer, blob_dword_null, "Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[2].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[2].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[3].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[3].size, 36, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[3].buffer, "SharedVolumesRoot", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[3].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[3].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_SZ, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[3].PropertyValues.Size, 36, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[3].PropertyValues.Buffer.length, 36, "PropertyValues.Buffer.length");
+ pull_reg_sz(tctx, &r->propertyValues[3].PropertyValues.Buffer, &str);
+ torture_assert_str_equal(tctx, str, "C:\\ClusterStorage", "PropertyValues.Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[3].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[3].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[4].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[4].size, 42, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[4].buffer, "WitnessDynamicWeight", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[4].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[4].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[4].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[4].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ torture_assert_data_blob_equal(tctx, r->propertyValues[4].PropertyValues.Buffer, blob_dword_one, "Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[4].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[4].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[5].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[5].size, 34, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[5].buffer, "AdminAccessPoint", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[5].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[5].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[5].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[5].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ torture_assert_data_blob_equal(tctx, r->propertyValues[5].PropertyValues.Buffer, blob_dword_one, "Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[5].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[5].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ return true;
+}
+
+struct torture_suite *ndr_clusapi_suite(TALLOC_CTX *ctx)
+{
+ struct torture_suite *suite = torture_suite_create(ctx, "clusapi");
+
+ torture_suite_add_ndr_pullpush_test(suite,
+ clusapi_PROPERTY_LIST,
+ data_blob_const(clusapi_PROPERTY_LIST_data,sizeof(clusapi_PROPERTY_LIST_data)),
+ clusapi_PROPERTY_LIST_check);
+
+ return suite;
+}
diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c
index fe30705..9394cc9 100644
--- a/source4/torture/ndr/ndr.c
+++ b/source4/torture/ndr/ndr.c
@@ -417,6 +417,7 @@ struct torture_suite *torture_local_ndr(TALLOC_CTX *mem_ctx)
torture_suite_add_suite(suite, ndr_ntlmssp_suite(suite));
torture_suite_add_suite(suite, ndr_backupkey_suite(suite));
torture_suite_add_suite(suite, ndr_witness_suite(suite));
+ torture_suite_add_suite(suite, ndr_clusapi_suite(suite));
torture_suite_add_suite(suite, ndr_string_suite(suite));
torture_suite_add_simple_test(suite, "string terminator",
diff --git a/source4/torture/wscript_build b/source4/torture/wscript_build
index 9231bba..a7a14fd 100755
--- a/source4/torture/wscript_build
+++ b/source4/torture/wscript_build
@@ -39,7 +39,26 @@ if bld.CONFIG_SET('AD_DC_BUILD_IS_ENABLED'):
heimdal_specific['deps'] += ' SMB_SERVER dcerpc_server ntvfs'
bld.SAMBA_SUBSYSTEM('TORTURE_NDR',
- source='ndr/ndr.c ndr/winreg.c ndr/atsvc.c ndr/lsa.c ndr/epmap.c ndr/dfs.c ndr/netlogon.c ndr/drsuapi.c ndr/spoolss.c ndr/ntprinting.c ndr/samr.c ndr/dfsblob.c ndr/drsblobs.c ndr/nbt.c ndr/ntlmssp.c ndr/string.c ndr/backupkey.c ndr/witness.c',
+ source='''ndr/ndr.c
+ ndr/winreg.c
+ ndr/atsvc.c
+ ndr/lsa.c
+ ndr/epmap.c
+ ndr/dfs.c
+ ndr/netlogon.c
+ ndr/drsuapi.c
+ ndr/spoolss.c
+ ndr/ntprinting.c
+ ndr/samr.c
+ ndr/dfsblob.c
+ ndr/drsblobs.c
+ ndr/nbt.c
+ ndr/ntlmssp.c
+ ndr/string.c
+ ndr/backupkey.c
+ ndr/witness.c
+ ndr/clusapi.c
+ ''',
autoproto='ndr/proto.h',
deps='torture'
)
--
2.4.3
>From 976adb0197099722e3e9c9764e2f025b641974c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 16 Jul 2015 08:08:51 +0200
Subject: [PATCH 08/16] clusapi: use winreg_Type in clusapi registry IDL.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
librpc/idl/clusapi.idl | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/librpc/idl/clusapi.idl b/librpc/idl/clusapi.idl
index 35169ed..de74440 100644
--- a/librpc/idl/clusapi.idl
+++ b/librpc/idl/clusapi.idl
@@ -1,4 +1,4 @@
-import "security.idl", "winreg.idl";
+import "security.idl", "winreg.idl", "misc.idl";
#include "idl_types.h"
@@ -546,7 +546,7 @@ import "security.idl", "winreg.idl";
clusapi_SetValue(
[ in ] HKEY_RPC hKey,
[ in, string ] [charset(UTF16)] uint16 *lpValueName,
- [ in ] uint32 dwType,
+ [ in ] winreg_Type dwType,
[ in, size_is(cbData) ] uint8 *lpData,
[ in ] uint32 cbData,
[ out ] WERROR *rpc_status
@@ -569,7 +569,7 @@ import "security.idl", "winreg.idl";
clusapi_QueryValue(
[ in ] HKEY_RPC hKey,
[ in, string ] [charset(UTF16)] uint16 *lpValueName,
- [ out ] uint32 *lpValueType,
+ [ out ] winreg_Type *lpValueType,
[ out, size_is(cbData) ] uint8 *lpData,
[ in ] uint32 cbData,
[ out ] uint32 *lpcbRequired,
@@ -594,7 +594,7 @@ import "security.idl", "winreg.idl";
[ in ] HKEY_RPC hKey,
[ in ] uint32 dwIndex,
[ out, string ] [charset(UTF16)] uint16 **lpValueName,
- [ out ] uint32 *lpType,
+ [ out ] winreg_Type *lpType,
[ out, size_is(*lpcbData) ] uint8 *lpData,
[ in, out ] uint32 *lpcbData,
[ out ] uint32 *TotalSize,
--
2.4.3
>From 1491811f554227c6abf9de3577ae61408603cfbf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 16 Jul 2015 08:21:27 +0200
Subject: [PATCH 09/16] s4-torture: also test ClusterControl with a large
initial buffer size.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source4/torture/rpc/clusapi.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c
index 8163029..1ba9657 100644
--- a/source4/torture/rpc/clusapi.c
+++ b/source4/torture/rpc/clusapi.c
@@ -2056,6 +2056,21 @@ static bool test_ClusterControl_int(struct torture_context *tctx,
r.out.result,
"ClusterControl failed");
+ /* now try what happens when we query with a buffer large enough to hold
+ * the entire packet */
+
+ r.in.nOutBufferSize = 0x400;
+ r.out.lpOutBuffer = talloc_zero_array(tctx, uint8_t, r.in.nOutBufferSize);
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_clusapi_ClusterControl_r(b, tctx, &r),
+ "ClusterControl failed");
+ torture_assert_werr_ok(tctx,
+ r.out.result,
+ "ClusterControl failed");
+ torture_assert(tctx, *r.out.lpBytesReturned < r.in.nOutBufferSize,
+ "lpBytesReturned expected to be smaller than input size nOutBufferSize");
+
return true;
}
--
2.4.3
>From 2790237b7c8536aa910bd4917a26e5f699355f1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 16 Jul 2015 17:03:59 +0200
Subject: [PATCH 10/16] clusapi: add clusapi_GroupControlCode enum to IDL.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
librpc/idl/clusapi.idl | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/librpc/idl/clusapi.idl b/librpc/idl/clusapi.idl
index de74440..19851e1 100644
--- a/librpc/idl/clusapi.idl
+++ b/librpc/idl/clusapi.idl
@@ -1114,10 +1114,29 @@ import "security.idl", "winreg.idl", "misc.idl";
/*****************/
/* Function 0x4D */
+ typedef [v1_enum] enum {
+ CLUSCTL_GROUP_UNKNOWN = 0x03000000,
+ CLUSCTL_GROUP_GET_CHARACTERISTICS = 0x03000005,
+ CLUSCTL_GROUP_GET_FLAGS = 0x03000009,
+ CLUSCTL_GROUP_GET_NAME = 0x03000029,
+ CLUSCTL_GROUP_GET_ID = 0x03000039,
+ CLUSCTL_GROUP_ENUM_COMMON_PROPERTIES = 0x03000051,
+ CLUSCTL_GROUP_GET_RO_COMMON_PROPERTIES = 0x03000055,
+ CLUSCTL_GROUP_GET_COMMON_PROPERTIES = 0x03000059,
+ CLUSCTL_GROUP_SET_COMMON_PROPERTIES = 0x0340005E,
+ CLUSCTL_GROUP_VALIDATE_COMMON_PROPERTIES = 0x03000061,
+ CLUSCTL_GROUP_GET_COMMON_PROPERTY_FMTS = 0x03000065,
+ CLUSCTL_GROUP_ENUM_PRIVATE_PROPERTIES = 0x03000079,
+ CLUSCTL_GROUP_GET_RO_PRIVATE_PROPERTIES = 0x0300007D,
+ CLUSCTL_GROUP_GET_PRIVATE_PROPERTIES = 0x03000081,
+ CLUSCTL_GROUP_SET_PRIVATE_PROPERTIES = 0x03400086,
+ CLUSCTL_GROUP_VALIDATE_PRIVATE_PROPERTIES = 0x03000089
+ } clusapi_GroupControlCode;
+
WERROR
clusapi_GroupControl(
[ in ] HGROUP_RPC hGroup,
- [ in ] uint32 dwControlCode,
+ [ in ] clusapi_GroupControlCode dwControlCode,
[ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
[ in ] uint32 nInBufferSize,
[ out, size_is(nOutBufferSize),
--
2.4.3
>From 6747247813e9b50b8c004ee40206760f3538e38e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 16 Jul 2015 17:40:37 +0200
Subject: [PATCH 11/16] s4-torture: add tests for GroupControl.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source4/torture/rpc/clusapi.c | 93 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 93 insertions(+)
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c
index 1ba9657..1624490 100644
--- a/source4/torture/rpc/clusapi.c
+++ b/source4/torture/rpc/clusapi.c
@@ -1816,6 +1816,97 @@ static bool test_GetGroupId(struct torture_context *tctx,
return ret;
}
+static bool test_GroupControl_int(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ struct policy_handle *hGroup,
+ enum clusapi_GroupControlCode dwControlCode)
+{
+ struct dcerpc_binding_handle *b = p->binding_handle;
+ struct clusapi_GroupControl r;
+ uint32_t lpBytesReturned;
+ uint32_t lpcbRequired;
+ WERROR rpc_status;
+
+ r.in.hGroup = *hGroup;
+ 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_GroupControl_r(b, tctx, &r),
+ "GroupControl failed");
+ torture_assert_werr_equal(tctx,
+ r.out.result,
+ WERR_INVALID_FUNCTION,
+ "GroupControl failed");
+
+ r.in.dwControlCode = dwControlCode;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_clusapi_GroupControl_r(b, tctx, &r),
+ "GroupControl 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_GroupControl_r(b, tctx, &r),
+ "GroupControl failed");
+ }
+ torture_assert_werr_ok(tctx,
+ r.out.result,
+ "GroupControl failed");
+
+ /* now try what happens when we query with a buffer large enough to hold
+ * the entire packet */
+
+ r.in.nOutBufferSize = 0x400;
+ r.out.lpOutBuffer = talloc_zero_array(tctx, uint8_t, r.in.nOutBufferSize);
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_clusapi_GroupControl_r(b, tctx, &r),
+ "GroupControl failed");
+ torture_assert_werr_ok(tctx,
+ r.out.result,
+ "GroupControl failed");
+ torture_assert(tctx, *r.out.lpBytesReturned < r.in.nOutBufferSize,
+ "lpBytesReturned expected to be smaller than input size nOutBufferSize");
+
+ return true;
+}
+
+static bool test_GroupControl(struct torture_context *tctx,
+ void *data)
+{
+ struct torture_clusapi_context *t =
+ talloc_get_type_abort(data, struct torture_clusapi_context);
+ struct policy_handle hGroup;
+ bool ret = true;
+
+ if (!test_OpenGroup_int(tctx, t->p, "Cluster Group", &hGroup)) {
+ return false;
+ }
+
+ ret = test_GroupControl_int(tctx, t->p, &hGroup, CLUSCTL_GROUP_GET_CHARACTERISTICS);
+ if (ret) {
+ return false;
+ }
+
+ ret = test_GroupControl_int(tctx, t->p, &hGroup, CLUSCTL_GROUP_GET_RO_COMMON_PROPERTIES);
+ if (ret) {
+ return false;
+ }
+
+ test_CloseGroup_int(tctx, t->p, &hGroup);
+
+ return ret;
+}
+
static bool test_OnlineGroup_int(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *hGroup)
@@ -3196,6 +3287,8 @@ void torture_tcase_group(struct torture_tcase *tcase)
test_GetGroupState);
torture_tcase_add_simple_test(tcase, "GetGroupId",
test_GetGroupId);
+ torture_tcase_add_simple_test(tcase, "GroupControl",
+ test_GroupControl);
torture_tcase_add_simple_test(tcase, "OnlineGroup",
test_OnlineGroup);
test = torture_tcase_add_simple_test(tcase, "OfflineGroup",
--
2.4.3
>From 315b5c7fa2f4519efd8904b6428af95b9abc220d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 16 Jul 2015 23:22:18 +0200
Subject: [PATCH 12/16] clusapi: add clusapi_NodeControlCode to IDL.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
librpc/idl/clusapi.idl | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/librpc/idl/clusapi.idl b/librpc/idl/clusapi.idl
index 19851e1..42a9ecb 100644
--- a/librpc/idl/clusapi.idl
+++ b/librpc/idl/clusapi.idl
@@ -1168,10 +1168,29 @@ import "security.idl", "winreg.idl", "misc.idl";
/*****************/
/* Function 0x4F */
+ typedef [v1_enum] enum {
+ CLUSCTL_NODE_UNKNOWN = 0x04000000,
+ CLUSCTL_NODE_GET_CHARACTERISTICS = 0x04000005,
+ CLUSCTL_NODE_GET_FLAGS = 0x04000009,
+ CLUSCTL_NODE_GET_NAME = 0x04000029,
+ CLUSCTL_NODE_GET_ID = 0x04000039,
+ CLUSCTL_NODE_GET_CLUSTER_SERVICE_ACCOUNT_NAME = 0x04000041,
+ CLUSCTL_NODE_ENUM_COMMON_PROPERTIES = 0x04000051,
+ CLUSCTL_NODE_GET_RO_COMMON_PROPERTIES = 0x04000055,
+ CLUSCTL_NODE_GET_COMMON_PROPERTIES = 0x04000059,
+ CLUSCTL_NODE_SET_COMMON_PROPERTIES = 0x0440005E,
+ CLUSCTL_NODE_VALIDATE_COMMON_PROPERTIES = 0x04000061,
+ CLUSCTL_NODE_ENUM_PRIVATE_PROPERTIES = 0x04000079,
+ CLUSCTL_NODE_GET_RO_PRIVATE_PROPERTIES = 0x0400007D,
+ CLUSCTL_NODE_GET_PRIVATE_PROPERTIES = 0x04000081,
+ CLUSCTL_NODE_SET_PRIVATE_PROPERTIES = 0x04400086,
+ CLUSCTL_NODE_VALIDATE_PRIVATE_PROPERTIES = 0x04000089
+ } clusapi_NodeControlCode;
+
WERROR
clusapi_NodeControl(
[ in ] HNODE_RPC hNode,
- [ in ] uint32 dwControlCode,
+ [ in ] clusapi_NodeControlCode dwControlCode,
[ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
[ in ] uint32 nInBufferSize,
[ out, size_is(nOutBufferSize),
--
2.4.3
>From 8875ad773cf70bb4aade78c79f9312d5cc5639d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Thu, 16 Jul 2015 23:28:33 +0200
Subject: [PATCH 13/16] s4-torture: add torture test for clusapi_NodeControl.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source4/torture/rpc/clusapi.c | 84 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 84 insertions(+)
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c
index 1624490..9a1e956 100644
--- a/source4/torture/rpc/clusapi.c
+++ b/source4/torture/rpc/clusapi.c
@@ -1423,6 +1423,88 @@ static bool test_GetNodeId(struct torture_context *tctx,
return ret;
}
+static bool test_NodeControl_int(struct torture_context *tctx,
+ struct dcerpc_pipe *p,
+ struct policy_handle *hNode)
+{
+ struct dcerpc_binding_handle *b = p->binding_handle;
+ struct clusapi_NodeControl r;
+ uint32_t lpBytesReturned;
+ uint32_t lpcbRequired;
+ WERROR rpc_status;
+
+ r.in.hNode = *hNode;
+ 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_NodeControl_r(b, tctx, &r),
+ "NodeControl failed");
+ torture_assert_werr_equal(tctx,
+ r.out.result,
+ WERR_INVALID_FUNCTION,
+ "NodeControl failed");
+
+ r.in.dwControlCode = CLUSCTL_NODE_GET_RO_COMMON_PROPERTIES;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_clusapi_NodeControl_r(b, tctx, &r),
+ "NodeControl 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_NodeControl_r(b, tctx, &r),
+ "NodeControl failed");
+ }
+ torture_assert_werr_ok(tctx,
+ r.out.result,
+ "NodeControl failed");
+
+ /* now try what happens when we query with a buffer large enough to hold
+ * the entire packet */
+
+ r.in.nOutBufferSize = 0x400;
+ r.out.lpOutBuffer = talloc_zero_array(tctx, uint8_t, r.in.nOutBufferSize);
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_clusapi_NodeControl_r(b, tctx, &r),
+ "NodeControl failed");
+ torture_assert_werr_ok(tctx,
+ r.out.result,
+ "NodeControl failed");
+ torture_assert(tctx, *r.out.lpBytesReturned < r.in.nOutBufferSize,
+ "lpBytesReturned expected to be smaller than input size nOutBufferSize");
+
+ return true;
+}
+
+static bool test_NodeControl(struct torture_context *tctx,
+ void *data)
+{
+ struct torture_clusapi_context *t =
+ talloc_get_type_abort(data, struct torture_clusapi_context);
+ struct policy_handle hNode;
+ bool ret = true;
+
+ if (!test_OpenNode_int(tctx, t->p, t->NodeName, &hNode)) {
+ return false;
+ }
+
+ ret = test_NodeControl_int(tctx, t->p, &hNode);
+
+ test_CloseNode_int(tctx, t->p, &hNode);
+
+ return ret;
+}
+
static bool test_PauseNode_int(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *hNode)
@@ -3261,6 +3343,8 @@ void torture_tcase_node(struct torture_tcase *tcase)
test_GetNodeState);
torture_tcase_add_simple_test(tcase, "GetNodeId",
test_GetNodeId);
+ torture_tcase_add_simple_test(tcase, "NodeControl",
+ test_NodeControl);
test = torture_tcase_add_simple_test(tcase, "PauseNode",
test_PauseNode);
test->dangerous = true;
--
2.4.3
>From 616c7f08fa6d4bcf5d3035b678399452dc9d5c94 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Fri, 17 Jul 2015 00:14:09 +0200
Subject: [PATCH 14/16] s4-torture: add more ndr tests for property lists.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This data is derived from clusapi_NodeControl.
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source4/torture/ndr/clusapi.c | 226 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 226 insertions(+)
diff --git a/source4/torture/ndr/clusapi.c b/source4/torture/ndr/clusapi.c
index 193d206..f1156d0 100644
--- a/source4/torture/ndr/clusapi.c
+++ b/source4/torture/ndr/clusapi.c
@@ -144,6 +144,227 @@ static bool clusapi_PROPERTY_LIST_check(struct torture_context *tctx,
return true;
}
+static const uint8_t clusapi_PROPERTY_LIST_data2[] = {
+ 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x12, 0x00, 0x00, 0x00,
+ 0x4e, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00, 0x4e, 0x00, 0x61, 0x00,
+ 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00,
+ 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00,
+ 0x26, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00,
+ 0x48, 0x00, 0x69, 0x00, 0x67, 0x00, 0x68, 0x00, 0x65, 0x00, 0x73, 0x00,
+ 0x74, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00,
+ 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x80, 0x25, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x6f, 0x00,
+ 0x64, 0x00, 0x65, 0x00, 0x4c, 0x00, 0x6f, 0x00, 0x77, 0x00, 0x65, 0x00,
+ 0x73, 0x00, 0x74, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00, 0x73, 0x00,
+ 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x80, 0x25, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x04, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x61, 0x00,
+ 0x6a, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x56, 0x00, 0x65, 0x00, 0x72, 0x00,
+ 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x1a, 0x00, 0x00, 0x00,
+ 0x4d, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x56, 0x00,
+ 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00,
+ 0x18, 0x00, 0x00, 0x00, 0x42, 0x00, 0x75, 0x00, 0x69, 0x00, 0x6c, 0x00,
+ 0x64, 0x00, 0x4e, 0x00, 0x75, 0x00, 0x6d, 0x00, 0x62, 0x00, 0x65, 0x00,
+ 0x72, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x80, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00,
+ 0x16, 0x00, 0x00, 0x00, 0x43, 0x00, 0x53, 0x00, 0x44, 0x00, 0x56, 0x00,
+ 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00,
+ 0x1e, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00,
+ 0x49, 0x00, 0x6e, 0x00, 0x73, 0x00, 0x74, 0x00, 0x61, 0x00, 0x6e, 0x00,
+ 0x63, 0x00, 0x65, 0x00, 0x49, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x01, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00,
+ 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+ 0x2d, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x2d, 0x00,
+ 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x2d, 0x00, 0x30, 0x00,
+ 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x2d, 0x00, 0x30, 0x00, 0x30, 0x00,
+ 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+ 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x4e, 0x00, 0x6f, 0x00, 0x64, 0x00, 0x65, 0x00, 0x44, 0x00, 0x72, 0x00,
+ 0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x53, 0x00, 0x74, 0x00, 0x61, 0x00,
+ 0x74, 0x00, 0x75, 0x00, 0x73, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x6f, 0x00,
+ 0x64, 0x00, 0x65, 0x00, 0x44, 0x00, 0x72, 0x00, 0x61, 0x00, 0x69, 0x00,
+ 0x6e, 0x00, 0x54, 0x00, 0x61, 0x00, 0x72, 0x00, 0x67, 0x00, 0x65, 0x00,
+ 0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x04, 0x00,
+ 0x1c, 0x00, 0x00, 0x00, 0x44, 0x00, 0x79, 0x00, 0x6e, 0x00, 0x61, 0x00,
+ 0x6d, 0x00, 0x69, 0x00, 0x63, 0x00, 0x57, 0x00, 0x65, 0x00, 0x69, 0x00,
+ 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x04, 0x00, 0x26, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x65, 0x00,
+ 0x65, 0x00, 0x64, 0x00, 0x73, 0x00, 0x50, 0x00, 0x72, 0x00, 0x65, 0x00,
+ 0x76, 0x00, 0x65, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x51, 0x00, 0x75, 0x00,
+ 0x6f, 0x00, 0x72, 0x00, 0x75, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static bool clusapi_PROPERTY_LIST_check2(struct torture_context *tctx,
+ struct clusapi_PROPERTY_LIST *r)
+{
+ DATA_BLOB blob_dword_null = data_blob_talloc_zero(tctx, 4);
+ DATA_BLOB blob_dword_one = data_blob(NULL, 4);
+ DATA_BLOB blob_dword = data_blob(NULL, 4);
+ const char *str;
+
+ SIVAL(blob_dword_one.data, 0, 1);
+
+ torture_assert_int_equal(tctx, r->propertyCount, 12, "propertyCount");
+
+ torture_assert_int_equal(tctx, r->propertyValues[0].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[0].size, 18, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[0].buffer, "NodeName", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[0].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[0].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_SZ, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[0].PropertyValues.Size, 12, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[0].PropertyValues.Buffer.length, 12, "PropertyValues.Buffer.length");
+ pull_reg_sz(tctx, &r->propertyValues[0].PropertyValues.Buffer, &str);
+ torture_assert_str_equal(tctx, str, "node1", "PropertyValues.Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[0].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[0].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[1].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[1].size, 38, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[1].buffer, "NodeHighestVersion", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[1].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[1].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[1].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[1].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ SIVAL(blob_dword.data, 0, 0x00082580);
+ torture_assert_data_blob_equal(tctx, r->propertyValues[1].PropertyValues.Buffer, blob_dword, "PropertyValues.Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[1].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[1].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[2].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[2].size, 36, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[2].buffer, "NodeLowestVersion", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[2].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[2].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[2].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[2].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ SIVAL(blob_dword.data, 0, 0x00082580);
+ torture_assert_data_blob_equal(tctx, r->propertyValues[2].PropertyValues.Buffer, blob_dword, "PropertyValues.Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[2].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[2].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[3].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[3].size, 26, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[3].buffer, "MajorVersion", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[3].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[3].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[3].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[3].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ SIVAL(blob_dword.data, 0, 0x06);
+ torture_assert_data_blob_equal(tctx, r->propertyValues[3].PropertyValues.Buffer, blob_dword, "PropertyValues.Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[3].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[3].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[4].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[4].size, 26, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[4].buffer, "MinorVersion", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[4].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[4].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[4].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[4].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ SIVAL(blob_dword.data, 0, 0x03);
+ torture_assert_data_blob_equal(tctx, r->propertyValues[4].PropertyValues.Buffer, blob_dword, "PropertyValues.Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[4].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[4].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[5].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[5].size, 24, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[5].buffer, "BuildNumber", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[5].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[5].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[5].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[5].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ SIVAL(blob_dword.data, 0, 0x00002580);
+ torture_assert_data_blob_equal(tctx, r->propertyValues[5].PropertyValues.Buffer, blob_dword, "PropertyValues.Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[5].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[5].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[6].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[6].size, 22, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[6].buffer, "CSDVersion", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[6].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[6].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_SZ, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[6].PropertyValues.Size, 2, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[6].PropertyValues.Buffer.length, 2, "PropertyValues.Buffer.length");
+ pull_reg_sz(tctx, &r->propertyValues[6].PropertyValues.Buffer, &str);
+ torture_assert_str_equal(tctx, str, "", "PropertyValues.Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[6].PropertyValues.Padding.length, 2, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[6].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[7].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[7].size, 30, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[7].buffer, "NodeInstanceID", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[7].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[7].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_SZ, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[7].PropertyValues.Size, 74, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[7].PropertyValues.Buffer.length, 74, "PropertyValues.Buffer.length");
+ pull_reg_sz(tctx, &r->propertyValues[7].PropertyValues.Buffer, &str);
+ torture_assert_str_equal(tctx, str, "00000000-0000-0000-0000-000000000002", "PropertyValues.Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[7].PropertyValues.Padding.length, 2, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[7].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[8].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[8].size, 32, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[8].buffer, "NodeDrainStatus", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[8].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[8].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[8].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[8].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ torture_assert_data_blob_equal(tctx, r->propertyValues[8].PropertyValues.Buffer, blob_dword_null, "Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[8].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[8].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[9].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[9].size, 32, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[9].buffer, "NodeDrainTarget", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[9].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[9].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[9].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[9].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ SIVAL(blob_dword.data, 0, 0xffffffff);
+ torture_assert_data_blob_equal(tctx, r->propertyValues[9].PropertyValues.Buffer, blob_dword, "PropertyValues.Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[9].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[9].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[10].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[10].size, 28, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[10].buffer, "DynamicWeight", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[10].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[10].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[10].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[10].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ torture_assert_data_blob_equal(tctx, r->propertyValues[10].PropertyValues.Buffer, blob_dword_one, "Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[10].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[10].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ torture_assert_int_equal(tctx, r->propertyValues[11].syntax_name, CLUSPROP_SYNTAX_NAME, "syntax_name");
+ torture_assert_int_equal(tctx, r->propertyValues[11].size, 38, "size");
+ torture_assert_str_equal(tctx, r->propertyValues[11].buffer, "NeedsPreventQuorum", "buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[11].padding.length, 0, "padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[11].PropertyValues.Syntax, CLUSPROP_SYNTAX_LIST_VALUE_DWORD, "PropertyValues.Syntax");
+ torture_assert_int_equal(tctx, r->propertyValues[11].PropertyValues.Size, 4, "PropertyValues.Size");
+ torture_assert_int_equal(tctx, r->propertyValues[11].PropertyValues.Buffer.length, 4, "PropertyValues.Buffer.length");
+ torture_assert_data_blob_equal(tctx, r->propertyValues[11].PropertyValues.Buffer, blob_dword_null, "Buffer");
+ torture_assert_int_equal(tctx, r->propertyValues[11].PropertyValues.Padding.length, 0, "PropertyValues.Padding.length");
+ torture_assert_int_equal(tctx, r->propertyValues[11].end_mark, CLUSPROP_SYNTAX_ENDMARK, "end_mark");
+
+ return true;
+}
+
struct torture_suite *ndr_clusapi_suite(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(ctx, "clusapi");
@@ -153,5 +374,10 @@ struct torture_suite *ndr_clusapi_suite(TALLOC_CTX *ctx)
data_blob_const(clusapi_PROPERTY_LIST_data,sizeof(clusapi_PROPERTY_LIST_data)),
clusapi_PROPERTY_LIST_check);
+ torture_suite_add_ndr_pullpush_test(suite,
+ clusapi_PROPERTY_LIST,
+ data_blob_const(clusapi_PROPERTY_LIST_data2,sizeof(clusapi_PROPERTY_LIST_data2)),
+ clusapi_PROPERTY_LIST_check2);
+
return suite;
}
--
2.4.3
>From 7fd2adfb1ee0df3a89b881099ad0c656f254000f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Fri, 17 Jul 2015 11:39:52 +0200
Subject: [PATCH 15/16] s3-rpcclient: add client for create enum ex.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source3/rpcclient/cmd_clusapi.c | 58 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/source3/rpcclient/cmd_clusapi.c b/source3/rpcclient/cmd_clusapi.c
index b7451dc..ab1b1f4 100644
--- a/source3/rpcclient/cmd_clusapi.c
+++ b/source3/rpcclient/cmd_clusapi.c
@@ -203,6 +203,63 @@ static WERROR cmd_clusapi_create_enum(struct rpc_pipe_client *cli,
return WERR_OK;
}
+static WERROR cmd_clusapi_create_enumex(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx,
+ int argc,
+ const char **argv)
+{
+ struct dcerpc_binding_handle *b = cli->binding_handle;
+ NTSTATUS status;
+ WERROR error;
+ uint32_t dwType = 1;
+ struct ENUM_LIST *ReturnIdEnum;
+ struct ENUM_LIST *ReturnNameEnum;
+ WERROR rpc_status, ignore;
+ struct policy_handle Cluster;
+
+ status = dcerpc_clusapi_OpenCluster(b, mem_ctx,
+ &error,
+ &Cluster);
+ if (!NT_STATUS_IS_OK(status)) {
+ return ntstatus_to_werror(status);
+ }
+
+ if (!W_ERROR_IS_OK(error)) {
+ printf("error: %s\n", win_errstr(error));
+ return error;
+ }
+
+ if (argc >= 2) {
+ sscanf(argv[1],"%x",&dwType);
+ }
+
+ status = dcerpc_clusapi_CreateEnumEx(b, mem_ctx,
+ Cluster,
+ dwType,
+ 0,
+ &ReturnIdEnum,
+ &ReturnNameEnum,
+ &rpc_status,
+ &error);
+ dcerpc_clusapi_CloseCluster(b, mem_ctx,
+ &Cluster,
+ &ignore);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return ntstatus_to_werror(status);
+ }
+
+ if (!W_ERROR_IS_OK(error)) {
+ printf("error: %s\n", win_errstr(error));
+ return error;
+ }
+
+ printf("rpc_status: %s\n", win_errstr(rpc_status));
+
+ return WERR_OK;
+}
+
+
static WERROR cmd_clusapi_open_resource(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
int argc,
@@ -453,6 +510,7 @@ struct cmd_set clusapi_commands[] = {
{ "clusapi_get_cluster_version", RPC_RTYPE_WERROR, NULL, cmd_clusapi_get_cluster_version, &ndr_table_clusapi, NULL, "bla", "" },
{ "clusapi_get_quorum_resource", RPC_RTYPE_WERROR, NULL, cmd_clusapi_get_quorum_resource, &ndr_table_clusapi, NULL, "bla", "" },
{ "clusapi_create_enum", RPC_RTYPE_WERROR, NULL, cmd_clusapi_create_enum, &ndr_table_clusapi, NULL, "bla", "" },
+ { "clusapi_create_enumex", RPC_RTYPE_WERROR, NULL, cmd_clusapi_create_enumex, &ndr_table_clusapi, NULL, "bla", "" },
{ "clusapi_open_resource", RPC_RTYPE_WERROR, NULL, cmd_clusapi_open_resource, &ndr_table_clusapi, NULL, "bla", "" },
{ "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", "" },
--
2.4.3
>From 85638b07a35e68eef6f8855d5f4afcda30651936 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
Date: Tue, 21 Jul 2015 15:31:20 +0200
Subject: [PATCH 16/16] s4-torture: add test for CLUSCTL_NODE_GET_ID in
clusapi_NodeControl.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Guenther
Signed-off-by: Günther Deschner <gd at samba.org>
---
source4/torture/rpc/clusapi.c | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c
index 9a1e956..e3fff82 100644
--- a/source4/torture/rpc/clusapi.c
+++ b/source4/torture/rpc/clusapi.c
@@ -1425,7 +1425,8 @@ static bool test_GetNodeId(struct torture_context *tctx,
static bool test_NodeControl_int(struct torture_context *tctx,
struct dcerpc_pipe *p,
- struct policy_handle *hNode)
+ struct policy_handle *hNode,
+ enum clusapi_NodeControlCode dwControlCode)
{
struct dcerpc_binding_handle *b = p->binding_handle;
struct clusapi_NodeControl r;
@@ -1451,7 +1452,7 @@ static bool test_NodeControl_int(struct torture_context *tctx,
WERR_INVALID_FUNCTION,
"NodeControl failed");
- r.in.dwControlCode = CLUSCTL_NODE_GET_RO_COMMON_PROPERTIES;
+ r.in.dwControlCode = dwControlCode;
torture_assert_ntstatus_ok(tctx,
dcerpc_clusapi_NodeControl_r(b, tctx, &r),
@@ -1483,6 +1484,20 @@ static bool test_NodeControl_int(struct torture_context *tctx,
torture_assert(tctx, *r.out.lpBytesReturned < r.in.nOutBufferSize,
"lpBytesReturned expected to be smaller than input size nOutBufferSize");
+ if (dwControlCode == CLUSCTL_NODE_GET_ID) {
+ const char *str;
+ DATA_BLOB blob = data_blob_const(r.out.lpOutBuffer, *r.out.lpBytesReturned);
+
+ torture_assert(tctx, *r.out.lpBytesReturned < 4, "unexpected size");
+ torture_assert(tctx, *r.out.lpBytesReturned % 2, "must be a multiple of 2");
+
+ torture_assert(tctx,
+ pull_reg_sz(tctx, &blob, &str),
+ "failed to pull unicode string");
+
+ torture_comment(tctx, "got this node id: '%s'", str);
+ }
+
return true;
}
@@ -1498,7 +1513,15 @@ static bool test_NodeControl(struct torture_context *tctx,
return false;
}
- ret = test_NodeControl_int(tctx, t->p, &hNode);
+ ret = test_NodeControl_int(tctx, t->p, &hNode, CLUSCTL_NODE_GET_RO_COMMON_PROPERTIES);
+ if (ret) {
+ return false;
+ }
+
+ ret = test_NodeControl_int(tctx, t->p, &hNode, CLUSCTL_NODE_GET_ID);
+ if (ret) {
+ return false;
+ }
test_CloseNode_int(tctx, t->p, &hNode);
--
2.4.3
More information about the samba-technical
mailing list