]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4-smbtorture: fix WINBIND-STRUCT assumptions about getpwent() for s3.
authorGünther Deschner <gd@samba.org>
Tue, 2 Mar 2010 17:35:01 +0000 (18:35 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 2 Mar 2010 18:03:17 +0000 (19:03 +0100)
In samba3 it is not an error when no users are returned in getpwent() calls
(e.g. on a DC w/o interdomain trusts).

Kai, please check.

Guenther

source4/torture/winbind/struct_based.c

index 872e17bb0d16569f915db52c799dd82d118e0efc..5a621bc77243aa7b0e53775a2fc4285d4cebfabd 100644 (file)
@@ -849,12 +849,23 @@ static bool torture_winbind_struct_getpwent(struct torture_context *torture)
        ZERO_STRUCT(req);
        ZERO_STRUCT(rep);
        req.data.num_entries = 1;
-       DO_STRUCT_REQ_REP(WINBINDD_GETPWENT, &req, &rep);
+       if (torture_setting_bool(torture, "samba3", false)) {
+               bool __noop = false;
+               DO_STRUCT_REQ_REP_EXT(WINBINDD_GETPWENT, &req, &rep,
+                                     NSS_STATUS_SUCCESS, false, __noop=true,
+                                     NULL);
+       } else {
+               DO_STRUCT_REQ_REP(WINBINDD_GETPWENT, &req, &rep);
+       }
        pwent = (struct winbindd_pw *)rep.extra_data.data;
-       torture_assert(torture, (pwent != NULL), "NULL pwent");
-       torture_comment(torture, "name: %s, uid: %d, gid: %d, shell: %s\n",
-                       pwent->pw_name, pwent->pw_uid, pwent->pw_gid,
-                       pwent->pw_shell);
+       if (!torture_setting_bool(torture, "samba3", false)) {
+               torture_assert(torture, (pwent != NULL), "NULL pwent");
+       }
+       if (pwent) {
+               torture_comment(torture, "name: %s, uid: %d, gid: %d, shell: %s\n",
+                               pwent->pw_name, pwent->pw_uid, pwent->pw_gid,
+                               pwent->pw_shell);
+       }
 
        return true;
 }