misc/161091: Max username length is 16 characters
Stephane Lapie
darksoul at darkbsd.org
Wed Sep 28 06:50:04 UTC 2011
>Number: 161091
>Category: misc
>Synopsis: Max username length is 16 characters
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Wed Sep 28 06:50:03 UTC 2011
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:
More information about the freebsd-bugs
mailing list