Subject: Re: Length limits on user names and group names?
To: Paul Hoffman <phoffman@proper.com>
From: Roger Brooks <R.S.Brooks@liverpool.ac.uk>
List: netbsd-help
Date: 03/04/2000 00:18:22
On Fri, 3 Mar 2000, Paul Hoffman wrote:

>How many characters are allowed in user names and group names? And where 
>could I have found this information in the man pages? :-)

I don't believe there is an actual limit on the length of user and group
names in /etc/passwd and /etc/group (or the corresponding NIS maps).
And all the implementations of get{pw|gr}xxx return pointers of
a buffer, so there's no problem there.

There is a restriction with [wu]tmp, which has a fixed field for the username
(UT_NAMESIZE, defined as 8 in utmp.h).  And sod knows how many programs
use fixed buffers of UT_NAMESIZE+1, and how many of those don't bother to
use strncpy!  So if you put longer usernames in /etc/passwd, at best they're
going to get truncated in some places and not others, and at worst you're
going to get buffer overruns all over the place.


Roger

------------------------------------------------------------------------------
Roger Brooks (Systems Programmer),          |  Email: R.S.Brooks@liv.ac.uk
Computing Services Dept,                    |  Tel:   +44 151 794 4441
The University of Liverpool,                |  Fax:   +44 151 794 4442
PO Box 147, Liverpool L69 3BX, UK           | 
------------------------------------------------------------------------------