Use the proper type (gid_t) for (group)->gr_gid to be orthogonal

with uid_t usage and (user)->pw_uid.

PR:		3242
This commit is contained in:
Mark Murray 2002-01-22 17:32:53 +00:00
parent 7228268aaa
commit 5567b258eb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=89663
7 changed files with 20 additions and 18 deletions

View File

@ -36,6 +36,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)grp.h 8.2 (Berkeley) 1/21/94 * @(#)grp.h 8.2 (Berkeley) 1/21/94
* $FreeBSD$
*/ */
#ifndef _GRP_H_ #ifndef _GRP_H_
@ -48,7 +49,7 @@
struct group { struct group {
char *gr_name; /* group name */ char *gr_name; /* group name */
char *gr_passwd; /* group password */ char *gr_passwd; /* group password */
int gr_gid; /* group id */ gid_t gr_gid; /* group id */
char **gr_mem; /* group members */ char **gr_mem; /* group members */
}; };

View File

@ -140,7 +140,7 @@ int ftruncate __P((int, off_t));
#endif #endif
int getdomainname __P((char *, int)); int getdomainname __P((char *, int));
int getdtablesize __P((void)); int getdtablesize __P((void));
int getgrouplist __P((const char *, int, int *, int *)); int getgrouplist __P((const char *, gid_t, gid_t *, int *));
long gethostid __P((void)); long gethostid __P((void));
int gethostname __P((char *, int)); int gethostname __P((char *, int));
int getlogin_r __P((char *, int)); int getlogin_r __P((char *, int));
@ -154,7 +154,7 @@ int getresuid __P((uid_t *, uid_t *, uid_t *));
int getsid __P((pid_t _pid)); int getsid __P((pid_t _pid));
char *getusershell __P((void)); char *getusershell __P((void));
char *getwd __P((char *)); /* obsoleted by getcwd() */ char *getwd __P((char *)); /* obsoleted by getcwd() */
int initgroups __P((const char *, int)); int initgroups __P((const char *, gid_t));
int iruserok __P((unsigned long, int, const char *, const char *)); int iruserok __P((unsigned long, int, const char *, const char *));
int iruserok_sa __P((const void *, int, int, const char *, const char *)); int iruserok_sa __P((const void *, int, int, const char *, const char *));
int issetugid __P((void)); int issetugid __P((void));

View File

@ -78,7 +78,7 @@ file
struct group { struct group {
char *gr_name; /* group name */ char *gr_name; /* group name */
char *gr_passwd; /* group password */ char *gr_passwd; /* group password */
int gr_gid; /* group id */ gid_t gr_gid; /* group id */
char **gr_mem; /* group members */ char **gr_mem; /* group members */
}; };
.Ed .Ed

View File

@ -43,7 +43,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.In unistd.h .In unistd.h
.Ft int .Ft int
.Fn getgrouplist "const char *name" "int basegid" "int *groups" "int *ngroups" .Fn getgrouplist "const char *name" "gid_t basegid" "gid_t *groups" "int *ngroups"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn getgrouplist .Fn getgrouplist
@ -56,7 +56,7 @@ is automatically included in the groups list.
Typically this value is given as Typically this value is given as
the group number from the password file. the group number from the password file.
.Pp .Pp
The resulting group list is returned in the integer array pointed to by The resulting group list is returned in the array pointed to by
.Fa groups . .Fa groups .
The caller specifies the size of the The caller specifies the size of the
.Fa groups .Fa groups

View File

@ -31,9 +31,12 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)getgrouplist.c 8.2 (Berkeley) 12/8/94"; static char sccsid[] = "@(#)getgrouplist.c 8.2 (Berkeley) 12/8/94";
#endif /* LIBC_SCCS and not lint */ #endif
/* /*
* get credential * get credential
@ -45,12 +48,12 @@ static char sccsid[] = "@(#)getgrouplist.c 8.2 (Berkeley) 12/8/94";
int int
getgrouplist(uname, agroup, groups, grpcnt) getgrouplist(uname, agroup, groups, grpcnt)
const char *uname; const char *uname;
int agroup; gid_t agroup;
register int *groups; gid_t *groups;
int *grpcnt; int *grpcnt;
{ {
register struct group *grp; struct group *grp;
register int i, ngroups; int i, ngroups;
int ret, maxgroups; int ret, maxgroups;
ret = 0; ret = 0;

View File

@ -43,7 +43,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.In unistd.h .In unistd.h
.Ft int .Ft int
.Fn initgroups "const char *name" "int basegid" .Fn initgroups "const char *name" "gid_t basegid"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn initgroups .Fn initgroups

View File

@ -31,14 +31,12 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
#if 0
static char sccsid[] = "@(#)initgroups.c 8.1 (Berkeley) 6/4/93"; static char sccsid[] = "@(#)initgroups.c 8.1 (Berkeley) 6/4/93";
#else
static const char rcsid[] =
"$FreeBSD$";
#endif #endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h> #include <sys/param.h>
@ -51,7 +49,7 @@ static const char rcsid[] =
int int
initgroups(uname, agroup) initgroups(uname, agroup)
const char *uname; const char *uname;
int agroup; gid_t agroup;
{ {
int groups[NGROUPS], ngroups; int groups[NGROUPS], ngroups;