r457: added some more samr tests to help me work out the right error codes
authorAndrew Tridgell <tridge@samba.org>
Mon, 3 May 2004 14:54:47 +0000 (14:54 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:51:43 +0000 (12:51 -0500)
in our new samr server
(This used to be commit 0f2503111498e809237e0155962db55dfde8cbfb)

source4/torture/rpc/samr.c

index a0b6a61c48739ad17bc2f200fd617315f0289ed5..c7d55ad828f81f2f638e5a1dfce5a358604199df 100644 (file)
@@ -2696,17 +2696,37 @@ static BOOL test_LookupDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 {
        NTSTATUS status;
        struct samr_LookupDomain r;
+       struct samr_Name n2;
        BOOL ret = True;
 
        printf("Testing LookupDomain(%s)\n", domain->name);
 
+       /* check for correct error codes */
+       r.in.handle = handle;
+       r.in.domain = &n2;
+       n2.name = NULL;
+
+       status = dcerpc_samr_LookupDomain(p, mem_ctx, &r);
+       if (!NT_STATUS_EQUAL(NT_STATUS_INVALID_PARAMETER, status)) {
+               printf("failed: LookupDomain expected NT_STATUS_INVALID_PARAMETER - %s\n", nt_errstr(status));
+               ret = False;
+       }
+
+       n2.name = "xxNODOMAINxx";
+
+       status = dcerpc_samr_LookupDomain(p, mem_ctx, &r);
+       if (!NT_STATUS_EQUAL(NT_STATUS_NO_SUCH_DOMAIN, status)) {
+               printf("failed: LookupDomain expected NT_STATUS_NO_SUCH_DOMAIN - %s\n", nt_errstr(status));
+               ret = False;
+       }
+
        r.in.handle = handle;
        r.in.domain = domain;
 
        status = dcerpc_samr_LookupDomain(p, mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                printf("LookupDomain failed - %s\n", nt_errstr(status));
-               return False;
+               ret = False;
        }
 
        if (!test_GetDomPwInfo(p, mem_ctx, domain)) {
@@ -2752,6 +2772,12 @@ static BOOL test_EnumDomains(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                }
        }
 
+       status = dcerpc_samr_EnumDomains(p, mem_ctx, &r);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("EnumDomains failed - %s\n", nt_errstr(status));
+               return False;
+       }
+
        return ret;
 }