From stefan@fafoe.dyndns.org  Tue Sep  9 10:55:03 2003
Return-Path: <stefan@fafoe.dyndns.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 96AF516A4BF
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  9 Sep 2003 10:55:03 -0700 (PDT)
Received: from fafoe.narf.at (chello212186121237.14.vie.surfer.at [212.186.121.237])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7153D43FE5
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  9 Sep 2003 10:55:02 -0700 (PDT)
	(envelope-from stefan@fafoe.dyndns.org)
Received: from frog.fafoe.narf.at (frog.fafoe.narf.at [192.168.2.101])
	by fafoe.narf.at (Postfix) with ESMTP
	id A2FE4411E; Tue,  9 Sep 2003 19:54:57 +0200 (CEST)
Received: by frog.fafoe.narf.at (Postfix, from userid 1001)
	id A70DE406; Tue,  9 Sep 2003 19:54:56 +0200 (CEST)
Message-Id: <20030909175456.A70DE406@frog.fafoe.narf.at>
Date: Tue,  9 Sep 2003 19:54:56 +0200 (CEST)
From: Stefan Farfeleder <stefan@fafoe.narf.at>
Reply-To: Stefan Farfeleder <stefan@fafoe.narf.at>
To: FreeBSD-gnats-submit@freebsd.org
Cc: stefan@fafoe.narf.at
Subject: [patch] getgrouplist()/setgroups() arguments: int groups[] -> gid_t groups[]
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         56646
>Category:       bin
>Synopsis:       [patch] getgrouplist()/setgroups() arguments: int groups[] -> gid_t groups[]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    stefanf
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 09 11:00:30 PDT 2003
>Closed-Date:    Sat Oct 02 11:43:45 GMT 2004
>Last-Modified:  Sat Oct 02 11:43:45 GMT 2004
>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:
Responsible-Changed-From-To: freebsd-bugs->stefanf 
Responsible-Changed-By: stefanf 
Responsible-Changed-When: Thu May 6 07:36:17 PDT 2004 
Responsible-Changed-Why:  
Over to me. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56646 
State-Changed-From-To: open->closed 
State-Changed-By: stefanf 
State-Changed-When: Sat Oct 2 11:43:39 GMT 2004 
State-Changed-Why:  
Committed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=56646 
>Unformatted:
