From ca1f7c9b7332be2f7136094953eef43c65ee1462 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Matthias=20Dieter=20Walln=C3=B6fer?= Date: Thu, 22 Apr 2010 10:37:45 +0200 Subject: [PATCH] s4:torture - DsRGetDcSiteCoverageW - adapt test to check for the sitename Signed-off-by: Andrew Tridgell --- source4/torture/rpc/netlogon.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index 567dec6b39ed..9b8f9b7800d3 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -2309,11 +2309,27 @@ static bool test_netr_DsRGetDCNameEx2(struct torture_context *tctx, static bool test_netr_DsrGetDcSiteCoverageW(struct torture_context *tctx, struct dcerpc_pipe *p) { + char *url; + struct ldb_context *sam_ctx = NULL; NTSTATUS status; struct netr_DsrGetDcSiteCoverageW r; struct DcSitesCtr *ctr = NULL; struct dcerpc_binding_handle *b = p->binding_handle; + torture_comment(tctx, "This does only pass with the default site\n"); + + /* We won't double-check this when we are over 'local' transports */ + if (dcerpc_server_name(p)) { + /* Set up connection to SAMDB on DC */ + url = talloc_asprintf(tctx, "ldap://%s", dcerpc_server_name(p)); + sam_ctx = ldb_wrap_connect(tctx, tctx->ev, tctx->lp_ctx, url, + NULL, + cmdline_credentials, + 0); + + torture_assert(tctx, sam_ctx, "Connection to the SAMDB on DC failed!"); + } + r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); r.out.ctr = &ctr; @@ -2321,6 +2337,14 @@ static bool test_netr_DsrGetDcSiteCoverageW(struct torture_context *tctx, torture_assert_ntstatus_ok(tctx, status, "failed"); torture_assert_werr_ok(tctx, r.out.result, "failed"); + torture_assert(tctx, ctr->num_sites == 1, + "we should per default only get the default site"); + if (sam_ctx != NULL) { + torture_assert_casestr_equal(tctx, ctr->sites[0].string, + samdb_server_site_name(sam_ctx, tctx), + "didn't return default site"); + } + return true; } -- 2.34.1