s4:torture/rpc/samr.c - fix up the "test_GroupList" suite regarding QueryDisplayInfo
[ira/wip.git] / source4 / torture / rpc / samr.c
index c3e3905f94bb371c8d3f31c3e7e1fea283917231..0e1500e029b192db278e4ceffbddcd3c3329316c 100644 (file)
@@ -6800,6 +6800,7 @@ static bool test_QueryDomainInfo2(struct dcerpc_binding_handle *b,
    set of group names. */
 static bool test_GroupList(struct dcerpc_binding_handle *b,
                           struct torture_context *tctx,
+                          struct dom_sid *domain_sid,
                           struct policy_handle *handle)
 {
        struct samr_EnumDomainGroups q1;
@@ -6817,6 +6818,9 @@ static bool test_GroupList(struct dcerpc_binding_handle *b,
        int num_names = 0;
        const char **names = NULL;
 
+       bool builtin_domain = dom_sid_compare(domain_sid,
+                                             &global_sid_Builtin) == 0;
+
        torture_comment(tctx, "Testing coherency of querydispinfo vs enumdomgroups\n");
 
        q1.in.domain_handle = handle;
@@ -6847,6 +6851,11 @@ static bool test_GroupList(struct dcerpc_binding_handle *b,
 
        torture_assert(tctx, sam, "EnumDomainGroups failed to return sam");
 
+       if (builtin_domain) {
+               torture_assert(tctx, num_names == 0,
+                              "EnumDomainGroups shouldn't return any group in the builtin domain!");
+       }
+
        q2.in.domain_handle = handle;
        q2.in.level = 5;
        q2.in.start_idx = 0;
@@ -6879,7 +6888,7 @@ static bool test_GroupList(struct dcerpc_binding_handle *b,
                                }
                        }
 
-                       if (!found) {
+                       if ((!found) && (!builtin_domain)) {
                                torture_warning(tctx, "QueryDisplayInfo gave name [%s] that EnumDomainGroups did not\n",
                                       name);
                                ret = false;
@@ -6894,6 +6903,11 @@ static bool test_GroupList(struct dcerpc_binding_handle *b,
                ret = false;
        }
 
+       if (builtin_domain) {
+               torture_assert(tctx, q2.in.start_idx != 0,
+                              "QueryDisplayInfo should return all domain groups also on the builtin domain handle!");
+       }
+
        for (i=0; i<num_names; i++) {
                if (names[i] != NULL) {
                        torture_warning(tctx, "EnumDomainGroups gave name [%s] that QueryDisplayInfo did not\n",
@@ -7646,7 +7660,7 @@ static bool test_OpenDomain(struct dcerpc_pipe *p, struct torture_context *tctx,
                        ret &= test_GetDisplayEnumerationIndex(b, tctx, &domain_handle);
                        ret &= test_GetDisplayEnumerationIndex2(b, tctx, &domain_handle);
                }
-               ret &= test_GroupList(b, tctx, &domain_handle);
+               ret &= test_GroupList(b, tctx, sid, &domain_handle);
                ret &= test_TestPrivateFunctionsDomain(b, tctx, &domain_handle);
                ret &= test_RidToSid(b, tctx, sid, &domain_handle);
                ret &= test_GetBootKeyInformation(b, tctx, &domain_handle);