From nobody@FreeBSD.org  Wed Sep 28 06:42:30 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1C34E1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 28 Sep 2011 06:42:30 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id E6ED98FC13
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 28 Sep 2011 06:42:29 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p8S6gTiE015652
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 28 Sep 2011 06:42:29 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p8S6gTnV015651;
	Wed, 28 Sep 2011 06:42:29 GMT
	(envelope-from nobody)
Message-Id: <201109280642.p8S6gTnV015651@red.freebsd.org>
Date: Wed, 28 Sep 2011 06:42:29 GMT
From: Stephane Lapie <darksoul@darkbsd.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Max username length is 16 characters
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         161091
>Category:       kern
>Synopsis:       [includes] [patch] Max username length is 16 characters
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 28 06:50:03 UTC 2011
>Closed-Date:    Wed Nov 14 10:59:05 UTC 2012
>Last-Modified:  Wed Nov 14 10:59:05 UTC 2012
>Originator:     Stephane Lapie
>Release:        8.2-RELEASE
>Organization:
Aozora Bank
>Environment:
FreeBSD fcc4svnapf01.aozora.lan 8.2-RELEASE #1: Mon Jun 13 12:33:03 JST 2011    stephanelapie@fcc4svnapf02.aozora.lan:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
The system only allows usernames to be 16 characters (definitions of UT_NAMESIZE in include/utmp.h, and MAXLOGNAME in sys/sys/param.h), which turns out to be a problem in our company, where we make up administrator usernames in the form of <firstname><lastname>, which turns out quite often to require more than 16 characters.

It would be nice if the system was built to support up to 32 characters, like many other OSes do.
>How-To-Repeat:
Creation of users via adduser will fail if the username is more than 16 characters. Obviously, directly editing password database files does not work either, the system won't acknowledge usernames beyond 16 characters.
>Fix:
I wrote a quick patch to apply to the whole source tree, that modifies :
- /usr/src/include/utmp.h
- /usr/src/sys/sys/param.h
to bring up the login name max length to 32 characters (not including NUL)

At my company, we are building our own releases and our own packages from the ports, to ensure consistency. The above patch has been tested since FreeBSD 8.0-RELEASE, and releases/packages generated relying on it have been ran in production for two years now, with no issues detected.

Is there anything I missed, or any reasons for retaining the 16 character limitation?

Patch attached with submission follows:

--- ./include/utmp.h.old	2010-03-02 17:15:51.000000000 +0900
+++ ./include/utmp.h	2010-03-02 17:16:09.000000000 +0900
@@ -53,7 +53,7 @@
  * UT_HOSTSIZE is also too small to hold most common hostnames or IPv6
  * addresses.
  */
-#define	UT_NAMESIZE	16	/* see MAXLOGNAME in <sys/param.h> */
+#define	UT_NAMESIZE	32	/* see MAXLOGNAME in <sys/param.h> */
 #define	UT_LINESIZE	8
 #define	UT_HOSTSIZE	16
 
--- ./sys/sys/param.h.old	2010-03-02 17:17:18.000000000 +0900
+++ ./sys/sys/param.h	2010-03-02 17:17:36.000000000 +0900
@@ -75,7 +75,7 @@
 
 #define	MAXCOMLEN	19		/* max command name remembered */
 #define	MAXINTERP	32		/* max interpreter file name length */
-#define	MAXLOGNAME	17		/* max login name length (incl. NUL) */
+#define	MAXLOGNAME	33		/* max login name length (incl. NUL) */
 #define	MAXUPRC		CHILD_MAX	/* max simultaneous processes */
 #define	NCARGS		ARG_MAX		/* max bytes for an exec function */
 #define	NGROUPS		(NGROUPS_MAX+1)	/* max number groups */


>Release-Note:
>Audit-Trail:

From: Ed Schouten <ed@80386.nl>
To: bug-followup@FreeBSD.org, darksoul@darkbsd.org
Cc:  
Subject: Re: misc/161091: Max username length is 16 characters
Date: Wed, 28 Sep 2011 09:20:40 +0200

 --6J7GEvtanOfV9oXA
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Hi,
 
 Even though MAXLOGNAME is still 17 in FreeBSD 9.0, it must be noted that
 utmpx uses an ut_user field of size 32. So we're halfway there. ;-)
 
 --=20
  Ed Schouten <ed@80386.nl>
  WWW: http://80386.nl/
 
 --6J7GEvtanOfV9oXA
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (FreeBSD)
 
 iQIcBAEBAgAGBQJOgsrIAAoJEG5e2P40kaK70iIP/0/DEqCWfiOLFOXN1SrwaAHQ
 2FT0cin7H2R6TxzTEM+wNuo9Y8xTPgGWrEi1Rq1MTZ17Y1jEA1nvdbFFDDD8oCUa
 Feuh150tlTnWAkzH2BqrQB6c7cAyiSKUDRGJIykX6f4LFPALESnipK8ce44rSuC7
 u1kjmNcgOcsZTU2FAk+mA+hCWq+oZ/amEYTUVaQAoKf+p4dG8rffVDh/fuc6T2r2
 RBToN+8yqxCkSAPy3U+yf8KC52TtfaZRqNJjoeFY4hbwPsBtKmYBpflwLUURR22r
 ixlR6Skl07aQWyS73Q24VRxRIL1hKVy60WCDwIuTCkIq9HZmMWXmjqM8NT48ydUS
 hBAeaNwUYH31sxZm9uV7qjsVIhLD52f1jjfB32NsdURRXBsYdsmEmfOAusKj9r1a
 /vbGtc7rZCEQn/2Pz0F5SwzZepzBRH0mIgj7S7EJ2thKy+U6mgQfVBdMjlE/9RqP
 7z/k57CSTlb42vGkLWV5GNMXKUtrd02ZcbY1L6a1XaJda9XlsxY+mTD5USlJFtRP
 VETjTz4BT1bDcP3YekY+kjEh4E6PSgLccfujHiFmyVRp7p6F+HfVYzKY6INMVw7u
 6eSoECVUD1hHuVMNxtfs94hzx+IRWFkfMQMa7eL3WHf3gBsS2jLypAynw/JwLsXh
 rr7q9QBQfLp6vMhyot9l
 =LNz2
 -----END PGP SIGNATURE-----
 
 --6J7GEvtanOfV9oXA--
State-Changed-From-To: open->closed 
State-Changed-By: bapt 
State-Changed-When: Wed Nov 14 10:59:04 UTC 2012 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=161091 
>Unformatted:
