Date: Sat, 21 Dec 1996 14:36:50 +1100 From: davidn@sdev.usn.blaze.net.au (David Nugent) To: wosch@cs.tu-berlin.de (Wolfram Schneider) Cc: current@freebsd.org, wpaul@frebsd.org.cs.tu-berlin.de Subject: Re: group(5) limits Message-ID: <Mutt.19961221143650.davidn@sdev.blaze.net.au> In-Reply-To: <199612170124.CAA02231@campa.panke.de>; from Wolfram Schneider on Dec 17, 1996 02:24:34 %2B0100 References: <199612170124.CAA02231@campa.panke.de>
next in thread | previous in thread | raw e-mail | index | archive | help
Wolfram Schneider writes:
> The current limit is 200 members per group or maximum 1024 character per
> line. I changed getgrent(3) to use dynamic allocated buffers
> instead static buffers. No member or line length limit anymore -
> now 500 members or 5000 members are possible.
Good (although it causes me some work too :-)). This was on my
todo list.
It would be nice if this supported line continuation as well,
which I believe is already supported by NIS (at least in the
netgroups file). Keeping lines below 1024 characters is kinder
on manual management too.
> @@ -207,6 +230,9 @@
> if (_gr_fp) {
> (void)fclose(_gr_fp);
> _gr_fp = NULL;
> + free(line);
> + free(members);
> + maxlinelength = maxgrp = 0;
> }
> }
After a brief glance (ie. nothing in depth and no testing), this
however is broken. You can't deallocate that memory - it has
to hang around because getgrnam() and getgruid() return group
record with pointers to it AFTER calling endgrent().
Try running your code with /etc/malloc.conf -> AJ and using getgrent().
I fixed a similar bug in getttyent() a week ago. With these malloc
options, getttynam() always returned junk, and without the usual
side-effects when someone allocated/reused the freed block would
appear.
I'd suggest just leaving these three lines out. Subsequent calls
to gr_start() will reuse the memory anyway and add a little to
efficiency. Having the static array in spite of its limitations
avoided this.
BTW, is this a 2.2 candidate?
Regards,
David Nugent - Unique Computing Pty Ltd - Melbourne, Australia
Voice +61-3-9791-9547 Data/BBS +61-3-9792-3507 3:632/348@fidonet
davidn@freefall.org davidn@blaze.net.au http://www.blaze.net.au/~davidn/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Mutt.19961221143650.davidn>
