[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Jan 16 21:35:04 UTC 2020


The branch, master has been updated
       via  75367e4b067 librpc: add clusapi_GroupSetControlCode enum
       via  ac5b7427022 s4-torture: increase various bufsizes to better deal with Windows 2019 clusters
       via  83bbc5cc42e s4-torture: fix copy/paste error in clusapi group test
       via  edf21f5e303 s4-torture: add clusapi GroupSet tests
       via  21157c66abb s4-torture: fix asserts in clusapi_NodeControl tests
       via  efe353edf48 s4-torture: save cluster version in clusapi test context
       via  8dca8aaf95b librpc: add various new clusapi functions and types
       via  4bc481c5cb7 samba-tool gpo: improve UNC parsing
      from  ebced94a872 torture: Test smbcontrol close-denied-share

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


- Log -----------------------------------------------------------------
commit 75367e4b0675047c6b21447473c779547d6b51b6
Author: Günther Deschner <gd at samba.org>
Date:   Thu Jan 16 14:53:19 2020 +0100

    librpc: add clusapi_GroupSetControlCode enum
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Jan 16 21:34:27 UTC 2020 on sn-devel-184

commit ac5b7427022333a312b504cdde9d725676274c93
Author: Günther Deschner <gd at samba.org>
Date:   Thu Jan 16 14:38:56 2020 +0100

    s4-torture: increase various bufsizes to better deal with Windows 2019 clusters
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 83bbc5cc42ee33e93bb583886b09c38bde767570
Author: Günther Deschner <gd at samba.org>
Date:   Thu Jan 16 11:19:52 2020 +0100

    s4-torture: fix copy/paste error in clusapi group test
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit edf21f5e3034b104cfe99e97f62478194d23283e
Author: Günther Deschner <gd at samba.org>
Date:   Mon Jan 13 14:37:40 2020 +0100

    s4-torture: add clusapi GroupSet tests
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 21157c66abb349c97d02a1a104a6e1cfcb577542
Author: Günther Deschner <gd at samba.org>
Date:   Mon Jan 13 18:30:14 2020 +0100

    s4-torture: fix asserts in clusapi_NodeControl tests
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit efe353edf486ee2ab351735a8f927fe607046bb1
Author: Günther Deschner <gd at samba.org>
Date:   Mon Jan 13 16:11:26 2020 +0100

    s4-torture: save cluster version in clusapi test context
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8dca8aaf95bd5fe74c71dc2530a6e57feeee6416
Author: Günther Deschner <gd at samba.org>
Date:   Fri Jan 10 16:44:39 2020 +0100

    librpc: add various new clusapi functions and types
    
    Guenther
    
    Signed-off-by: Guenther Deschner <gd at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4bc481c5cb7d772f473171949a3d522788bb7dcf
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date:   Thu Jan 16 14:12:02 2020 +1300

    samba-tool gpo: improve UNC parsing
    
    The "UNC doesn't start with \\\\ or //" message was unreachable due to
    a logic error, and an UNC starting with \\ would have been split on
    / if there were enough /s in the string.
    
    The unreachable exception was first noticed by Gerhard Lausser in a
    github pull request (https://github.com/samba-team/samba/pull/123),
    but that patch no longer applies with this more thorough rewrite.
    
    Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 librpc/idl/clusapi.idl        | 361 ++++++++++++++++++++++++++++++++++++++++++
 python/samba/netcmd/gpo.py    |  19 +--
 source4/torture/rpc/clusapi.c | 207 ++++++++++++++++++++++--
 3 files changed, 568 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/librpc/idl/clusapi.idl b/librpc/idl/clusapi.idl
index 6c86f10638f..7cc3f5ff825 100644
--- a/librpc/idl/clusapi.idl
+++ b/librpc/idl/clusapi.idl
@@ -10,6 +10,7 @@ import "winreg.idl", "misc.idl";
 	authservice("MSServerClusterMgmtAPI"),
 	helpstring("Failover Cluster Management API (clusapi)")
 ]
+#define MAX_CLUSTER_CONTROL_CODE_BUFFER_SIZE 0x7FFFFFFF
 	interface clusapi
 {
 #if 0
@@ -2598,4 +2599,364 @@ import "winreg.idl", "misc.idl";
 		DiskIdUnKnown = 0x00001388
 	} CLUSDSK_DISKID_ENUM;
 #endif
+
+	/*****************/
+	/* Function 0x94 */
+
+	WERROR
+	Opnum148NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0x95 */
+
+	WERROR
+	Opnum149otUsedOnWire(void);
+
+	/*****************/
+	/* Function 0x96 */
+
+	WERROR
+	Opnum150NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0x97 */
+
+	WERROR
+	Opnum151NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0x98 */
+
+	WERROR
+	Opnum152NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0x99 */
+
+	WERROR
+	Opnum153NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0x9A */
+
+	WERROR
+	Opnum154NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0x9B */
+
+	WERROR
+	clusapi_AddNotifyResourceTypeV2(
+		[ in ] HNOTIFY_RPC hNotify,
+		[ in ] hyper filter,
+		[ in ] uint32 dwNotifyKey,
+		[ in, string ] [charset(UTF16)] uint16 *resTypeName,
+		[ in ] uint32 dwVersion,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0x9C */
+
+	WERROR
+	Opnum156NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0x9D */
+
+	WERROR
+	clusapi_ExecuteReadBatchEx(
+		[in] HKEY_RPC hKey,
+		[in] uint32 cbInData,
+		[in, size_is(cbInData)] uint8* lpInData,
+		[in] uint32 flags,
+		[out] uint32* cbOutData,
+		[out, size_is(,*cbOutData)] uint8** lpOutData,
+		[out] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0x9E */
+
+	WERROR
+	Opnum158NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0x9F */
+
+	WERROR
+	Opnum159NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0xA0 */
+
+	WERROR
+	Opnum160NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0xA1 */
+
+	WERROR
+	Opnum161NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0xA2 */
+
+	WERROR
+	Opnum162NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0xA3 */
+
+#define HGROUPSET_RPC policy_handle
+#if 0
+	typedef [context_handle] void *HGROUPSET_RPC;
+#endif
+#if 0
+	HGROUPSET_RPC
+	clusapi_CreateGroupSet (
+		[ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName,
+		[ out ] WERROR *Status,
+		[ out ] WERROR *rpc_status
+	);
+#else
+	void
+	clusapi_CreateGroupSet (
+		[ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName,
+		[ out ] WERROR *Status,
+		[ out ] WERROR *rpc_status,
+		[ out ] HGROUPSET_RPC *hGroupSet
+	);
+#endif
+
+	/*****************/
+	/* Function 0xA4 */
+#if 0
+	HGROUPSET_RPC
+	clusapi_OpenGroupSet(
+		[ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName,
+		[ out ] WERROR *Status,
+		[ out ] WERROR *rpc_status
+	);
+#else
+	void
+	clusapi_OpenGroupSet(
+		[ in, string ] [charset(UTF16)] uint16 *lpszGroupSetName,
+		[ out ] WERROR *Status,
+		[ out ] WERROR *rpc_status,
+		[ out ] HGROUPSET_RPC *hGroupSet
+	);
+#endif
+
+	/*****************/
+	/* Function 0xA5 */
+
+	WERROR
+	clusapi_CloseGroupSet(
+		[ in, out ] HGROUPSET_RPC *GroupSet
+	);
+
+	/*****************/
+	/* Function 0xA6 */
+
+	WERROR
+	clusapi_DeleteGroupSet(
+		[ in ] HGROUPSET_RPC GroupSet,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xA7 */
+
+	WERROR
+	clusapi_AddGroupToGroupSet(
+		[ in ] HGROUPSET_RPC GroupSet,
+		[ in ] HGROUP_RPC Group,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xA8 */
+
+	WERROR
+	clusapi_RemoveGroupFromGroupSet(
+		[ in ] HGROUP_RPC Group,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xA9 */
+
+	WERROR
+	clusapi_MoveGroupToGroupSet(
+		[ in ] HGROUPSET_RPC GroupSet,
+		[ in ] HGROUP_RPC Group,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xAA */
+
+	WERROR
+	Opnum170NotUsedOnWire(void);
+
+	/*****************/
+	/* Function 0xAB */
+
+	WERROR
+	clusapi_AddGroupSetDependency(
+		[ in ] HGROUPSET_RPC DependentGroupSet,
+		[ in ] HGROUPSET_RPC ProviderGroupSet,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xAC */
+
+	WERROR
+	clusapi_AddGroupToGroupSetDependency(
+		[ in ] HGROUP_RPC DependentGroup,
+		[ in ] HGROUPSET_RPC ProviderGroupSet,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xAD */
+
+	typedef [v1_enum] enum {
+		CLUSCTL_GROUPSET_GET_ID				= 0x08000039,
+		CLUSCTL_GROUPSET_GET_RO_COMMON_PROPERTIES	= 0x08000055,
+		CLUSCTL_GROUPSET_GET_COMMON_PROPERTIES		= 0x08000059,
+		CLUSCTL_GROUPSET_GET_GROUPS			= 0x08002D71,
+		CLUSCTL_GROUPSET_GET_PROVIDER_GROUPS		= 0x08002D75,
+		CLUSCTL_GROUPSET_GET_PROVIDER_GROUPSETS		= 0x08002D79,
+		CLUSCTL_GROUPSET_SET_COMMON_PROPERTIES		= 0x0840005E
+	} clusapi_GroupSetControlCode;
+
+	WERROR
+	clusapi_NodeGroupSetControl(
+		[ in ] HGROUPSET_RPC hGroupSet,
+		[ in ] HNODE_RPC hNode,
+		[ in ] clusapi_GroupSetControlCode dwControlCode,
+		[ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+		[ in ] uint32 nInBufferSize,
+		[ out, size_is(nOutBufferSize), length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+		[ in, range(0, MAX_CLUSTER_CONTROL_CODE_BUFFER_SIZE)] uint32 nOutBufferSize,
+		[ out ] uint32 *lpBytesReturned,
+		[ out ] uint32 *lpcbRequired,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xAE */
+
+	WERROR
+	clusapi_GroupSetControl(
+		[ in ] HGROUPSET_RPC hGroupSet,
+		[ in ] clusapi_GroupSetControlCode dwControlCode,
+		[ in, unique, size_is(nInBufferSize) ] uint8 *lpInBuffer,
+		[ in ] uint32 nInBufferSize,
+		[ out, size_is(nOutBufferSize), length_is (*lpBytesReturned)] uint8 *lpOutBuffer,
+		[ in, range(0, 0x7FFFFFFF)] uint32 nOutBufferSize,
+		[ out ] uint32 *lpBytesReturned,
+		[ out ] uint32 *lpcbRequired,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xAF */
+
+	WERROR
+	clusapi_SetGroupDependencyExpression(
+		[ in ] HGROUP_RPC hGroup,
+		[ in, string ] [charset(UTF16)] uint16 *lpszDependencyExpression,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xB0 */
+
+	WERROR
+	clusapi_RemoveClusterGroupDependency(
+		[ in ] HGROUP_RPC hGroup,
+		[ in ] HGROUP_RPC hDependsOn,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xB1 */
+
+	WERROR
+	clusapi_SetGroupSetDependencyExpression(
+		[ in ] HGROUPSET_RPC hGroupSet,
+		[ in, string ] [charset(UTF16)] uint16 *lpszDependencyExpression,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xB2 */
+
+	WERROR
+	clusapi_RemoveGroupSetDependency(
+		[ in ] HGROUPSET_RPC hGroupSet,
+		[ in ] HGROUPSET_RPC hDependsOn,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xB3 */
+
+	WERROR
+	clusapi_RemoveClusterGroupToGroupSetDependency(
+		[ in ] HGROUP_RPC hGroup,
+		[ in ] HGROUPSET_RPC hDependsOn,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xB4 */
+
+	WERROR
+	clusapi_CreateGroupSetEnum(
+		[ in ] HCLUSTER_RPC hCluster,
+		[ out ] ENUM_LIST **ReturnEnum,
+		[ out ] WERROR * rpc_status
+	);
+
+	/*****************/
+	/* Function 0xB5 */
+
+	WERROR
+	clusapi_CreateNetInterfaceEnum(
+		[in] HCLUSTER_RPC hCluster,
+		[in, string] [charset(UTF16)] uint16 *lpszNodeName,
+		[in, string] [charset(UTF16)] uint16 *lpszNetworkName,
+		[out] ENUM_LIST **ReturnEnum,
+		[out] WERROR * rpc_status
+	);
+
+	/*****************/
+	/* Function 0xB6 */
+
+	WERROR
+	clusapi_ChangeCsvStateEx(
+		[ in ] HRES_RPC hResource,
+		[ in ] uint32 dwState,
+		[ in, string ] [charset(UTF16)] uint16 *lpszVolumeName,
+		[ out ] WERROR *rpc_status
+	);
+
+	/*****************/
+	/* Function 0xB7 */
+
+	WERROR
+	clusapi_AddGroupToGroupSetEx(
+		[ in ] HGROUPSET_RPC GroupSet,
+		[ in ] HGROUP_RPC Group,
+		[ in ] uint32 FaultDomain,
+		[ in ] uint32 UpdateDomain,
+		[ in ] boolean8 UseDomains,
+		[ in ] uint32 *Reserved,
+		[ out ] WERROR *rpc_status
+	);
 }
diff --git a/python/samba/netcmd/gpo.py b/python/samba/netcmd/gpo.py
index e9878c13570..76ba9fa18a9 100644
--- a/python/samba/netcmd/gpo.py
+++ b/python/samba/netcmd/gpo.py
@@ -235,15 +235,16 @@ def del_gpo_link(samdb, container_dn, gpo):
 
 def parse_unc(unc):
     '''Parse UNC string into a hostname, a service, and a filepath'''
-    if unc.startswith('\\\\') and unc.startswith('//'):
-        raise ValueError("UNC doesn't start with \\\\ or //")
-    tmp = unc[2:].split('/', 2)
-    if len(tmp) == 3:
-        return tmp
-    tmp = unc[2:].split('\\', 2)
-    if len(tmp) == 3:
-        return tmp
-    raise ValueError("Invalid UNC string: %s" % unc)
+    tmp = []
+    if unc.startswith('\\\\'):
+        tmp = unc[2:].split('\\', 2)
+    elif unc.startswith('//'):
+        tmp = unc[2:].split('/', 2)
+
+    if len(tmp) != 3:
+        raise ValueError("Invalid UNC string: %s" % unc)
+
+    return tmp
 
 
 def find_parser(name, flags=re.IGNORECASE):
diff --git a/source4/torture/rpc/clusapi.c b/source4/torture/rpc/clusapi.c
index 6597b441841..99a272daf24 100644
--- a/source4/torture/rpc/clusapi.c
+++ b/source4/torture/rpc/clusapi.c
@@ -28,6 +28,9 @@ struct torture_clusapi_context {
 	struct dcerpc_pipe *p;
 	const char *NodeName;
 	const char *ClusterName;
+	uint16_t lpwMajorVersion;
+	uint16_t lpwMinorVersion;
+	uint16_t lpwBuildNumber;
 };
 
 static bool test_OpenCluster_int(struct torture_context *tctx,
@@ -1209,7 +1212,7 @@ static bool test_ResourceTypeControl_int(struct torture_context *tctx,
 	/* now try what happens when we query with a buffer large enough to hold
 	 * the entire packet */
 
-	r.in.nOutBufferSize = 0x400;
+	r.in.nOutBufferSize = 0x4000;
 	r.out.lpOutBuffer = talloc_zero_array(tctx, uint8_t, r.in.nOutBufferSize);
 
 	torture_assert_ntstatus_ok(tctx,
@@ -1641,7 +1644,7 @@ static bool test_NodeControl_int(struct torture_context *tctx,
 	/* now try what happens when we query with a buffer large enough to hold
 	 * the entire packet */
 
-	r.in.nOutBufferSize = 0x400;
+	r.in.nOutBufferSize = 0x4000;
 	r.out.lpOutBuffer = talloc_zero_array(tctx, uint8_t, r.in.nOutBufferSize);
 
 	torture_assert_ntstatus_ok(tctx,
@@ -1657,8 +1660,8 @@ static bool test_NodeControl_int(struct torture_context *tctx,
 		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, *r.out.lpBytesReturned >= 4, "must be at least 4 bytes long");
+		torture_assert(tctx, (*r.out.lpBytesReturned % 2) == 0, "must be a multiple of 2");
 
 		torture_assert(tctx,
 			pull_reg_sz(tctx, &blob, &str),
@@ -2322,17 +2325,17 @@ static bool test_OfflineGroup(struct torture_context *tctx,
 
 static bool test_one_group(struct torture_context *tctx,
 			   struct dcerpc_pipe *p,
-			   const char *node_name)
+			   const char *group_name)
 {
 	struct policy_handle hGroup;
 
 	torture_assert(tctx,
-		test_OpenGroup_int(tctx, p, node_name, &hGroup),
+		test_OpenGroup_int(tctx, p, group_name, &hGroup),
 		"failed to open group");
 	test_CloseGroup_int(tctx, p, &hGroup);
 
 	torture_assert(tctx,
-		test_OpenGroupEx_int(tctx, p, node_name, &hGroup),
+		test_OpenGroupEx_int(tctx, p, group_name, &hGroup),
 		"failed to openex group");
 
 	torture_assert(tctx,
@@ -3406,7 +3409,7 @@ static bool test_EnumValue_int(struct torture_context *tctx,
 	int i = 0;
 
 	do {
-		uint32_t lpcbData = 1024;
+		uint32_t lpcbData = 2048;
 
 		r.in.hKey = *hKey;
 		r.in.dwIndex = i++;
@@ -3696,6 +3699,150 @@ static bool test_all_keys(struct torture_context *tctx,
 	return true;
 }
 
+static bool test_OpenGroupSet_int(struct torture_context *tctx,
+				  struct dcerpc_pipe *p,
+				  const char *lpszGroupSetName,
+				  struct policy_handle *hGroupSet)
+{
+	struct dcerpc_binding_handle *b = p->binding_handle;
+	struct clusapi_OpenGroupSet r;
+	WERROR Status;
+	WERROR rpc_status;
+
+	r.in.lpszGroupSetName = lpszGroupSetName;
+	r.out.rpc_status = &rpc_status;
+	r.out.Status = &Status;
+	r.out.hGroupSet = hGroupSet;
+
+	torture_assert_ntstatus_ok(tctx,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list