s3 selftest: Fix LOOKUP_SID test.
authorKai Blin <kai@samba.org>
Wed, 13 Jan 2010 15:46:17 +0000 (16:46 +0100)
committerKai Blin <kai@samba.org>
Thu, 14 Jan 2010 14:18:35 +0000 (15:18 +0100)
WINBINDD_LIST_USERS does not give a domain name if we're a DC and the user is
from our domain.

source4/torture/winbind/struct_based.c

index d15bd6b8070be38c7db8f2bd7adb6e16a3963dca..2f8242883956c788be655f5d9c7d50d4b2f34278 100644 (file)
@@ -914,6 +914,9 @@ static bool lookup_name_sid_list(struct torture_context *torture, char **list)
                struct winbindd_response rep;
                char *sid;
                char *name;
+               const char *domain_name = torture_setting_string(torture,
+                                               "winbindd netbios domain",
+                                               lp_workgroup(torture->lp_ctx));
 
                ZERO_STRUCT(req);
                ZERO_STRUCT(rep);
@@ -932,10 +935,15 @@ static bool lookup_name_sid_list(struct torture_context *torture, char **list)
 
                DO_STRUCT_REQ_REP(WINBINDD_LOOKUPSID, &req, &rep);
 
-               name = talloc_asprintf(torture, "%s%c%s",
-                                      rep.data.name.dom_name,
-                                      winbind_separator(torture),
-                                      rep.data.name.name);
+               if (strequal(rep.data.name.dom_name, domain_name)) {
+                       name = talloc_asprintf(torture, "%s",
+                                              rep.data.name.name);
+               } else {
+                       name = talloc_asprintf(torture, "%s%c%s",
+                                              rep.data.name.dom_name,
+                                              winbind_separator(torture),
+                                              rep.data.name.name);
+               }
 
                torture_assert_casestr_equal(torture, list[count], name,
                                         "LOOKUP_SID after LOOKUP_NAME != id");