From 5da21cd19b0e5ec86a47b70d32eb1c189ae082c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Tue, 16 Oct 2007 14:33:34 +0200 Subject: [PATCH] r25670: Add torture test for frsapi_IsPathReplicated(). Guenther (This used to be commit e7fc3c1da9764a2e7c103e05f3d774b540334f75) --- source4/librpc/idl/frsapi.idl | 10 ++++- source4/torture/rpc/frsapi.c | 80 +++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/source4/librpc/idl/frsapi.idl b/source4/librpc/idl/frsapi.idl index d75be0ec042..df12f44892f 100644 --- a/source4/librpc/idl/frsapi.idl +++ b/source4/librpc/idl/frsapi.idl @@ -71,13 +71,19 @@ interface frsapi /****************/ /* 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 ); /****************/ diff --git a/source4/torture/rpc/frsapi.c b/source4/torture/rpc/frsapi.c index d65d5515548..a382b1e4152 100644 --- a/source4/torture/rpc/frsapi.c +++ b/source4/torture/rpc/frsapi.c @@ -105,6 +105,83 @@ static bool test_DsPollingIntervalW(struct torture_context *tctx, 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