From 2780a18a9fc3aac355c141fe0393e1f8008e242f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Dieter=20Walln=C3=B6fer?= Date: Tue, 20 Apr 2010 16:59:48 +0200 Subject: [PATCH] s4:torture - GetAnyDCName - adaptions - Check for the various domainname set modes (on NULL and "" the domain should be the default domain on the server) - support return value "WERR_NO_SUCH_DOMAIN" (the server is the PDC of the domain) Signed-off-by: Andrew Tridgell --- source4/torture/rpc/netlogon.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index a5388656c9e..4b05c8ca797 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -1787,18 +1787,39 @@ static bool test_GetAnyDCName(struct torture_context *tctx, const char *dcname = NULL; struct dcerpc_binding_handle *b = p->binding_handle; - r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); r.in.domainname = lp_workgroup(tctx->lp_ctx); + r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); r.out.dcname = &dcname; status = dcerpc_netr_GetAnyDCName_r(b, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "GetAnyDCName"); - torture_assert_werr_ok(tctx, r.out.result, "GetAnyDCName"); + if ((!W_ERROR_IS_OK(r.out.result)) && + (!W_ERROR_EQUAL(r.out.result, WERR_NO_SUCH_DOMAIN))) { + return false; + } if (dcname) { torture_comment(tctx, "\tDC is at '%s'\n", dcname); } + r.in.domainname = NULL; + + status = dcerpc_netr_GetAnyDCName_r(b, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "GetAnyDCName"); + if ((!W_ERROR_IS_OK(r.out.result)) && + (!W_ERROR_EQUAL(r.out.result, WERR_NO_SUCH_DOMAIN))) { + return false; + } + + r.in.domainname = ""; + + status = dcerpc_netr_GetAnyDCName_r(b, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "GetAnyDCName"); + if ((!W_ERROR_IS_OK(r.out.result)) && + (!W_ERROR_EQUAL(r.out.result, WERR_NO_SUCH_DOMAIN))) { + return false; + } + return true; }