s4:torture - GetAnyDCName - adaptions
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Tue, 20 Apr 2010 14:59:48 +0000 (16:59 +0200)
committerAndrew Tridgell <tridge@samba.org>
Tue, 27 Apr 2010 05:24:41 +0000 (15:24 +1000)
- 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 <tridge@samba.org>
source4/torture/rpc/netlogon.c

index a5388656c9e8f5830026a47f7e03dbd8166a796b..4b05c8ca797ab4b9d7064726f709ec45b7aa8cdc 100644 (file)
@@ -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;
 }