[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: /etc/group
From:       Bill Paul <wpaul () skynet ! ctr ! columbia ! edu>
Date:       1996-07-31 20:52:46
[Download RAW message or body]

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."
=============================================================================

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic