svn commit: samba r25670 - in branches/SAMBA_4_0/source: librpc/idl torture/rpc

gd at samba.org gd at samba.org
Tue Oct 16 14:33:34 GMT 2007


Author: gd
Date: 2007-10-16 14:33:34 +0000 (Tue, 16 Oct 2007)
New Revision: 25670

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=25670

Log:
Add torture test for frsapi_IsPathReplicated().

Guenther

Modified:
   branches/SAMBA_4_0/source/librpc/idl/frsapi.idl
   branches/SAMBA_4_0/source/torture/rpc/frsapi.c


Changeset:
Modified: branches/SAMBA_4_0/source/librpc/idl/frsapi.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/frsapi.idl	2007-10-16 14:09:49 UTC (rev 25669)
+++ branches/SAMBA_4_0/source/librpc/idl/frsapi.idl	2007-10-16 14:33:34 UTC (rev 25670)
@@ -71,13 +71,19 @@
 
 	/****************/
 	/* Function 0x08 */
+	typedef [v1_enum] enum {
+		FRSAPI_REPLICA_SET_TYPE_0	= 0x00000000,
+		FRSAPI_REPLICA_SET_TYPE_DOMAIN	= 0x00000002,
+		FRSAPI_REPLICA_SET_TYPE_DFS	= 0x00000003
+	} frsapi_ReplicaSetType;
+
 	WERROR frsapi_IsPathReplicated(
 		[in,unique] [string,charset(UTF16)] uint16 *path,
-		[in] uint32 unknown,
+		[in] frsapi_ReplicaSetType replica_set_type,
 		[out] uint32 *unknown1,
 		[out] uint32 *unknown2,
 		[out] uint32 *unknown3,
-		[out] GUID *guid
+		[out] GUID *replica_set_guid
 	);
 
 	/****************/

Modified: branches/SAMBA_4_0/source/torture/rpc/frsapi.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/frsapi.c	2007-10-16 14:09:49 UTC (rev 25669)
+++ branches/SAMBA_4_0/source/torture/rpc/frsapi.c	2007-10-16 14:33:34 UTC (rev 25670)
@@ -105,6 +105,83 @@
 	return true;
 }
 
+static bool test_IsPathReplicated_err(struct torture_context *tctx,
+				      struct dcerpc_pipe *p,
+				      const char *path,
+				      uint32_t type,
+				      WERROR werr)
+{
+	struct frsapi_IsPathReplicated r;
+	struct GUID guid;
+	uint32_t unknown1, unknown2, unknown3 = 0;
+
+	ZERO_STRUCT(r);
+
+	r.in.path = path;
+	r.in.replica_set_type = type;
+	r.out.unknown1 = &unknown1;
+	r.out.unknown2 = &unknown2;
+	r.out.unknown3 = &unknown3;
+	r.out.replica_set_guid = &guid;
+
+	torture_assert_ntstatus_ok(tctx,
+		dcerpc_frsapi_IsPathReplicated(p, tctx, &r),
+		"IsPathReplicated failed");
+
+	torture_assert_werr_equal(tctx, r.out.result, werr,
+			          "GetDsPollingIntervalW failed");
+
+	return true;
+}
+
+static bool _test_IsPathReplicated(struct torture_context *tctx,
+				  struct dcerpc_pipe *p,
+				  const char *path,
+				  uint32_t type)
+{
+	return test_IsPathReplicated_err(tctx, p, path, type, WERR_OK);
+}
+
+static bool test_IsPathReplicated(struct torture_context *tctx,
+				  struct dcerpc_pipe *p)
+{
+	const uint32_t lvls[] = {
+		FRSAPI_REPLICA_SET_TYPE_0,
+		FRSAPI_REPLICA_SET_TYPE_DOMAIN,
+		FRSAPI_REPLICA_SET_TYPE_DFS };
+	int i;
+
+	if (!test_IsPathReplicated_err(tctx, p, NULL, 0,
+				       WERR_FRS_INVALID_SERVICE_PARAMETER)) {
+		return false;
+	}
+
+	for (i=0; i<ARRAY_SIZE(lvls); i++) {
+		if (!_test_IsPathReplicated(tctx, p, dcerpc_server_name(p),
+					    lvls[i])) {
+			return false;
+		}
+	}
+
+	for (i=0; i<ARRAY_SIZE(lvls); i++) {
+		const char *path = talloc_asprintf(tctx, "\\\\%s\\SYSVOL",
+						   dcerpc_server_name(p));
+		if (!_test_IsPathReplicated(tctx, p, path, lvls[i])) {
+			return false;
+		}
+	}
+
+	for (i=0; i<ARRAY_SIZE(lvls); i++) {
+		if (!_test_IsPathReplicated(tctx, p,
+					    "C:\\windows\\sysvol\\domain",
+					    lvls[i])) {
+			return false;
+		}
+	}
+
+	return true;
+}
+
 struct torture_suite *torture_rpc_frsapi(TALLOC_CTX *mem_ctx)
 {
 	struct torture_rpc_tcase *tcase;
@@ -117,5 +194,8 @@
 	test = torture_rpc_tcase_add_test(tcase, "DsPollingIntervalW",
 					  test_DsPollingIntervalW);
 
+	test = torture_rpc_tcase_add_test(tcase, "IsPathReplicated",
+					  test_IsPathReplicated);
+
 	return suite;
 }



More information about the samba-cvs mailing list