s3:smbd: Fix incorrect use of sys_getgroups()
authorJeremy Allison <jra@samba.org>
Mon, 17 Apr 2017 21:30:54 +0000 (14:30 -0700)
committerKarolin Seeger <kseeger@samba.org>
Thu, 20 Apr 2017 14:36:14 +0000 (16:36 +0200)
Second arg must be NULL when first arg is 0 (it is in all other places).

Bug report and patch from Hanno Böck <hanno@hboeck.de>

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12747

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Apr 18 15:43:02 CEST 2017 on sn-devel-144

(cherry picked from commit 76b351e907f67cc7d4af4e7d800c7a3aa1269ee8)

Autobuild-User(v4-5-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-5-test): Thu Apr 20 16:36:14 CEST 2017 on sn-devel-144

source3/smbd/sec_ctx.c

index 33d987fbe703f31f0db1becebc799e36097a0a22..5e0710e0ecbd39dfbf3847d96e3ee8f3f734c52d 100644 (file)
@@ -139,7 +139,6 @@ static void gain_root(void)
 static int get_current_groups(gid_t gid, uint32_t *p_ngroups, gid_t **p_groups)
 {
        int i;
-       gid_t grp;
        int ngroups;
        gid_t *groups = NULL;
 
@@ -153,7 +152,7 @@ static int get_current_groups(gid_t gid, uint32_t *p_ngroups, gid_t **p_groups)
        set_effective_gid(gid);
        samba_setgid(gid);
 
-       ngroups = sys_getgroups(0,&grp);
+       ngroups = sys_getgroups(0, NULL);
        if (ngroups <= 0) {
                goto fail;
        }