s3: Fix initgroups return check
authorPeter Watkins <treestem@gmail.com>
Sun, 14 Feb 2010 11:43:13 +0000 (12:43 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 14 Feb 2010 11:45:04 +0000 (12:45 +0100)
A return code of 1 from initgroups() is OK since apparently it means
the gid has already been set. The man page doesn't mention this.

source3/lib/system_smbd.c

index b22d15fb8a9e5441858ccab7d82e45bda29e6023..b4447c5f9cd179ee86fea87edfc0a761f0f79584 100644 (file)
@@ -68,7 +68,7 @@ static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups,
                return -1;
        }
 
-       if (initgroups(user, gid) != 0) {
+       if (initgroups(user, gid) == -1) {
                DEBUG(0, ("getgrouplist_internals: initgroups() failed!\n"));
                SAFE_FREE(gids_saved);
                return -1;