From owner-cvs-src-old@FreeBSD.ORG Fri Jun 19 16:04:49 2009 Return-Path: Delivered-To: cvs-src-old@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC7661065672 for ; Fri, 19 Jun 2009 16:04:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id BB26B8FC34 for ; Fri, 19 Jun 2009 16:04:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5JG4nXw055195 for ; Fri, 19 Jun 2009 16:04:49 GMT (envelope-from brooks@repoman.freebsd.org) Received: (from svn2cvs@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5JG4n3n055194 for cvs-src-old@freebsd.org; Fri, 19 Jun 2009 16:04:49 GMT (envelope-from brooks@repoman.freebsd.org) Message-Id: <200906191604.n5JG4n3n055194@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: svn2cvs set sender to brooks@repoman.freebsd.org using -f From: Brooks Davis Date: Fri, 19 Jun 2009 15:58:24 +0000 (UTC) To: cvs-src-old@freebsd.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/lib/libc/gen initgroups.3 initgroups.c src/lib/libc/rpc auth_unix.c src/lib/libc/sys getgroups.2 setgroups.2 src/usr.bin/id id.c src/usr.bin/newgrp newgrp.c src/usr.bin/quota quota.c src/usr.sbin/chown chown.c ... X-BeenThere: cvs-src-old@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2009 16:04:50 -0000 brooks 2009-06-19 15:58:24 UTC FreeBSD src repository Modified files: lib/libc/gen initgroups.3 initgroups.c lib/libc/rpc auth_unix.c lib/libc/sys getgroups.2 setgroups.2 usr.bin/id id.c usr.bin/newgrp newgrp.c usr.bin/quota quota.c usr.sbin/chown chown.c usr.sbin/chroot chroot.c usr.sbin/jail jail.c usr.sbin/jexec jexec.c usr.sbin/lpr/lpc lpc.c Log: SVN rev 194494 on 2009-06-19 15:58:24Z by brooks In preparation for raising NGROUPS and NGROUPS_MAX, change base system callers of getgroups(), getgrouplist(), and setgroups() to allocate buffers dynamically. Specifically, allocate a buffer of size sysconf(_SC_NGROUPS_MAX)+1 (+2 in a few cases to allow for overflow). This (or similar gymnastics) is required for the code to actually follow the POSIX.1-2008 specification where {NGROUPS_MAX} may differ at runtime and where getgroups may return {NGROUPS_MAX}+1 results on systems like FreeBSD which include the primary group. In id(1), don't pointlessly add the primary group to the list of all groups, it is always the first result from getgroups(). In principle the old code was more portable, but this was only done in one of the two places where getgroups() was called to the overall effect was pointless. Document the actual POSIX requirements in the getgroups(2) and setgroups(2) manpages. We do not yet support a dynamic NGROUPS, but we may in the future. MFC after: 2 weeks Revision Changes Path 1.14 +7 -0 src/lib/libc/gen/initgroups.3 1.10 +15 -6 src/lib/libc/gen/initgroups.c 1.19 +12 -6 src/lib/libc/rpc/auth_unix.c 1.14 +6 -4 src/lib/libc/sys/getgroups.2 1.16 +2 -4 src/lib/libc/sys/setgroups.2 1.35 +18 -7 src/usr.bin/id/id.c 1.3 +8 -4 src/usr.bin/newgrp/newgrp.c 1.35 +8 -2 src/usr.bin/quota/quota.c 1.30 +6 -2 src/usr.sbin/chown/chown.c 1.12 +7 -3 src/usr.sbin/chroot/chroot.c 1.30 +7 -2 src/usr.sbin/jail/jail.c 1.12 +7 -2 src/usr.sbin/jexec/jexec.c 1.32 +6 -2 src/usr.sbin/lpr/lpc/lpc.c