From owner-freebsd-audit Sun Jan 13 17:53:20 2002 Delivered-To: freebsd-audit@freebsd.org Received: from scaup.prod.itd.earthlink.net (scaup.mail.pas.earthlink.net [207.217.120.49]) by hub.freebsd.org (Postfix) with ESMTP id 9367D37B416 for ; Sun, 13 Jan 2002 17:53:17 -0800 (PST) Received: from dialup-209.245.128.42.dial1.sanjose1.level3.net ([209.245.128.42] helo=blossom.cjclark.org) by scaup.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16PwJH-000078-00; Sun, 13 Jan 2002 17:53:16 -0800 Received: (from cjc@localhost) by blossom.cjclark.org (8.11.6/8.11.3) id g0E1rAm24640; Sun, 13 Jan 2002 17:53:10 -0800 (PST) (envelope-from cjc) Date: Sun, 13 Jan 2002 17:53:06 -0800 From: "Crist J . Clark" To: "M. Warner Losh" Cc: bright@mu.org, audit@freebsd.org Subject: Re: netbsd's daemon(3) fixes. Message-ID: <20020113175306.B24290@blossom.cjclark.org> Reply-To: cjclark@alum.mit.edu References: <20020111141420.K11553@blossom.cjclark.org> <20020111.190120.81022760.imp@village.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020111.190120.81022760.imp@village.org>; from imp@village.org on Fri, Jan 11, 2002 at 07:01:20PM -0700 X-URL: http://people.freebsd.org/~cjc/ Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [Moved from -security to -audit where this is more on-topic.] On Fri, Jan 11, 2002 at 07:01:20PM -0700, M. Warner Losh wrote: > In message: <20020111141420.K11553@blossom.cjclark.org> > "Crist J . Clark" writes: > : On Fri, 11 Jan 2002 11:21:44 -0800, Alfred Perlstein wrote: > : > I saw some recent fixes in netbsd wrt when daemon is called in > : > various daemons, anyone have time to see if this is applicable > : > to us? And whether or not to merge the fixes in? > : > : If we go back to the recent fixes OpenBSD did first, the cvs logs give > : reasons like, > : > : daemon() can close innocent file descriptors, including opened log. > : be more carefull about that and nicer to debugging. > : daemon() thingie was pointed out by markus@ . > : > : So it's not really a security issue that I can see. I'm not sure if I > : understand under what conditions a daemon(3) call will close > : "innocent" file descriptors. > > I think we need the change, since innocent file descriptors might be > important. The OpenBSD manpage has added a blurb, CAVEATS Unless the noclose argument is non-zero, daemon() will close the first three file descriptors and redirect them to /dev/null. Normally, these correspond to standard input, standard output and standard error. Howev- er, if any of those file descriptors refer to something else they will still be closed, resulting in incorrect behavior of the calling program. This can happen if any of standard input, standard output or standard er- ror have been closed before the program was run. Programs using daemon() should therefor be care to either call daemon() before opening any files or sockets or, alternately, verifying that any file descriptors obtained have a value greater than 2. I'll take a look at this stuff. First, I'll catch up our manpage. ;) -- "It's always funny until someone gets hurt. Then it's hilarious." Crist J. Clark | cjclark@alum.mit.edu | cjclark@jhu.edu http://people.freebsd.org/~cjc/ | cjc@freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jan 14 7:26:15 2002 Delivered-To: freebsd-audit@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 711DC37B402 for ; Mon, 14 Jan 2002 07:25:56 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g0EFOsG49747; Mon, 14 Jan 2002 17:24:54 +0200 (EET) (envelope-from ru) Date: Mon, 14 Jan 2002 17:24:54 +0200 From: Ruslan Ermilov To: Giorgos Keramidas Cc: audit@FreeBSD.ORG Subject: Re: last with -y option Message-ID: <20020114172454.G21333@sunbay.com> References: <20020111232631.GA66629@hades.hell.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020111232631.GA66629@hades.hell.gr> User-Agent: Mutt/1.3.23i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Jan 12, 2002 at 01:26:31AM +0200, Giorgos Keramidas wrote: > The patch that was sent in PR bin/12982 does not apply to the > usr.bin/last (probably because our last was modified for WARNS=2 after > the patch was submitted), but I liked the idea that it describes. > > The attached patch adds a -y option to last that will print the year > too when listing wtmp records. It also removes a few EOL whitespaces > that I found while reading the last.c source. > > If this does not break any standards, and you don't think that it > breaks last(1) in some way, I'll have to find myself an src/ committer > to take care of this PR :-) > There're two functional and style bugs in your patch, see below. > Index: last.1 [...] > @@ -162,4 +163,6 @@ > Widen the duration field to show seconds, as well as the > default days, hours and minutes. > +.It Fl w > +Report years too in the login session duration. > .El > .Pp This should yield -y not -w. > Index: last.c [...] > @@ -246,13 +250,22 @@ > /* > * don't print shutdown/reboot entries > - * unless flagged for > - */ > + * unless flagged for > + */ Please don't commit unrelated whitespace changes together with functional ones, commit them seperately. > if (!snaptime && want(bp)) { > t = int_to_time(bp->ut_time); > tm = localtime(&t); > - (void) strftime(ct, sizeof(ct), > - d_first ? "%a %e %b %R" : > - "%a %b %e %R", > - tm); > + if (yflag) { > + (void) strftime(ct, sizeof(ct), > + d_first > + ? "%a %e %b %Y %R" > + : "%a %b %e %Y %R", > + tm); > + } else { > + (void) strftime(ct, sizeof(ct), > + d_first > + ? "%a %e %b %Y %R" > + : "%a %b %e %Y %R", > + tm); > + } These two sub-blocks in the "if" clause are identical, meaning you have year printed unconditionally for startup/shutdown events. > @@ -293,5 +315,5 @@ > if (!strncmp(tt->tty, bp->ut_line, UT_LINESIZE)) > break; > - > + > if (tt == NULL) { > /* add new one */ Garbage. > @@ -303,5 +325,5 @@ > LIST_INSERT_HEAD(&ttylist, tt, list); > } > - > + > /* > * print record if not in snapshot mode and wanted Ditto. > @@ -346,5 +375,5 @@ > delta = tt->logout - bp->ut_time; > if ( sflag ) { > - printf(" (%8ld)\n", > + printf(" (%8ld)\n", > (long)delta); > } else { Ditto. Cheers, -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Mon Jan 14 10:57: 9 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by hub.freebsd.org (Postfix) with ESMTP id F318A37B419; Mon, 14 Jan 2002 10:57:03 -0800 (PST) Received: from hades.hell.gr (patr530-a038.otenet.gr [212.205.215.38]) by mailsrv.otenet.gr (8.11.5/8.11.5) with ESMTP id g0EIuxY22213; Mon, 14 Jan 2002 20:57:01 +0200 (EET) Received: (from charon@localhost) by hades.hell.gr (8.11.6/8.11.6) id g0EIv3p30494; Mon, 14 Jan 2002 20:57:03 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Mon, 14 Jan 2002 20:57:02 +0200 From: Giorgos Keramidas To: Ruslan Ermilov Cc: audit@FreeBSD.ORG Subject: Re: last with -y option Message-ID: <20020114185702.GA30454@hades.hell.gr> References: <20020111232631.GA66629@hades.hell.gr> <20020114172454.G21333@sunbay.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020114172454.G21333@sunbay.com> User-Agent: Mutt/1.3.25i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 2002-01-14 17:24:54, Ruslan Ermilov wrote: > On Sat, Jan 12, 2002 at 01:26:31AM +0200, Giorgos Keramidas wrote: > > The patch that was sent in PR bin/12982 does not apply to the > > usr.bin/last (probably because our last was modified for WARNS=2 after > > the patch was submitted), but I liked the idea that it describes. > > > > The attached patch adds a -y option to last that will print the year > > too when listing wtmp records. It also removes a few EOL whitespaces > > that I found while reading the last.c source. > > > > If this does not break any standards, and you don't think that it > > breaks last(1) in some way, I'll have to find myself an src/ committer > > to take care of this PR :-) > > > There're two functional and style bugs in your patch, see below. iewdose pointed out that many parts of the last.c source are duplicated in a lot of other places. I'll try to come up with changes that remove these duplicates first, and then add the -y option. This patch will be obsolete by then, but thanks Ruslan for taking the time to read/comment the changes. > Please don't commit unrelated whitespace changes together with functional > ones, commit them seperately. Good point. Thanks :) I'm not committing to src/ (apart from manpages) without approval anyway, but you're right. If/when last.c is changed I'll keep in mind to separate whitespace and content changes. -- Giorgos Keramidas . . . . . . . . . keramida@{ceid.upatras.gr,freebsd.org} FreeBSD Documentation Project . . . http://www.freebsd.org/docproj/ FreeBSD: The power to serve . . . . http://www.freebsd.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jan 17 9:32:29 2002 Delivered-To: freebsd-audit@freebsd.org Received: from melchior.cuivre.fr.eu.org (melchior.enst.fr [137.194.161.6]) by hub.freebsd.org (Postfix) with ESMTP id BE28937B417 for ; Thu, 17 Jan 2002 09:32:23 -0800 (PST) Received: from melusine.cuivre.fr.eu.org (melusine.enst.fr [137.194.160.34]) by melchior.cuivre.fr.eu.org (Postfix) with ESMTP id 1C3938243 for ; Thu, 17 Jan 2002 18:32:22 +0100 (CET) Received: by melusine.cuivre.fr.eu.org (Postfix, from userid 1000) id BCA087B; Thu, 17 Jan 2002 18:32:21 +0100 (CET) Date: Thu, 17 Jan 2002 18:32:21 +0100 From: Thomas Quinot To: freebsd-audit@freebsd.org Subject: conf/31358: NFS and amd startup fixes Message-ID: <20020117183221.A87451@melusine.cuivre.fr.eu.org> Reply-To: thomas@cuivre.fr.eu.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi auditors, I'd be interested in a review and test feeback of the attached patch, which addresses the two issues raised by PR conf/31358: * when enabling amd, nfsclient needs to be enabled as well; * when nfsclient is enabled, the LKM needs to be loaded if the code was not compiled into the kernel. Thanks, Thomas. diff -u {/usr/src,}/etc/rc --- /usr/src/etc/rc Fri Jan 4 14:35:43 2002 +++ /etc/rc Tue Jan 8 18:06:12 2002 @@ -103,6 +103,7 @@ } chkdepend amd amd_enable portmap portmap_enable +chkdepend amd amd_enable NFS nfs_client_enable chkdepend NFS nfs_server_enable portmap portmap_enable chkdepend NIS nis_server_enable portmap portmap_enable chkdepend NIS nis_client_enable portmap portmap_enable diff -u {/usr/src,}/etc/rc.network --- /usr/src/etc/rc.network Fri Jan 4 14:35:44 2002 +++ /etc/rc.network Tue Jan 8 18:06:30 2002 @@ -714,24 +714,59 @@ case ${nfs_client_enable} in [Yy][Ee][Ss]) - if [ -n "${nfs_access_cache}" ]; then - echo -n " NFS access cache time=${nfs_access_cache}" - sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null + nfsclient_in_kernel=0 + # Handle absent nfs client support + if sysctl vfs.nfs >/dev/null 2>&1; then + nfsclient_in_kernel=1 + else + kldload nfsclient && nfsclient_in_kernel=1 fi - if [ -n "${nfs_bufpackets}" ]; then - sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null + + if [ ${nfsclient_in_kernel} -eq 1 ] + then + if [ -n "${nfs_access_cache}" ]; then + echo -n " NFS access cache time=${nfs_access_cache}" + sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null + fi + if [ -n "${nfs_bufpackets}" ]; then + sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null + fi + case ${rpc_statd_enable} in + [Yy][Ee][Ss]) + echo -n ' rpc.statd'; rpc.statd + ;; + esac + + case ${rpc_lockd_enable} in + [Yy][Ee][Ss]) + echo -n ' rpc.lockd'; rpc.lockd + ;; + esac + + case ${amd_enable} in + [Yy][Ee][Ss]) + echo -n ' amd' + case ${amd_map_program} in + [Nn][Oo] | '') + ;; + *) + amd_flags="${amd_flags} `eval\ + ${amd_map_program}`" + ;; + esac + + if [ -n "${amd_flags}" ]; then + amd -p ${amd_flags}\ + > /var/run/amd.pid 2> /dev/null + else + amd 2> /dev/null + fi + ;; + esac + else + echo 'Warning: NFS client kernel module failed to load' + nfs_client_enable=NO fi - case ${rpc_statd_enable} in - [Yy][Ee][Ss]) - echo -n ' rpc.statd'; rpc.statd - ;; - esac - - case ${rpc_lockd_enable} in - [Yy][Ee][Ss]) - echo -n ' rpc.lockd'; rpc.lockd - ;; - esac ;; esac @@ -742,26 +777,6 @@ rpc.umntall -k fi - case ${amd_enable} in - [Yy][Ee][Ss]) - echo -n ' amd' - case ${amd_map_program} in - [Nn][Oo] | '') - ;; - *) - amd_flags="${amd_flags} `eval\ - ${amd_map_program}`" - ;; - esac - - if [ -n "${amd_flags}" ]; then - amd -p ${amd_flags}\ - > /var/run/amd.pid 2> /dev/null - else - amd 2> /dev/null - fi - ;; - esac ;; esac -- Thomas.Quinot@Cuivre.FR.EU.ORG To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jan 17 13:49:14 2002 Delivered-To: freebsd-audit@freebsd.org Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.139.170]) by hub.freebsd.org (Postfix) with ESMTP id 9558037B416 for ; Thu, 17 Jan 2002 13:49:00 -0800 (PST) Received: (from uucp@localhost) by storm.FreeBSD.org.uk (8.11.6/8.11.6) with UUCP id g0HLmxG69030 for audit@freebsd.org; Thu, 17 Jan 2002 21:48:59 GMT (envelope-from mark@grondar.za) Received: from grondar.za (mark@localhost [127.0.0.1]) by grimreaper.grondar.org (8.11.6/8.11.6) with ESMTP id g0HLkft13995 for ; Thu, 17 Jan 2002 21:46:41 GMT (envelope-from mark@grondar.za) Message-Id: <200201172146.g0HLkft13995@grimreaper.grondar.org> To: audit@freebsd.org Subject: lib/csu cleanup Date: Thu, 17 Jan 2002 21:46:41 +0000 From: Mark Murray Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi I've been running these patches for quite a while (the i386-elf ones anyway) without problems. They result is a diff reduction between i386-elf and alpha, and a mostlly clean report from the lint that I'm using. Also, it is mostly WARNS=4 clean (there is a whine about no prototype for _start()). There is a small bit of style cleanup. Questions: 1) I've wrapped some _horrible_ assembler in #ifndef lint/#endif. What is a better way (if any)? #ifndef __STDC__ does not cut it as GCC's preprocessor defines that for lint. I have a half-baked idea for COMPILING and LINTING macros, but I'm sure there is a better way. Mebbe its just using 'lint'? 2) Where can _start() be prototyped? Where is is used? 3) Could those with reviewing skills please have a look at this? M Index: alpha/crt1.c =================================================================== RCS file: /home/ncvs/src/lib/csu/alpha/crt1.c,v retrieving revision 1.10 diff -u -d -r1.10 crt1.c --- alpha/crt1.c 26 Oct 2001 06:45:10 -0000 1.10 +++ alpha/crt1.c 17 Jan 2002 21:11:52 -0000 @@ -60,7 +60,7 @@ #endif char **environ; -char *__progname = ""; +const char *__progname = ""; /* The entry function. */ void @@ -72,13 +72,20 @@ int argc; char **argv; char **env; + const char *s; + union { + char **a; + long *b; + } xlat; /* Looks horrible, but is a convincing way + * to translate different pointer types + */ - argc = * (long *) ap; + argv = xlat.a = ap; + argc = *xlat.b; argv = ap + 1; env = ap + 2 + argc; environ = env; if(argc > 0 && argv[0] != NULL) { - char *s; __progname = argv[0]; for (s = __progname; *s != '\0'; s++) if (*s == '/') @@ -108,7 +115,5 @@ /* * NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text. */ -#ifndef lint -static const char rcsid[] = - "$FreeBSD: src/lib/csu/alpha/crt1.c,v 1.10 2001/10/26 06:45:10 obrien Exp $"; -#endif + +__FBSDID("$FreeBSD: src/lib/csu/alpha/crt1.c,v 1.10 2001/10/26 06:45:10 obrien Exp $"); Index: i386-elf/crt1.c =================================================================== RCS file: /home/ncvs/src/lib/csu/i386-elf/crt1.c,v retrieving revision 1.5 diff -u -d -r1.5 crt1.c --- i386-elf/crt1.c 28 Oct 2000 21:26:48 -0000 1.5 +++ i386-elf/crt1.c 17 Jan 2002 21:18:03 -0000 @@ -21,14 +21,13 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: src/lib/csu/i386-elf/crt1.c,v 1.5 2000/10/28 21:26:48 obrien Exp $ */ #ifndef __GNUC__ #error "GCC is needed to compile this file" #endif +#include #include #include #include "crtbrand.c" @@ -50,16 +49,20 @@ #pragma weak _DYNAMIC #ifdef __i386__ +#ifndef lint #define get_rtld_cleanup() \ ({ fptr __value; \ __asm__("movl %%edx,%0" : "=rm"(__value)); \ __value; }) #else +#define get_rtld_cleanup() 0 +#endif +#else #error "This file only supports the i386 architecture" #endif char **environ; -char *__progname = ""; +const char *__progname = ""; void _start(char *arguments, ...) @@ -68,21 +71,27 @@ int argc; char **argv; char **env; + const char *s; + union { + char **a; + int *b; + } xlat; /* Looks horrible, but is a convincing way + * to translate different pointer types + */ rtld_cleanup = get_rtld_cleanup(); - argv = &arguments; - argc = * (int *) (argv - 1); + xlat.a = argv = &arguments; + argc = *(xlat.b - 1); env = argv + argc + 1; environ = env; - if(argc > 0 && argv[0] != NULL) { - char *s; + if (argc > 0 && argv[0] != NULL) { __progname = argv[0]; for (s = __progname; *s != '\0'; s++) if (*s == '/') __progname = s + 1; } - if(&_DYNAMIC != NULL) + if (&_DYNAMIC != NULL) atexit(rtld_cleanup); #ifdef GCRT @@ -101,3 +110,9 @@ __asm__("eprol:"); __asm__(".previous"); #endif + +/* + * NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text. + */ + +__FBSDID("$FreeBSD: src/lib/csu/i386-elf/crt1.c,v 1.5 2000/10/28 21:26:48 obrien Exp $"); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jan 17 14: 4:11 2002 Delivered-To: freebsd-audit@freebsd.org Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.139.170]) by hub.freebsd.org (Postfix) with ESMTP id 3F84237B405 for ; Thu, 17 Jan 2002 14:04:04 -0800 (PST) Received: (from uucp@localhost) by storm.FreeBSD.org.uk (8.11.6/8.11.6) with UUCP id g0HM43Q69144 for audit@freebsd.org; Thu, 17 Jan 2002 22:04:03 GMT (envelope-from mark@grondar.za) Received: from grondar.za (mark@localhost [127.0.0.1]) by grimreaper.grondar.org (8.11.6/8.11.6) with ESMTP id g0HM0St19717 for ; Thu, 17 Jan 2002 22:00:28 GMT (envelope-from mark@grondar.za) Message-Id: <200201172200.g0HM0St19717@grimreaper.grondar.org> To: audit@freebsd.org Subject: Fixes for gid_t usage in libc Date: Thu, 17 Jan 2002 22:00:28 +0000 From: Mark Murray Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi Reviews please? This fixes some places where groups are handled in integers rather than gid_t's. I've been running it for more than a month. M Index: include/grp.h =================================================================== RCS file: /home/ncvs/src/include/grp.h,v retrieving revision 1.3 diff -u -d -r1.3 grp.h --- include/grp.h 7 May 1997 19:59:59 -0000 1.3 +++ include/grp.h 7 Dec 2001 20:48:47 -0000 @@ -48,7 +48,7 @@ struct group { char *gr_name; /* group name */ char *gr_passwd; /* group password */ - int gr_gid; /* group id */ + gid_t gr_gid; /* group id */ char **gr_mem; /* group members */ }; Index: include/unistd.h =================================================================== RCS file: /home/ncvs/src/include/unistd.h,v retrieving revision 1.46 diff -u -d -r1.46 unistd.h --- include/unistd.h 22 Dec 2001 05:18:37 -0000 1.46 +++ include/unistd.h 22 Dec 2001 14:23:04 -0000 @@ -140,7 +140,7 @@ #endif int getdomainname __P((char *, int)); 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)); int gethostname __P((char *, int)); int getlogin_r __P((char *, int)); @@ -154,7 +154,7 @@ int getsid __P((pid_t _pid)); char *getusershell __P((void)); 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_sa __P((const void *, int, int, const char *, const char *)); int issetugid __P((void)); Index: lib/libc/gen/getgrent.3 =================================================================== RCS file: /home/ncvs/src/lib/libc/gen/getgrent.3,v retrieving revision 1.17 diff -u -d -r1.17 getgrent.3 --- lib/libc/gen/getgrent.3 14 Jan 2002 16:59:00 -0000 1.17 +++ lib/libc/gen/getgrent.3 15 Jan 2002 18:55:26 -0000 @@ -78,7 +78,7 @@ struct group { char *gr_name; /* group name */ char *gr_passwd; /* group password */ - int gr_gid; /* group id */ + gid_t gr_gid; /* group id */ char **gr_mem; /* group members */ }; .Ed Index: lib/libc/gen/getgrouplist.3 =================================================================== RCS file: /home/ncvs/src/lib/libc/gen/getgrouplist.3,v retrieving revision 1.7 diff -u -d -r1.7 getgrouplist.3 --- lib/libc/gen/getgrouplist.3 1 Oct 2001 16:08:51 -0000 1.7 +++ lib/libc/gen/getgrouplist.3 14 Dec 2001 15:21:22 -0000 @@ -43,7 +43,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 @@ -56,7 +56,7 @@ Typically this value is given as the group number from the password file. .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 . The caller specifies the size of the .Fa groups Index: lib/libc/gen/getgrouplist.c =================================================================== RCS file: /home/ncvs/src/lib/libc/gen/getgrouplist.c,v retrieving revision 1.7 diff -u -d -r1.7 getgrouplist.c --- lib/libc/gen/getgrouplist.c 12 Mar 1997 14:54:22 -0000 1.7 +++ lib/libc/gen/getgrouplist.c 14 Dec 2001 15:29:19 -0000 @@ -31,9 +31,12 @@ * SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)getgrouplist.c 8.2 (Berkeley) 12/8/94"; -#endif /* LIBC_SCCS and not lint */ +#endif /* * get credential @@ -45,12 +48,12 @@ int getgrouplist(uname, agroup, groups, grpcnt) const char *uname; - int agroup; - register int *groups; + gid_t agroup; + gid_t *groups; int *grpcnt; { - register struct group *grp; - register int i, ngroups; + struct group *grp; + int i, ngroups; int ret, maxgroups; ret = 0; Index: lib/libc/gen/initgroups.3 =================================================================== RCS file: /home/ncvs/src/lib/libc/gen/initgroups.3,v retrieving revision 1.11 diff -u -d -r1.11 initgroups.3 --- lib/libc/gen/initgroups.3 28 Nov 2001 10:55:02 -0000 1.11 +++ lib/libc/gen/initgroups.3 14 Dec 2001 15:18:14 -0000 @@ -43,7 +43,7 @@ .Sh SYNOPSIS .In unistd.h .Ft int -.Fn initgroups "const char *name" "int basegid" +.Fn initgroups "const char *name" "gid_t basegid" .Sh DESCRIPTION The .Fn initgroups Index: lib/libc/gen/initgroups.c =================================================================== RCS file: /home/ncvs/src/lib/libc/gen/initgroups.c,v retrieving revision 1.5 diff -u -d -r1.5 initgroups.c --- lib/libc/gen/initgroups.c 28 Nov 2001 10:55:02 -0000 1.5 +++ lib/libc/gen/initgroups.c 14 Dec 2001 15:30:10 -0000 @@ -31,14 +31,12 @@ * SUCH DAMAGE. */ +#include +__FBSDID("$FreeBSD$"); + #if defined(LIBC_SCCS) && !defined(lint) -#if 0 static char sccsid[] = "@(#)initgroups.c 8.1 (Berkeley) 6/4/93"; -#else -static const char rcsid[] = - "$FreeBSD: src/lib/libc/gen/initgroups.c,v 1.5 2001/11/28 10:55:02 tobez Exp $"; #endif -#endif /* LIBC_SCCS and not lint */ #include @@ -51,7 +49,7 @@ int initgroups(uname, agroup) const char *uname; - int agroup; + gid_t agroup; { int groups[NGROUPS], ngroups; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jan 17 14:24:26 2002 Delivered-To: freebsd-audit@freebsd.org Received: from lennier.cc.vt.edu (lennier.cc.vt.edu [198.82.162.213]) by hub.freebsd.org (Postfix) with ESMTP id 800D937B402 for ; Thu, 17 Jan 2002 14:24:20 -0800 (PST) Received: from zidane.cc.vt.edu (IDENT:mirapoint@zidane-lb.cc.vt.edu [10.1.1.13]) by lennier.cc.vt.edu (8.11.4/8.11.4) with ESMTP id g0HMOJB363042; Thu, 17 Jan 2002 17:24:19 -0500 (EST) Received: from enterprise.muriel.penguinpowered.com (hc6526444.dhcp.vt.edu [198.82.100.68]) by zidane.cc.vt.edu (Mirapoint) with ESMTP id AHP37451; Thu, 17 Jan 2002 17:24:19 -0500 (EST) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="_=XFMail.1.5.2.FreeBSD:20020117172419:266=_"; micalg=pgp-md5; protocol="application/pgp-signature" In-Reply-To: <200201172200.g0HM0St19717@grimreaper.grondar.org> Date: Thu, 17 Jan 2002 17:24:19 -0500 (EST) From: Mike Heffner To: Mark Murray Subject: Re: Fixes for gid_t usage in libc Cc: audit@FreeBSD.ORG Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.2.FreeBSD:20020117172419:266=_ Content-Type: text/plain; charset=us-ascii FWIW, this also fixes bin/3242. Mike -- Mike Heffner Blacksburg, VA --_=XFMail.1.5.2.FreeBSD:20020117172419:266=_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE8R08SFokZQs3sv5kRAos5AKCc2nci2dMW4+weE7kYBMBl69A0QACfZ8mN R0jKbQhtRSuYbY/ADd9qUEQ= =WMCI -----END PGP SIGNATURE----- --_=XFMail.1.5.2.FreeBSD:20020117172419:266=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Thu Jan 17 22:19:47 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id ABAB737B417 for ; Thu, 17 Jan 2002 22:19:41 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id RAA13730; Fri, 18 Jan 2002 17:18:26 +1100 Date: Fri, 18 Jan 2002 17:19:45 +1100 (EST) From: Bruce Evans X-X-Sender: To: Mark Murray Cc: Subject: Re: lib/csu cleanup In-Reply-To: <200201172146.g0HLkft13995@grimreaper.grondar.org> Message-ID: <20020118165527.R4892-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 17 Jan 2002, Mark Murray wrote: > 1) I've wrapped some _horrible_ assembler in #ifndef lint/#endif. > What is a better way (if any)? #ifndef __STDC__ does not cut it Wrap it in __GNUC__ (it is gcc-specific), and unbreak lint so that it doesn't define __GNUC__. > as GCC's preprocessor defines that for lint. I have a half-baked > idea for COMPILING and LINTING macros, but I'm sure there is > a better way. Mebbe its just using 'lint'? > > 2) Where can _start() be prototyped? Where is is used? Before itself. ld(1). > Index: alpha/crt1.c > =================================================================== > RCS file: /home/ncvs/src/lib/csu/alpha/crt1.c,v > retrieving revision 1.10 > diff -u -d -r1.10 crt1.c > --- alpha/crt1.c 26 Oct 2001 06:45:10 -0000 1.10 > +++ alpha/crt1.c 17 Jan 2002 21:11:52 -0000 > ... > @@ -72,13 +72,20 @@ > int argc; > char **argv; > char **env; > + const char *s; > + union { > + char **a; > + long *b; > + } xlat; /* Looks horrible, but is a convincing way > + * to translate different pointer types > + */ s/Looks horrible/Is horrible/ It just breaks lint's detection of unportabilities. Block comments are not formatted like this in KNF. > ... > @@ -108,7 +115,5 @@ > /* > * NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text. > */ > -#ifndef lint > -static const char rcsid[] = > - "$FreeBSD: src/lib/csu/alpha/crt1.c,v 1.10 2001/10/26 06:45:10 obrien Exp $"; > -#endif > + > +__FBSDID("$FreeBSD: src/lib/csu/alpha/crt1.c,v 1.10 2001/10/26 06:45:10 obrien Exp $"); The comment has rotted: old bitrot: __start() doesn't exist. new bitrot: _FBSDID() never puts the ID in .text for elf (check this). New style bug: blank line separates the comment from the code. > Index: i386-elf/crt1.c > =================================================================== > RCS file: /home/ncvs/src/lib/csu/i386-elf/crt1.c,v > retrieving revision 1.5 > diff -u -d -r1.5 crt1.c > --- i386-elf/crt1.c 28 Oct 2000 21:26:48 -0000 1.5 > +++ i386-elf/crt1.c 17 Jan 2002 21:18:03 -0000 > @@ -21,14 +21,13 @@ > * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF > * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > - * > - * $FreeBSD: src/lib/csu/i386-elf/crt1.c,v 1.5 2000/10/28 21:26:48 obrien Exp $ > */ > > #ifndef __GNUC__ > #error "GCC is needed to compile this file" > #endif > > +#include Style bug. Including explicitly is a necessary evil if __FBSDID() is placed before other includes, but is not needed here. > #include > #include > #include "crtbrand.c" > @@ -50,16 +49,20 @@ > #pragma weak _DYNAMIC > > #ifdef __i386__ > +#ifndef lint > #define get_rtld_cleanup() \ > ({ fptr __value; \ > __asm__("movl %%edx,%0" : "=rm"(__value)); \ > __value; }) > #else > +#define get_rtld_cleanup() 0 > +#endif > +#else > #error "This file only supports the i386 architecture" > #endif See above. Also, lint failures when the function declared in asm doesn't exist (because it is hidden by __GNUC__) are correct. Linting this file should have failed already with the #error for the !__GNUC__ case. > ... > @@ -68,21 +71,27 @@ > int argc; > char **argv; > char **env; > + const char *s; > + union { > + char **a; > + int *b; > + } xlat; /* Looks horrible, but is a convincing way > + * to translate different pointer types > + */ As above. > @@ -101,3 +110,9 @@ > __asm__("eprol:"); > __asm__(".previous"); > #endif > + > +/* > + * NOTE: Leave the RCS ID _after_ __start(), in case it gets placed in .text. > + */ > + > +__FBSDID("$FreeBSD: src/lib/csu/i386-elf/crt1.c,v 1.5 2000/10/28 21:26:48 obrien Exp $"); As above, except the comment was born broken. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Fri Jan 18 2:25:12 2002 Delivered-To: freebsd-audit@freebsd.org Received: from straylight.ringlet.net (discworld.nanolink.com [217.75.135.248]) by hub.freebsd.org (Postfix) with SMTP id 2D4AB37B416 for ; Fri, 18 Jan 2002 02:25:06 -0800 (PST) Received: (qmail 31291 invoked by uid 1000); 18 Jan 2002 10:25:57 -0000 Date: Fri, 18 Jan 2002 12:25:57 +0200 From: Peter Pentchev To: Mark Murray Cc: audit@freebsd.org Subject: Re: Fixes for gid_t usage in libc Message-ID: <20020118122557.C305@straylight.oblivion.bg> Mail-Followup-To: Mark Murray , audit@freebsd.org References: <200201172200.g0HM0St19717@grimreaper.grondar.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200201172200.g0HM0St19717@grimreaper.grondar.org>; from mark@grondar.za on Thu, Jan 17, 2002 at 10:00:28PM +0000 Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, Jan 17, 2002 at 10:00:28PM +0000, Mark Murray wrote: > Hi > > Reviews please? > > This fixes some places where groups are handled in integers > rather than gid_t's. > > I've been running it for more than a month. There are a lot more :) Just changing grp.h to use gid_t might break a couple of WARNSified programs, I think.. > Index: lib/libc/gen/getgrouplist.c > =================================================================== > RCS file: /home/ncvs/src/lib/libc/gen/getgrouplist.c,v > retrieving revision 1.7 > diff -u -d -r1.7 getgrouplist.c > --- lib/libc/gen/getgrouplist.c 12 Mar 1997 14:54:22 -0000 1.7 > +++ lib/libc/gen/getgrouplist.c 14 Dec 2001 15:29:19 -0000 > @@ -31,9 +31,12 @@ > * SUCH DAMAGE. > */ > > +#include > +__FBSDID("$FreeBSD$"); > + Isn't kind of an implementation detail? I think that is supposed to be used for FBSDID's.. I might be wrong, of course. Could this one not be redone by placing the FBSDID after the other includes, though? G'luck, Peter -- What would this sentence be like if it weren't self-referential? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Jan 19 14:21:31 2002 Delivered-To: freebsd-audit@freebsd.org Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by hub.freebsd.org (Postfix) with ESMTP id 728EF37B402 for ; Sat, 19 Jan 2002 14:21:09 -0800 (PST) Received: from fledge.watson.org (fledge.pr.watson.org [192.0.2.3]) by fledge.watson.org (8.11.6/8.11.5) with SMTP id g0JMKwD44686; Sat, 19 Jan 2002 17:21:00 -0500 (EST) (envelope-from robert@fledge.watson.org) Date: Sat, 19 Jan 2002 17:20:58 -0500 (EST) From: Robert Watson X-Sender: robert@fledge.watson.org To: Mark Murray Cc: audit@freebsd.org Subject: Re: Fixes for gid_t usage in libc In-Reply-To: <200201172200.g0HM0St19717@grimreaper.grondar.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG It's worth pointing out that there's a PR open on the uid_t/gid_t problem in the System V IPC interfaces; however, unlike in this situation, that case has a binary compatibility problem since the interfaces currently use 16-bit types :-(. We'll need to hack in binary compatibility for that, and also handle the linuxlator properly. However, these changes look generally good to me -- does this bring us closer or further from any standards compliance? Robert N M Watson FreeBSD Core Team, TrustedBSD Project robert@fledge.watson.org NAI Labs, Safeport Network Services On Thu, 17 Jan 2002, Mark Murray wrote: > Hi > > Reviews please? > > This fixes some places where groups are handled in integers > rather than gid_t's. > > I've been running it for more than a month. > > M > > Index: include/grp.h > =================================================================== > RCS file: /home/ncvs/src/include/grp.h,v > retrieving revision 1.3 > diff -u -d -r1.3 grp.h > --- include/grp.h 7 May 1997 19:59:59 -0000 1.3 > +++ include/grp.h 7 Dec 2001 20:48:47 -0000 > @@ -48,7 +48,7 @@ > struct group { > char *gr_name; /* group name */ > char *gr_passwd; /* group password */ > - int gr_gid; /* group id */ > + gid_t gr_gid; /* group id */ > char **gr_mem; /* group members */ > }; > > Index: include/unistd.h > =================================================================== > RCS file: /home/ncvs/src/include/unistd.h,v > retrieving revision 1.46 > diff -u -d -r1.46 unistd.h > --- include/unistd.h 22 Dec 2001 05:18:37 -0000 1.46 > +++ include/unistd.h 22 Dec 2001 14:23:04 -0000 > @@ -140,7 +140,7 @@ > #endif > int getdomainname __P((char *, int)); > 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)); > int gethostname __P((char *, int)); > int getlogin_r __P((char *, int)); > @@ -154,7 +154,7 @@ > int getsid __P((pid_t _pid)); > char *getusershell __P((void)); > 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_sa __P((const void *, int, int, const char *, const char *)); > int issetugid __P((void)); > Index: lib/libc/gen/getgrent.3 > =================================================================== > RCS file: /home/ncvs/src/lib/libc/gen/getgrent.3,v > retrieving revision 1.17 > diff -u -d -r1.17 getgrent.3 > --- lib/libc/gen/getgrent.3 14 Jan 2002 16:59:00 -0000 1.17 > +++ lib/libc/gen/getgrent.3 15 Jan 2002 18:55:26 -0000 > @@ -78,7 +78,7 @@ > struct group { > char *gr_name; /* group name */ > char *gr_passwd; /* group password */ > - int gr_gid; /* group id */ > + gid_t gr_gid; /* group id */ > char **gr_mem; /* group members */ > }; > .Ed > Index: lib/libc/gen/getgrouplist.3 > =================================================================== > RCS file: /home/ncvs/src/lib/libc/gen/getgrouplist.3,v > retrieving revision 1.7 > diff -u -d -r1.7 getgrouplist.3 > --- lib/libc/gen/getgrouplist.3 1 Oct 2001 16:08:51 -0000 1.7 > +++ lib/libc/gen/getgrouplist.3 14 Dec 2001 15:21:22 -0000 > @@ -43,7 +43,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 > @@ -56,7 +56,7 @@ > Typically this value is given as > the group number from the password file. > .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 . > The caller specifies the size of the > .Fa groups > Index: lib/libc/gen/getgrouplist.c > =================================================================== > RCS file: /home/ncvs/src/lib/libc/gen/getgrouplist.c,v > retrieving revision 1.7 > diff -u -d -r1.7 getgrouplist.c > --- lib/libc/gen/getgrouplist.c 12 Mar 1997 14:54:22 -0000 1.7 > +++ lib/libc/gen/getgrouplist.c 14 Dec 2001 15:29:19 -0000 > @@ -31,9 +31,12 @@ > * SUCH DAMAGE. > */ > > +#include > +__FBSDID("$FreeBSD$"); > + > #if defined(LIBC_SCCS) && !defined(lint) > static char sccsid[] = "@(#)getgrouplist.c 8.2 (Berkeley) 12/8/94"; > -#endif /* LIBC_SCCS and not lint */ > +#endif > > /* > * get credential > @@ -45,12 +48,12 @@ > int > getgrouplist(uname, agroup, groups, grpcnt) > const char *uname; > - int agroup; > - register int *groups; > + gid_t agroup; > + gid_t *groups; > int *grpcnt; > { > - register struct group *grp; > - register int i, ngroups; > + struct group *grp; > + int i, ngroups; > int ret, maxgroups; > > ret = 0; > Index: lib/libc/gen/initgroups.3 > =================================================================== > RCS file: /home/ncvs/src/lib/libc/gen/initgroups.3,v > retrieving revision 1.11 > diff -u -d -r1.11 initgroups.3 > --- lib/libc/gen/initgroups.3 28 Nov 2001 10:55:02 -0000 1.11 > +++ lib/libc/gen/initgroups.3 14 Dec 2001 15:18:14 -0000 > @@ -43,7 +43,7 @@ > .Sh SYNOPSIS > .In unistd.h > .Ft int > -.Fn initgroups "const char *name" "int basegid" > +.Fn initgroups "const char *name" "gid_t basegid" > .Sh DESCRIPTION > The > .Fn initgroups > Index: lib/libc/gen/initgroups.c > =================================================================== > RCS file: /home/ncvs/src/lib/libc/gen/initgroups.c,v > retrieving revision 1.5 > diff -u -d -r1.5 initgroups.c > --- lib/libc/gen/initgroups.c 28 Nov 2001 10:55:02 -0000 1.5 > +++ lib/libc/gen/initgroups.c 14 Dec 2001 15:30:10 -0000 > @@ -31,14 +31,12 @@ > * SUCH DAMAGE. > */ > > +#include > +__FBSDID("$FreeBSD$"); > + > #if defined(LIBC_SCCS) && !defined(lint) > -#if 0 > static char sccsid[] = "@(#)initgroups.c 8.1 (Berkeley) 6/4/93"; > -#else > -static const char rcsid[] = > - "$FreeBSD: src/lib/libc/gen/initgroups.c,v 1.5 2001/11/28 10:55:02 tobez Exp $"; > #endif > -#endif /* LIBC_SCCS and not lint */ > > #include > > @@ -51,7 +49,7 @@ > int > initgroups(uname, agroup) > const char *uname; > - int agroup; > + gid_t agroup; > { > int groups[NGROUPS], ngroups; > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-audit" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Jan 19 14:54:34 2002 Delivered-To: freebsd-audit@freebsd.org Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.139.170]) by hub.freebsd.org (Postfix) with ESMTP id 581E637B417; Sat, 19 Jan 2002 14:54:25 -0800 (PST) Received: (from uucp@localhost) by storm.FreeBSD.org.uk (8.11.6/8.11.6) with UUCP id g0JMsNg29593; Sat, 19 Jan 2002 22:54:23 GMT (envelope-from mark@grondar.za) Received: from grondar.za (mark@localhost [127.0.0.1]) by grimreaper.grondar.org (8.11.6/8.11.6) with ESMTP id g0JMstt24818; Sat, 19 Jan 2002 22:54:55 GMT (envelope-from mark@grondar.za) Message-Id: <200201192254.g0JMstt24818@grimreaper.grondar.org> To: Robert Watson Cc: audit@freebsd.org Subject: Re: Fixes for gid_t usage in libc References: In-Reply-To: ; from Robert Watson "Sat, 19 Jan 2002 17:20:58 EST." Date: Sat, 19 Jan 2002 22:54:55 +0000 From: Mark Murray Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > It's worth pointing out that there's a PR open on the uid_t/gid_t problem > in the System V IPC interfaces; however, unlike in this situation, that > case has a binary compatibility problem since the interfaces currently use > 16-bit types :-(. We'll need to hack in binary compatibility for that, > and also handle the linuxlator properly. However, these changes look > generally good to me -- does this bring us closer or further from any > standards compliance? I have no standards documents to check this against, so I have no idea. :-( I'm (slowly) doing a grep-a-thon looking for old (int) usage. M > Robert N M Watson FreeBSD Core Team, TrustedBSD Project > robert@fledge.watson.org NAI Labs, Safeport Network Services > > On Thu, 17 Jan 2002, Mark Murray wrote: > > > Hi > > > > Reviews please? > > > > This fixes some places where groups are handled in integers > > rather than gid_t's. > > > > I've been running it for more than a month. > > > > M > > > > Index: include/grp.h > > =================================================================== > > RCS file: /home/ncvs/src/include/grp.h,v > > retrieving revision 1.3 > > diff -u -d -r1.3 grp.h > > --- include/grp.h 7 May 1997 19:59:59 -0000 1.3 > > +++ include/grp.h 7 Dec 2001 20:48:47 -0000 > > @@ -48,7 +48,7 @@ > > struct group { > > char *gr_name; /* group name */ > > char *gr_passwd; /* group password */ > > - int gr_gid; /* group id */ > > + gid_t gr_gid; /* group id */ > > char **gr_mem; /* group members */ > > }; > > > > Index: include/unistd.h > > =================================================================== > > RCS file: /home/ncvs/src/include/unistd.h,v > > retrieving revision 1.46 > > diff -u -d -r1.46 unistd.h > > --- include/unistd.h 22 Dec 2001 05:18:37 -0000 1.46 > > +++ include/unistd.h 22 Dec 2001 14:23:04 -0000 > > @@ -140,7 +140,7 @@ > > #endif > > int getdomainname __P((char *, int)); > > 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)); > > int gethostname __P((char *, int)); > > int getlogin_r __P((char *, int)); > > @@ -154,7 +154,7 @@ > > int getsid __P((pid_t _pid)); > > char *getusershell __P((void)); > > 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_sa __P((const void *, int, int, const char *, const char *)); > > int issetugid __P((void)); > > Index: lib/libc/gen/getgrent.3 > > =================================================================== > > RCS file: /home/ncvs/src/lib/libc/gen/getgrent.3,v > > retrieving revision 1.17 > > diff -u -d -r1.17 getgrent.3 > > --- lib/libc/gen/getgrent.3 14 Jan 2002 16:59:00 -0000 1.17 > > +++ lib/libc/gen/getgrent.3 15 Jan 2002 18:55:26 -0000 > > @@ -78,7 +78,7 @@ > > struct group { > > char *gr_name; /* group name */ > > char *gr_passwd; /* group password */ > > - int gr_gid; /* group id */ > > + gid_t gr_gid; /* group id */ > > char **gr_mem; /* group members */ > > }; > > .Ed > > Index: lib/libc/gen/getgrouplist.3 > > =================================================================== > > RCS file: /home/ncvs/src/lib/libc/gen/getgrouplist.3,v > > retrieving revision 1.7 > > diff -u -d -r1.7 getgrouplist.3 > > --- lib/libc/gen/getgrouplist.3 1 Oct 2001 16:08:51 -0000 1.7 > > +++ lib/libc/gen/getgrouplist.3 14 Dec 2001 15:21:22 -0000 > > @@ -43,7 +43,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 > > @@ -56,7 +56,7 @@ > > Typically this value is given as > > the group number from the password file. > > .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 . > > The caller specifies the size of the > > .Fa groups > > Index: lib/libc/gen/getgrouplist.c > > =================================================================== > > RCS file: /home/ncvs/src/lib/libc/gen/getgrouplist.c,v > > retrieving revision 1.7 > > diff -u -d -r1.7 getgrouplist.c > > --- lib/libc/gen/getgrouplist.c 12 Mar 1997 14:54:22 -0000 1.7 > > +++ lib/libc/gen/getgrouplist.c 14 Dec 2001 15:29:19 -0000 > > @@ -31,9 +31,12 @@ > > * SUCH DAMAGE. > > */ > > > > +#include > > +__FBSDID("$FreeBSD$"); > > + > > #if defined(LIBC_SCCS) && !defined(lint) > > static char sccsid[] = "@(#)getgrouplist.c 8.2 (Berkeley) 12/8/94"; > > -#endif /* LIBC_SCCS and not lint */ > > +#endif > > > > /* > > * get credential > > @@ -45,12 +48,12 @@ > > int > > getgrouplist(uname, agroup, groups, grpcnt) > > const char *uname; > > - int agroup; > > - register int *groups; > > + gid_t agroup; > > + gid_t *groups; > > int *grpcnt; > > { > > - register struct group *grp; > > - register int i, ngroups; > > + struct group *grp; > > + int i, ngroups; > > int ret, maxgroups; > > > > ret = 0; > > Index: lib/libc/gen/initgroups.3 > > =================================================================== > > RCS file: /home/ncvs/src/lib/libc/gen/initgroups.3,v > > retrieving revision 1.11 > > diff -u -d -r1.11 initgroups.3 > > --- lib/libc/gen/initgroups.3 28 Nov 2001 10:55:02 -0000 1.11 > > +++ lib/libc/gen/initgroups.3 14 Dec 2001 15:18:14 -0000 > > @@ -43,7 +43,7 @@ > > .Sh SYNOPSIS > > .In unistd.h > > .Ft int > > -.Fn initgroups "const char *name" "int basegid" > > +.Fn initgroups "const char *name" "gid_t basegid" > > .Sh DESCRIPTION > > The > > .Fn initgroups > > Index: lib/libc/gen/initgroups.c > > =================================================================== > > RCS file: /home/ncvs/src/lib/libc/gen/initgroups.c,v > > retrieving revision 1.5 > > diff -u -d -r1.5 initgroups.c > > --- lib/libc/gen/initgroups.c 28 Nov 2001 10:55:02 -0000 1.5 > > +++ lib/libc/gen/initgroups.c 14 Dec 2001 15:30:10 -0000 > > @@ -31,14 +31,12 @@ > > * SUCH DAMAGE. > > */ > > > > +#include > > +__FBSDID("$FreeBSD$"); > > + > > #if defined(LIBC_SCCS) && !defined(lint) > > -#if 0 > > static char sccsid[] = "@(#)initgroups.c 8.1 (Berkeley) 6/4/93"; > > -#else > > -static const char rcsid[] = > > - "$FreeBSD: src/lib/libc/gen/initgroups.c,v 1.5 2001/11/28 10:55:02 tobez Exp $"; > > #endif > > -#endif /* LIBC_SCCS and not lint */ > > > > #include > > > > @@ -51,7 +49,7 @@ > > int > > initgroups(uname, agroup) > > const char *uname; > > - int agroup; > > + gid_t agroup; > > { > > int groups[NGROUPS], ngroups; > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > > with "unsubscribe freebsd-audit" in the body of the message > > > -- o Mark Murray \_ FreeBSD Services Limited O.\_ Warning: this .sig is umop ap!sdn To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message From owner-freebsd-audit Sat Jan 19 15:36:20 2002 Delivered-To: freebsd-audit@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id 7BD8537B400; Sat, 19 Jan 2002 15:36:18 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id g0JNWRk96174; Sat, 19 Jan 2002 18:32:27 -0500 (EST) (envelope-from mike) Date: Sat, 19 Jan 2002 18:32:27 -0500 From: Mike Barcroft To: Robert Watson Cc: Mark Murray , audit@freebsd.org Subject: Re: Fixes for gid_t usage in libc Message-ID: <20020119183227.B68881@espresso.q9media.com> References: <200201172200.g0HM0St19717@grimreaper.grondar.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ; from rwatson@freebsd.org on Sat, Jan 19, 2002 at 05:20:58PM -0500 Organization: The FreeBSD Project Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Robert Watson writes: > It's worth pointing out that there's a PR open on the uid_t/gid_t problem > in the System V IPC interfaces; however, unlike in this situation, that > case has a binary compatibility problem since the interfaces currently use > 16-bit types :-(. We'll need to hack in binary compatibility for that, > and also handle the linuxlator properly. However, these changes look > generally good to me -- does this bring us closer or further from any > standards compliance? I think the only change that is applicable to any standards is the one in , which does bring us closer to conformance. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message