Date: Tue, 9 Sep 2003 19:54:56 +0200 (CEST) From: Stefan Farfeleder <stefan@fafoe.narf.at> To: FreeBSD-gnats-submit@FreeBSD.org Cc: stefan@fafoe.narf.at Subject: bin/56646: [patch] getgrouplist()/setgroups() arguments: int groups[] -> gid_t groups[] Message-ID: <20030909175456.A70DE406@frog.fafoe.narf.at> Resent-Message-ID: <200309091800.h89I0Uh1070124@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 56646 >Category: bin >Synopsis: [patch] getgrouplist()/setgroups() arguments: int groups[] -> gid_t groups[] >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 09 11:00:30 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Stefan Farfeleder >Release: FreeBSD 5.1-CURRENT i386 >Organization: >Environment: System: FreeBSD frog.fafoe.narf.at 5.1-CURRENT FreeBSD 5.1-CURRENT #7: Sun Sep 7 18:53:15 CEST 2003 freebsd@frog.fafoe.narf.at:/freebsd/frog/obj/freebsd/frog/src/sys/FROG i386 >Description: gid_t is currently typedef'ed as uint32_t on FreeBSD. This patch fixes all occurrences where an int array is passed to getgrouplist() or setgroups() which expect a gid_t array. The types int * and uint32_t * aren't compatible; passing a wrong pointer to a function is a constraint violation. >How-To-Repeat: A conforming C compiler is required to issue a diagnostic. >Fix: --- gid_t.diff begins here --- Index: src/lib/libc/gen/initgroups.c =================================================================== RCS file: /usr/home/ncvs/src/lib/libc/gen/initgroups.c,v retrieving revision 1.7 diff -u -r1.7 initgroups.c --- src/lib/libc/gen/initgroups.c 1 Feb 2002 00:57:29 -0000 1.7 +++ src/lib/libc/gen/initgroups.c 8 Sep 2003 00:12:53 -0000 @@ -50,7 +50,8 @@ const char *uname; gid_t agroup; { - int groups[NGROUPS], ngroups; + gid_t groups[NGROUPS]; + int ngroups; ngroups = NGROUPS; getgrouplist(uname, agroup, groups, &ngroups); Index: src/usr.bin/id/id.c =================================================================== RCS file: /usr/home/ncvs/src/usr.bin/id/id.c,v retrieving revision 1.19 diff -u -r1.19 id.c --- src/usr.bin/id/id.c 4 Sep 2002 23:29:02 -0000 1.19 +++ src/usr.bin/id/id.c 9 Sep 2003 17:21:02 -0000 @@ -260,7 +260,8 @@ { struct group *gr; const char *fmt; - int cnt, gid, lastgid, ngroups, groups[NGROUPS + 1]; + gid_t gid, lastgid, groups[NGROUPS + 1]; + int cnt, ngroups; (void)printf("uid=%u(%s)", pw->pw_uid, pw->pw_name); gid = pw->pw_gid; Index: src/usr.sbin/jail/jail.c =================================================================== RCS file: /usr/home/ncvs/src/usr.sbin/jail/jail.c,v retrieving revision 1.14 diff -u -r1.14 jail.c --- src/usr.sbin/jail/jail.c 6 Jul 2003 12:44:11 -0000 1.14 +++ src/usr.sbin/jail/jail.c 9 Sep 2003 17:24:51 -0000 @@ -34,7 +34,8 @@ struct jail j; struct passwd *pwd; struct in_addr in; - int ch, groups[NGROUPS], i, iflag, ngroups; + gid_t groups[NGROUPS]; + int ch, i, iflag, ngroups; char *username; iflag = 0; Index: src/usr.sbin/mountd/mountd.c =================================================================== RCS file: /usr/home/ncvs/src/usr.sbin/mountd/mountd.c,v retrieving revision 1.72 diff -u -r1.72 mountd.c --- src/usr.sbin/mountd/mountd.c 17 Jul 2003 10:11:26 -0000 1.72 +++ src/usr.sbin/mountd/mountd.c 8 Sep 2003 21:57:54 -0000 @@ -2092,7 +2092,8 @@ char *names; struct passwd *pw; struct group *gr; - int ngroups, groups[NGROUPS + 1]; + gid_t groups[NGROUPS + 1]; + int ngroups; cr->cr_version = XUCRED_VERSION; /* --- gid_t.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030909175456.A70DE406>