s4:torture Cut the RPC-SAMR-LARGE-DC test down to size
authorAndrew Bartlett <abartlet@samba.org>
Thu, 4 Jun 2009 08:12:59 +0000 (18:12 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 4 Jun 2009 08:12:59 +0000 (18:12 +1000)
This removes the validation of the estimated number of accounts,
because MS-SAMR 3.1.5.5.1.1 makes clear the number returned cannot be
relied apon.

I've also converted a bit more of the test to use torture_assert(),
and where that is impractical, to print error messages when things
fail.

Andrew Bartlett

source4/torture/rpc/samr.c

index 94c646a91c11c4711ca04cea463f946c3e58c48d..2e78c657846666c4abda95b99f769a279841eec0 100644 (file)
@@ -6060,7 +6060,7 @@ static bool test_EnumDomainUsers(struct dcerpc_pipe *p,
        struct samr_SamArray *sam;
 
        r.in.domain_handle = domain_handle;
-       r.in.acct_flags = ACB_NORMAL;
+       r.in.acct_flags = 0;
        r.in.max_size = (uint32_t)-1;
        r.in.resume_handle = &resume_handle;
 
@@ -6296,8 +6296,11 @@ static bool test_ManyObjects(struct dcerpc_pipe *p,
        torture_assert_int_equal(tctx, num_disp, num_anounced + num_created,
                "unexpected number of results returned in dispinfo call");
 #endif
-       torture_assert_int_equal(tctx, num_enum, num_anounced + num_created,
-               "unexpected number of results returned in enum call");
+       if (which_ops == TORTURE_SAMR_MANY_ACCOUNTS && num_enum != num_anounced + num_created) {
+               torture_comment(tctx, 
+                               "unexpected number of results (%u) returned in enum call, expected %u", 
+                               num_enum != num_anounced + num_created);
+       }
        return ret;
 }
 
@@ -6334,7 +6337,7 @@ static bool test_OpenDomain(struct dcerpc_pipe *p, struct torture_context *tctx,
 
        /* run the domain tests with the main handle closed - this tests
           the servers reference counting */
-       ret &= test_samr_handle_Close(p, tctx, handle);
+       torture_assert(tctx, test_samr_handle_Close(p, tctx, handle), "Failed to close SAMR handle");
 
        switch (which_ops) {
        case TORTURE_SAMR_PASSWORDS:
@@ -6343,6 +6346,9 @@ static bool test_OpenDomain(struct dcerpc_pipe *p, struct torture_context *tctx,
                        ret &= test_CreateUser2(p, tctx, &domain_handle, sid, which_ops, NULL);
                }
                ret &= test_CreateUser(p, tctx, &domain_handle, TEST_ACCOUNT_NAME, &user_handle, sid, which_ops, NULL, true);
+               if (!ret) {
+                       printf("Testing PASSWORDS or PRIVILAGES on domain %s failed!\n", dom_sid_string(tctx, sid));
+               }
                break;
        case TORTURE_SAMR_USER_ATTRIBUTES:
                if (!torture_setting_bool(tctx, "samba3", false)) {
@@ -6352,7 +6358,7 @@ static bool test_OpenDomain(struct dcerpc_pipe *p, struct torture_context *tctx,
                /* This test needs 'complex' users to validate */
                ret &= test_QueryDisplayInfo(p, tctx, &domain_handle);
                if (!ret) {
-                       printf("Testing PASSWORDS or ATTRIBUTES on domain %s failed!\n", dom_sid_string(tctx, sid));
+                       printf("Testing ATTRIBUTES on domain %s failed!\n", dom_sid_string(tctx, sid));
                }
                break;
        case TORTURE_SAMR_PASSWORDS_PWDLASTSET:
@@ -6368,6 +6374,9 @@ static bool test_OpenDomain(struct dcerpc_pipe *p, struct torture_context *tctx,
        case TORTURE_SAMR_MANY_GROUPS:
        case TORTURE_SAMR_MANY_ALIASES:
                ret &= test_ManyObjects(p, tctx, &domain_handle, sid, which_ops);
+               if (!ret) {
+                       printf("Testing MANY-{ACCOUNTS,GROUPS,ALIASES} on domain %s failed!\n", dom_sid_string(tctx, sid));
+               }
                break;
        case TORTURE_SAMR_OTHER:
                ret &= test_CreateUser(p, tctx, &domain_handle, TEST_ACCOUNT_NAME, &user_handle, sid, which_ops, NULL, true);
@@ -6421,10 +6430,10 @@ static bool test_OpenDomain(struct dcerpc_pipe *p, struct torture_context *tctx,
                ret = false;
        }
 
-       ret &= test_samr_handle_Close(p, tctx, &domain_handle);
+       torture_assert(tctx, test_samr_handle_Close(p, tctx, &domain_handle), "Failed to close SAMR domain handle");
 
+       torture_assert(tctx, test_Connect(p, tctx, handle), "Faile to re-connect SAMR handle");
        /* reconnect the main handle */
-       ret &= test_Connect(p, tctx, handle);
 
        if (!ret) {
                printf("Testing domain %s failed!\n", dom_sid_string(tctx, sid));