summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-05-30 09:54:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:53:06 -0500
commit4d1a21f24d9d2f4326e380cadb24c842c2dfb688 (patch)
tree20e5881c53b37515862256e48ee6ce7af3972feb /source4
parentdd64de3d5beeeca870a94f4fb8bbc4d094bbe989 (diff)
downloadsamba-4d1a21f24d9d2f4326e380cadb24c842c2dfb688.tar.gz
samba-4d1a21f24d9d2f4326e380cadb24c842c2dfb688.tar.xz
samba-4d1a21f24d9d2f4326e380cadb24c842c2dfb688.zip
r23239: Fill in drsuapi_QuerySitesByCost.
Guenther (This used to be commit cf953d04813d193da5e9714ceebb7826dc7e4d0b)
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/idl/drsuapi.idl34
-rw-r--r--source4/rpc_server/drsuapi/dcesrv_drsuapi.c6
-rw-r--r--source4/torture/rpc/drsuapi.c59
3 files changed, 94 insertions, 5 deletions
diff --git a/source4/librpc/idl/drsuapi.idl b/source4/librpc/idl/drsuapi.idl
index f23914f8de..e8fbc85f29 100644
--- a/source4/librpc/idl/drsuapi.idl
+++ b/source4/librpc/idl/drsuapi.idl
@@ -1457,5 +1457,37 @@ interface drsuapi
/*****************/
/* Function 0x18 */
- WERROR DRSUAPI_QUERY_SITES_BY_COST();
+ typedef struct {
+ WERROR error_code;
+ uint32 site_cost;
+ } drsuapi_DsSiteCostInfo;
+
+ typedef struct {
+ [range(0,10000)] uint32 num_info;
+ [size_is(num_info)] drsuapi_DsSiteCostInfo *info;
+ uint32 unknown;
+ } drsuapi_QuerySitesByCostCtr1;
+
+ typedef [switch_type(int32)] union {
+ [case(1)] drsuapi_QuerySitesByCostCtr1 ctr1;
+ } drsuapi_QuerySitesByCostCtr;
+
+ typedef struct {
+ [charset(UTF16),string] uint16 *site_from;
+ [range(1,10000)] uint32 num_req;
+ [size_is(num_req)] [charset(UTF16),string] uint16 **site_to;
+ uint32 flags;
+ } drsuapi_QuerySitesByCostRequest1;
+
+ typedef [switch_type(int32)] union {
+ [case(1)] drsuapi_QuerySitesByCostRequest1 req1;
+ } drsuapi_QuerySitesByCostRequest;
+
+ WERROR drsuapi_QuerySitesByCost(
+ [in] policy_handle *bind_handle,
+ [in] int32 level,
+ [in] [switch_is(level)] drsuapi_QuerySitesByCostRequest req,
+ [out] int32 level_out,
+ [out] [switch_is(level_out)] drsuapi_QuerySitesByCostCtr ctr
+ );
}
diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
index f1f0b4a54e..9bb35c06c9 100644
--- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
+++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c
@@ -798,10 +798,10 @@ static WERROR dcesrv_DRSUAPI_GET_OBJECT_EXISTENCE(struct dcesrv_call_state *dce_
/*
- DRSUAPI_QUERY_SITES_BY_COST
+ drsuapi_QuerySitesByCost
*/
-static WERROR dcesrv_DRSUAPI_QUERY_SITES_BY_COST(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct DRSUAPI_QUERY_SITES_BY_COST *r)
+static WERROR dcesrv_drsuapi_QuerySitesByCost(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct drsuapi_QuerySitesByCost *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index 338d2ad759..37c566020b 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -646,6 +646,61 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
+BOOL test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct DsPrivate *priv)
+{
+ NTSTATUS status;
+ struct drsuapi_QuerySitesByCost r;
+ BOOL ret = True;
+
+ const char *my_site = "Default-First-Site-Name";
+ const char *remote_site1 = "smbtorture-nonexisting-site1";
+ const char *remote_site2 = "smbtorture-nonexisting-site2";
+
+ r.in.bind_handle = &priv->bind_handle;
+ r.in.level = 1;
+ r.in.req.req1.site_from = talloc_strdup(mem_ctx, my_site);
+ r.in.req.req1.num_req = 2;
+ r.in.req.req1.site_to = talloc_zero_array(mem_ctx, const char *, r.in.req.req1.num_req);
+ r.in.req.req1.site_to[0] = talloc_strdup(mem_ctx, remote_site1);
+ r.in.req.req1.site_to[1] = talloc_strdup(mem_ctx, remote_site2);
+ r.in.req.req1.flags = 0;
+
+ status = dcerpc_drsuapi_QuerySitesByCost(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ const char *errstr = nt_errstr(status);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
+ errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
+ }
+ printf("drsuapi_QuerySitesByCost - %s\n", errstr);
+ ret = False;
+ } else if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("QuerySitesByCost failed - %s\n", win_errstr(r.out.result));
+ ret = False;
+ }
+
+ if (W_ERROR_IS_OK(r.out.result)) {
+
+ if (!W_ERROR_EQUAL(r.out.ctr.ctr1.info[0].error_code, WERR_DS_OBJ_NOT_FOUND) ||
+ !W_ERROR_EQUAL(r.out.ctr.ctr1.info[1].error_code, WERR_DS_OBJ_NOT_FOUND)) {
+ printf("expected error_code WERR_DS_OBJ_NOT_FOUND, got %s\n",
+ win_errstr(r.out.ctr.ctr1.info[0].error_code));
+ ret = False;
+ }
+
+ if ((r.out.ctr.ctr1.info[0].site_cost != (uint32_t) -1) ||
+ (r.out.ctr.ctr1.info[1].site_cost != (uint32_t) -1)) {
+ printf("expected site_cost %d, got %d\n",
+ (uint32_t) -1, r.out.ctr.ctr1.info[0].site_cost);
+ ret = False;
+ }
+ }
+
+ return ret;
+
+
+}
+
BOOL test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct DsPrivate *priv)
{
@@ -705,7 +760,9 @@ BOOL torture_rpc_drsuapi(struct torture_context *torture)
}
ret &= test_DsBind(p, mem_ctx, &priv);
-
+#if 0
+ ret &= test_QuerySitesByCost(p, mem_ctx, &priv);
+#endif
ret &= test_DsGetDomainControllerInfo(p, mem_ctx, &priv);
ret &= test_DsCrackNames(p, mem_ctx, &priv);