Bug 56850 - Cannot insert groups with more than 16 caracteres
Summary: Cannot insert groups with more than 16 caracteres
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: shadow-utils
Version: 3.0
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Peter Vrabec
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks: 132991
TreeView+ depends on / blocked
 
Reported: 2001-11-28 19:43 UTC by Renato
Modified: 2007-11-30 22:06 UTC (History)
1 user (show)

Fixed In Version: 2:4.0.3-35
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-05-20 03:25:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Allow group names as long as user names instead of arbitrary 16 (567 bytes, patch)
2004-10-14 18:04 UTC, Gordon Rowell
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2005:164 0 normal SHIPPED_LIVE shadow-utils bug fix update 2005-05-19 04:00:00 UTC

Description Renato 2001-11-28 19:43:48 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)

Description of problem:
You can create a user with more than 16 caracteres but you cannot create a 
group.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Create a user
/usr/sbin/useradd -d /home/user userwithalotofcaracteres

id userwithalotofcaracteres
( user and group were created )
2.  Try to create a group
/usr/sbin/groupadd userwithalotofcaracteres2
 
Invalid group name !!


Actual Results:  Cannot create the group

Expected Results:  It should create the group, since by using useradd it 
could create.

Additional info:

I had a crash in the system, since I had a huge number of users in one 
group ( I checked and this bug is already reported ). It erased important 
information from /etc/group. Trying to recreate the groups by 
using /usr/sbin/groupadd, I could recreate some of them and I had to 
insert them manually.

Comment 1 Gordon Rowell 2004-10-14 17:23:48 UTC
I hit the same error. The relevant error looks to be this one:

Oct 13 11:55:47 pc5140 e-smith[3680]: groupadd: abc123abc-1-0-2-11 is 
a not a valid group name

I delved into shadow-utils and found this code in chkname.c:

int
check_group_name(const char *name)
{
        /*
         * Arbitrary limit for group names - max 16
         * characters (same as on HP-UX 10).
         */
        if (strlen(name) > 16)
                return 0;
[...]

Whereas the user code is:

int
check_user_name(const char *name)
{
#if HAVE_UTMPX_H
        struct utmpx ut;
#else
        struct utmp ut;
#endif

        /*
         * User names are limited by whatever utmp can
         * handle (usually max 8 characters).
         */
        if (strlen(name) > sizeof(ut.ut_user))
                return 0;

[...]

Where:

struct utmpx
{

...
  char ut_user[__UT_NAMESIZE];  /* Username.  */
...
};

and 

#define __UT_NAMESIZE   32

I don't see any reason for the arbitrary 16 - groups names
don't get logged to utmp in any case.

I suggest bumping it to sizeof(ut.ut_user) (i.e. 32). Patch to
follow after testing.


Comment 2 Gordon Rowell 2004-10-14 17:45:52 UTC
Note: The 16 character limit still appears in 
shadow-utils-4.0.3-15.src.rpm

Comment 3 Gordon Rowell 2004-10-14 18:04:18 UTC
Created attachment 105218 [details]
Allow group names as long as user names instead of arbitrary 16

Comment 4 Gordon Rowell 2004-10-14 18:05:21 UTC
Patch attached. This works nicely for me on RH7.3

Comment 6 Dennis Gregorovic 2005-05-20 03:25:50 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-164.html



Note You need to log in before you can comment on or make changes to this bug.