r22116: Only query by SID if we have a SID
authorAndrew Bartlett <abartlet@samba.org>
Sat, 7 Apr 2007 00:57:26 +0000 (00:57 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:49:52 +0000 (14:49 -0500)
Andrew Bartlett

source/torture/rpc/lsa.c

index 36080a25e15bb17455db6740b3445f034b161c0b..1c2a9fd41d161f87b686c75abd493a3cc584ae12 100644 (file)
@@ -1521,6 +1521,29 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p,
                                return False;
                        }
 
+                       for (j=0; j < ARRAY_SIZE(levels); j++) {
+                               struct lsa_QueryTrustedDomainInfoBySid q;
+                               union lsa_TrustedDomainInfo info;
+                               
+                               if (!domains->domains[i].sid) {
+                                       continue;
+                               }
+                               
+                               q.in.handle  = handle;
+                               q.in.dom_sid = domains->domains[i].sid;
+                               q.in.level   = levels[j];
+                               q.out.info   = &info;
+                               status = dcerpc_lsa_QueryTrustedDomainInfoBySid(p, mem_ctx, &q);
+                               if (!NT_STATUS_IS_OK(status) && ok[j]) {
+                                       printf("QueryTrustedDomainInfoBySid level %d failed - %s\n", 
+                                              levels[j], nt_errstr(status));
+                                       ret = False;
+                               } else if (NT_STATUS_IS_OK(status) && !ok[j]) {
+                                       printf("QueryTrustedDomainInfoBySid level %d unexpectedly succeeded - %s\n", 
+                                              levels[j], nt_errstr(status));
+                                       ret = False;
+                               }
+                       }
                }
 
                trust_by_name.in.handle = handle;
@@ -1562,30 +1585,6 @@ static BOOL test_query_each_TrustDom(struct dcerpc_pipe *p,
                        return False;
                }
 
-               for (j=0; j < ARRAY_SIZE(levels); j++) {
-                       struct lsa_QueryTrustedDomainInfoBySid q;
-                       union lsa_TrustedDomainInfo info;
-
-                       if (!domains->domains[i].sid) {
-                               continue;
-                       }
-
-                       q.in.handle  = handle;
-                       q.in.dom_sid = domains->domains[i].sid;
-                       q.in.level   = levels[j];
-                       q.out.info   = &info;
-                       status = dcerpc_lsa_QueryTrustedDomainInfoBySid(p, mem_ctx, &q);
-                       if (!NT_STATUS_IS_OK(status) && ok[j]) {
-                               printf("QueryTrustedDomainInfoBySid level %d failed - %s\n", 
-                                      levels[j], nt_errstr(status));
-                               ret = False;
-                       } else if (NT_STATUS_IS_OK(status) && !ok[j]) {
-                               printf("QueryTrustedDomainInfoBySid level %d unexpectedly succeeded - %s\n", 
-                                      levels[j], nt_errstr(status));
-                               ret = False;
-                       }
-               }
-               
                for (j=0; j < ARRAY_SIZE(levels); j++) {
                        struct lsa_QueryTrustedDomainInfoByName q;
                        union lsa_TrustedDomainInfo info;