Re: Patch: netgrp can't handle splitted NIS groups

Thorsten Kukuk <[email protected]> Fri, 8 Jul 2005 12:11:44 +0200
Newsgroups gmane.linux.pld.shadow.general
Organization SuSE Linux Products GmbH, Nuernberg, Germany
Message-ID <[email protected]>
On Fri, Jul 08, Christian Mudra wrote:

> Hi,
> 
> today I found out, that newgrp doesn't handle splitted NIS groups correctly.
> I've checked several implementations of newgrp (shadow, util-linux and
> opensolaris), but didn't have success finding a 'good' one. It's interesting,
> that only the newgroup of AIX (I tested AIX-5.1) takes care of splitted NIS
> groups and handles them correctly.

This is not correct, there are other Implementations for Linux, which
also support this "hack" like pwdutils.

> Background: If a line in the NIS map 'group' will be larger than about
> 1018 bytes (some bytes less than 2^10), under some architectures/OS the
> resulting NIS map will be corrupt. 

The architectures/OS don't corrupt them. The NIS specification does not
allow data bigger then 1024 bytes.

> In large environments it's sometimes
> needed to have a couple of people (let's say 300++) in one NIS group.
> Because the group entry in the NIS map would become way too large,
> it must be split into several groups.
> 
> Given the users
> 
>    user1, user2, user3, user4
> 
> user1:*:1001:50000:....
> user2:*:1002:50000:....
> user3:*:1003:50000:....
> user4:*:1004:50000:....
> 
> in the groups
> 
> users:*:50000
> largegrp:*:59999:user1,user2
> largegrp_1:*:59999:user3,user4
> ...
> 
> The command
> 
>   newgrp largegrp
> 
> given by user3 fails.
> 
> The 'groups' command handles that case for the users 'user3' and 'user4'
> correctly, e.g. it shows, that the user 'user3' is in the groups
> 
>   users largegrp
> 
> (not in 'largegrp_1').

You are doing something with is outside of the defined behavior.
So the result is what you are doing: undefined.

  Thorsten

-- 
Thorsten Kukuk         http://www.suse.de/~kukuk/      [email protected]
SUSE LINUX Products GmbH       Maxfeldstr. 5       D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B