Subject: kern/33453: sys/ucred.h doesn't compile by itself
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <dholland@eecs.harvard.edu>
List: netbsd-bugs
Date: 05/10/2006 10:20:04
>Number:         33453
>Category:       kern
>Synopsis:       sys/ucred.h doesn't compile by itself
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed May 10 10:20:04 +0000 2006
>Originator:     David A. Holland
>Release:        NetBSD 3.99.10 et seq. (still in -20060509)
>Organization:
	Harvard EECS
>Environment:
System: NetBSD tanaqui 3.99.10 NetBSD 3.99.10 (TANAQUI) #3: Wed Oct 26 18:52:27 EDT 2005 root@tanaqui:/usr/src/sys/arch/i386/compile/TANAQUI i386
Architecture: i386
Machine: i386
>Description:

A file containing only "#include <sys/ucred.h>" doesn't compile. One
might trip on this if one were, for example, autoconf testing to see
if <sys/mount.h> is compilable.

So it isn't, and this causes configure scripts to belch a warning that
in the future this will cause sys/mount.h to be judged unusable. When
and if that future comes to pass, broken package builds and other
unnecessary headaches will probably ensue.

>How-To-Repeat:

Compile this:
   ------
#include <sys/ucred.h>
   ------

It complains that NGROUPS isn't defined.

>Fix:

Change NGROUPS to NGROUPS_MAX and add the necessary prerequisite
header. (The change reduces the requirement from sys/param.h to
sys/syslimits.h.)

Index: sys/sys/ucred.h
===================================================================
RCS file: /cvsroot/src/sys/sys/ucred.h,v
retrieving revision 1.27
diff -u -r1.27 ucred.h
--- sys/sys/ucred.h	16 Feb 2006 20:17:20 -0000	1.27
+++ sys/sys/ucred.h	9 May 2006 14:22:52 -0000
@@ -35,6 +35,7 @@
 #define	_SYS_UCRED_H_
 
 #include <sys/lock.h>
+#include <sys/syslimits.h>
 
 /*
  * Credentials.
@@ -46,7 +47,7 @@
 	uid_t		cr_uid;			/* effective user id */
 	gid_t		cr_gid;			/* effective group id */
 	short		cr_ngroups;		/* number of groups */
-	gid_t		cr_groups[NGROUPS];	/* groups */
+	gid_t		cr_groups[NGROUPS_MAX];	/* groups */
 };
 
 struct ucred {
@@ -56,7 +57,7 @@
 	uid_t		cr_uid;			/* effective user id */
 	gid_t		cr_gid;			/* effective group id */
 	uint32_t	cr_ngroups;		/* number of groups */
-	gid_t		cr_groups[NGROUPS];	/* groups */
+	gid_t		cr_groups[NGROUPS_MAX];	/* groups */
 };
 
 #define NOCRED ((struct ucred *)-1)	/* no credential available */