From owner-freebsd-hackers Wed Jul 31 13:56:10 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id NAA25477 for hackers-outgoing; Wed, 31 Jul 1996 13:56:10 -0700 (PDT) Received: from skynet.ctr.columbia.edu (skynet.ctr.columbia.edu [128.59.64.70]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id NAA25426 for ; Wed, 31 Jul 1996 13:55:42 -0700 (PDT) Received: (from wpaul@localhost) by skynet.ctr.columbia.edu (8.6.12/8.6.9) id QAA19816; Wed, 31 Jul 1996 16:52:47 -0400 From: Bill Paul Message-Id: <199607312052.QAA19816@skynet.ctr.columbia.edu> Subject: Re: /etc/group To: peter@palin.cc.monash.edu.au (Peter Hawkins) Date: Wed, 31 Jul 1996 16:52:46 -0400 (EDT) Cc: hackers@freebsd.org In-Reply-To: <199607302339.JAA18594@palin.cc.monash.edu.au> from "Peter Hawkins" at Jul 31, 96 09:39:16 am X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Of all the gin joints in all the towns in all the world, Peter Hawkins had to walk into mine and say: > I understood that you could have multiple lines with the same > GID and group name. > Peter Show me the man page where it says that. Having slogged through the getgrent(3) code a few times, I feel fairly confident in saying that you're mistaken. There's a line limit of 1024 characters and a limit of 200 members per group. Both these limits are hard-coded (though they can be changed by modifying a coupld of #defines). Getgrent(3) has a static array of pointers to char * called 'members' which is only large enough to hold MAXGRP (200) pointers. The grscan() function reads the comma seeparated list of members from /etc/group, replaces the commas with NULs, then sets the pointers in the array to point at the first character of each member name. Each time grscan() reads a new line from /etc/group, it clobbers its input buffer so the old member list from the previous line is destroyed. The member array is also repopulated starting from the top again. There is therefore no way for two consecutive /etc/group entries to be combined (unless you hack the code to support it). Furthermore, if you use NIS/YP, you won't be able to create a second group entry with the same name/gid in the first place since the yp_mkdb(8) utility will reject records with duplicate keys. (NIS does not support the notion of having two entries in a map with the same key. NIS+ does in a twisted fashion, but that's beside the point.) You can't cascade group entries either. Only a user can be a member of a group. A group can not be a member of another group. You can cascade netgroups, but you can't do with netgroups all the things you can do with groups. -Bill -- ============================================================================= -Bill Paul (212) 854-6020 | System Manager, Master of Unix-Fu Work: wpaul@ctr.columbia.edu | Center for Telecommunications Research Home: wpaul@skynet.ctr.columbia.edu | Columbia University, New York City ============================================================================= "If you're ever in trouble, go to the CTR. Ask for Bill. He will help you." =============================================================================