From: Joerg Sonnenberger Date: Sun, 19 Sep 2004 17:25:42 +0000 (+0000) Subject: Change getgrouplist(3) to take gid_t arguments for the groups. X-Git-Url: https://gitweb.dragonflybsd.org/~lentferj/dragonfly.git/commitdiff_plain/26bca77cbb5d82a9471f5d415e11e5c6d727e602 Change getgrouplist(3) to take gid_t arguments for the groups. Submitted-by: Liam J. Foy Adjust jail(8) and id(1) to pass gid_t arguments as well. --- diff --git a/include/unistd.h b/include/unistd.h index 2909b5addc..cc1e74ec41 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -32,7 +32,7 @@ * * @(#)unistd.h 8.12 (Berkeley) 4/27/95 * $FreeBSD: src/include/unistd.h,v 1.35.2.10 2002/04/15 12:52:28 nectar Exp $ - * $DragonFly: src/include/unistd.h,v 1.7 2004/02/26 13:58:25 joerg Exp $ + * $DragonFly: src/include/unistd.h,v 1.8 2004/09/19 17:25:42 joerg Exp $ */ #ifndef _UNISTD_H_ @@ -139,7 +139,7 @@ int ftruncate(int, off_t); #endif int getdomainname(char *, int); int getdtablesize(void); -int getgrouplist(const char *, int, int *, int *); +int getgrouplist(const char *, gid_t, gid_t *, int *); long gethostid(void); int gethostname(char *, int); int getlogin_r(char *, int); diff --git a/lib/libc/gen/getgrouplist.3 b/lib/libc/gen/getgrouplist.3 index 9a953fa875..24cb1881b4 100644 --- a/lib/libc/gen/getgrouplist.3 +++ b/lib/libc/gen/getgrouplist.3 @@ -31,7 +31,7 @@ .\" .\" @(#)getgrouplist.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD: src/lib/libc/gen/getgrouplist.3,v 1.4.2.3 2001/12/14 18:33:51 ru Exp $ -.\" $DragonFly: src/lib/libc/gen/getgrouplist.3,v 1.2 2003/06/17 04:26:42 dillon Exp $ +.\" $DragonFly: src/lib/libc/gen/getgrouplist.3,v 1.3 2004/09/19 17:25:42 joerg Exp $ .\" .Dd June 9, 1993 .Dt GETGROUPLIST 3 @@ -44,7 +44,7 @@ .Sh SYNOPSIS .In unistd.h .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 The .Fn getgrouplist diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c index 586cd33a13..d98ae50b0e 100644 --- a/lib/libc/gen/getgrouplist.c +++ b/lib/libc/gen/getgrouplist.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)getgrouplist.c 8.2 (Berkeley) 12/8/94 - * $DragonFly: src/lib/libc/gen/getgrouplist.c,v 1.4 2004/06/19 18:55:47 joerg Exp $ + * $DragonFly: src/lib/libc/gen/getgrouplist.c,v 1.5 2004/09/19 17:25:42 joerg Exp $ */ /* @@ -42,11 +42,7 @@ #include int -getgrouplist(uname, agroup, groups, grpcnt) - const char *uname; - int agroup; - int *groups; - int *grpcnt; +getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) { struct group *grp; int i, ngroups; diff --git a/lib/libc/gen/initgroups.c b/lib/libc/gen/initgroups.c index bda6b863b8..ab514cab8b 100644 --- a/lib/libc/gen/initgroups.c +++ b/lib/libc/gen/initgroups.c @@ -32,7 +32,7 @@ * * @(#)initgroups.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/lib/libc/gen/initgroups.c,v 1.3.8.1 2001/12/19 15:49:35 tobez Exp $ - * $DragonFly: src/lib/libc/gen/initgroups.c,v 1.3 2003/12/01 23:46:20 drhodus Exp $ + * $DragonFly: src/lib/libc/gen/initgroups.c,v 1.4 2004/09/19 17:25:42 joerg Exp $ */ #include @@ -46,7 +46,7 @@ initgroups(uname, agroup) const char *uname; int agroup; { - int ngroups; + gid_t ngroups; /* * Provide space for one group more than NGROUPS to allow * setgroups to fail and set errno. diff --git a/lib/libcr/gen/getgrouplist.3 b/lib/libcr/gen/getgrouplist.3 index 57b566ff37..8d7466ef32 100644 --- a/lib/libcr/gen/getgrouplist.3 +++ b/lib/libcr/gen/getgrouplist.3 @@ -31,7 +31,7 @@ .\" .\" @(#)getgrouplist.3 8.1 (Berkeley) 6/9/93 .\" $FreeBSD: src/lib/libc/gen/getgrouplist.3,v 1.4.2.3 2001/12/14 18:33:51 ru Exp $ -.\" $DragonFly: src/lib/libcr/gen/Attic/getgrouplist.3,v 1.2 2003/06/17 04:26:42 dillon Exp $ +.\" $DragonFly: src/lib/libcr/gen/Attic/getgrouplist.3,v 1.3 2004/09/19 17:25:42 joerg Exp $ .\" .Dd June 9, 1993 .Dt GETGROUPLIST 3 @@ -44,7 +44,7 @@ .Sh SYNOPSIS .In unistd.h .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 The .Fn getgrouplist diff --git a/lib/libcr/gen/getgrouplist.c b/lib/libcr/gen/getgrouplist.c index 0fdc4d9c4b..d18b00e5e6 100644 --- a/lib/libcr/gen/getgrouplist.c +++ b/lib/libcr/gen/getgrouplist.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)getgrouplist.c 8.2 (Berkeley) 12/8/94 - * $DragonFly: src/lib/libcr/gen/Attic/getgrouplist.c,v 1.3 2004/07/05 17:30:59 eirikn Exp $ + * $DragonFly: src/lib/libcr/gen/Attic/getgrouplist.c,v 1.4 2004/09/19 17:25:42 joerg Exp $ */ /* @@ -42,11 +42,7 @@ #include int -getgrouplist(uname, agroup, groups, grpcnt) - const char *uname; - int agroup; - int *groups; - int *grpcnt; +getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt) { struct group *grp; int i, ngroups; diff --git a/lib/libcr/gen/initgroups.c b/lib/libcr/gen/initgroups.c index 3678f9594d..1c0f0e483f 100644 --- a/lib/libcr/gen/initgroups.c +++ b/lib/libcr/gen/initgroups.c @@ -32,7 +32,7 @@ * * @(#)initgroups.c 8.1 (Berkeley) 6/4/93 * $FreeBSD: src/lib/libc/gen/initgroups.c,v 1.3.8.1 2001/12/19 15:49:35 tobez Exp $ - * $DragonFly: src/lib/libcr/gen/Attic/initgroups.c,v 1.3 2003/12/08 13:56:35 eirikn Exp $ + * $DragonFly: src/lib/libcr/gen/Attic/initgroups.c,v 1.4 2004/09/19 17:25:42 joerg Exp $ */ #include @@ -46,7 +46,7 @@ initgroups(uname, agroup) const char *uname; int agroup; { - int ngroups; + gid_t ngroups; /* * Provide space for one group more than NGROUPS to allow * setgroups to fail and set errno. diff --git a/usr.bin/id/Makefile b/usr.bin/id/Makefile index e6a4e54d7c..aa0c9328d3 100644 --- a/usr.bin/id/Makefile +++ b/usr.bin/id/Makefile @@ -1,9 +1,9 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD: src/usr.bin/id/Makefile,v 1.5.6.3 2001/12/20 12:09:03 ru Exp $ -# $DragonFly: src/usr.bin/id/Makefile,v 1.2 2003/06/17 04:29:27 dillon Exp $ +# $DragonFly: src/usr.bin/id/Makefile,v 1.3 2004/09/19 17:25:42 joerg Exp $ PROG= id -WARNS?= 2 +WARNS?= 6 LINKS= ${BINDIR}/id ${BINDIR}/groups LINKS+= ${BINDIR}/id ${BINDIR}/whoami MAN= id.1 groups.1 whoami.1 diff --git a/usr.bin/id/id.c b/usr.bin/id/id.c index fea37d5fe9..230e11acd3 100644 --- a/usr.bin/id/id.c +++ b/usr.bin/id/id.c @@ -33,7 +33,7 @@ * @(#) Copyright (c) 1991, 1993 The Regents of the University of California. All rights reserved. * @(#)id.c 8.2 (Berkeley) 2/16/94 * $FreeBSD: src/usr.bin/id/id.c,v 1.12.2.3 2001/12/20 12:09:03 ru Exp $ - * $DragonFly: src/usr.bin/id/id.c,v 1.4 2003/11/03 19:31:30 eirikn Exp $ + * $DragonFly: src/usr.bin/id/id.c,v 1.5 2004/09/19 17:25:42 joerg Exp $ */ #include @@ -252,7 +252,8 @@ user(struct passwd *pw) { struct group *gr; const char *fmt; - int cnt, gid, lastgid, ngroups, groups[NGROUPS + 1]; + int cnt, ngroups; + gid_t gid, lastgid, groups[NGROUPS + 1]; (void)printf("uid=%u(%s)", pw->pw_uid, pw->pw_name); gid = pw->pw_gid; diff --git a/usr.sbin/jail/Makefile b/usr.sbin/jail/Makefile index 437ee5fd52..7c3c84de40 100644 --- a/usr.sbin/jail/Makefile +++ b/usr.sbin/jail/Makefile @@ -1,9 +1,10 @@ # $FreeBSD: src/usr.sbin/jail/Makefile,v 1.4.2.2 2003/05/08 13:04:24 maxim Exp $ -# $DragonFly: src/usr.sbin/jail/Makefile,v 1.2 2003/06/17 04:29:55 dillon Exp $ +# $DragonFly: src/usr.sbin/jail/Makefile,v 1.3 2004/09/19 17:25:42 joerg Exp $ PROG= jail MAN= jail.8 DPADD= ${LIBUTIL} LDADD= -lutil +WARNS?= 6 .include diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c index 215119369d..83d1534d94 100644 --- a/usr.sbin/jail/jail.c +++ b/usr.sbin/jail/jail.c @@ -7,7 +7,7 @@ * ---------------------------------------------------------------------------- * * $FreeBSD: src/usr.sbin/jail/jail.c,v 1.5.2.2 2003/05/08 13:04:24 maxim Exp $ - * $DragonFly: src/usr.sbin/jail/jail.c,v 1.2 2003/06/17 04:29:55 dillon Exp $ + * $DragonFly: src/usr.sbin/jail/jail.c,v 1.3 2004/09/19 17:25:42 joerg Exp $ * */ @@ -31,11 +31,12 @@ static void usage(void); int main(int argc, char **argv) { - login_cap_t *lcap; + login_cap_t *lcap = NULL; struct jail j; - struct passwd *pwd; + struct passwd *pwd = NULL; struct in_addr in; - int ch, groups[NGROUPS], ngroups; + gid_t groups[NGROUPS]; + int ch, ngroups; char *username; username = NULL;