Bug #2989
LOGNAME_MAX should be increased to 32
100%
Description
The current username length limit of 8 is extremely restrictive and will hopefully change in the future. To ease a future transition, applications using the LOGNAME_MAX constant to determine buffer sizes should be migrated to the dynamic value returned by sysconf(_SC_LOGIN_NAME_MAX). A quick search shows there are still several such consumers in ON.
(See discussion on long user names for PSARC/2010/184 here: http://arc.opensolaris.org/caselog/PSARC/2010/184/mail or here http://mail.opensolaris.org/pipermail/opensolaris-arc/2010-May/thread.html#21475 )
Files
Updated by Gary Mills almost 8 years ago
- Assignee set to Gary Mills
- % Done changed from 0 to 80
#define LOGNAME_MAX_ILLUMOS 32 /* max # of characters in an */
/* illumos login name */
#define LOGIN_NAME_MAX (LOGNAME_MAX_ILLUMOS + 1) /* max buffer size */
Many of the commands affected display output from either the process table or the utmpx/wtmpx files. In modifying the source files, I followed these principles:
- No change in output format if login names are limited to 8 characters
- Display long names in full wherever possible
- Retain 80-column format for curses output
- Add a truncation indicator when long names are truncated
Updated by Gary Mills almost 8 years ago
I've now dropped the LOGNAME_MAX_ILLUMOS symbol and instead increased LOGNAME_MAX from 8 to 32. This change means that most applications can just be recompiled without need for a source change. Other changes are intended to accomodate legacy applications. I've added a `-W' flag to `prstat' and `ps' which forces truncation of long login names. Like `prstat', the `ps' command now has a trailing asterisk to indicate that a long name has been truncated. I've also added an adjustable action so that `useradd' can issue a warning or an error when the login name exceeds the legacy value of 8 characters. Finally, I've created a preload library for getlogin(3C) that will truncate long login names. This intended for old executables that cannot handle longer names.
Updated by Gary Mills over 7 years ago
I've made a few more changes in the 4th revision. First of all, there are two versions of the getlogin functions. These are selected by the redefine_extname pragma in unistd.h . Old executables get the ones that truncate login names to 8 characters. Newly-built executables get the versions that return full 32-character login names.
The getlogin8.so.1 preload library has been removed, as it's no longer needed. A new preload library, getloginx.so.1, acts as a shim so that old executables can call getlogin() but get the full 32-character login name.
There's a new symbol, USE_LEGACY_LOGNAME, that does the opposite, permitting new executables to be built that get versions of the getlogin functions that truncate login names to 8 characters.
Man pages are updated to describe these changed features.
I've attached a file, tests.txt, that contains results of all of the tests that I've performed to verify that long login names actually worked as intended.
Updated by Andrew Stormont over 7 years ago
Are you saying that _SC_LOGIN_NAME_MAX can never be more than 32 characters long because that's the max supported by utmpx? If that's true is _SC_LOGIN_NAME_MAX enforcing this?
Updated by Gary Mills over 7 years ago
Yes, that's correct. It's a result of the changes to sysconf.c and limits.h . With the changes, the value of LOGNAME_MAX is defined to be 32. See the webrev at:
http://cr.illumos.org/~webrev/jgmills/2989-4/
for details.
Updated by Gary Mills over 7 years ago
- File 2989-5.patch.Z 2989-5.patch.Z added
I've attached a git-style patch named 2989-5.patch.Z to this bug report. This patch is built against illumos-gate from 7 August 2013. I only had to relocate two copyright lines to build it.
Updated by Gary Mills over 7 years ago
- Status changed from New to In Progress
- % Done changed from 90 to 100
Updated by Gary Mills over 7 years ago
Those URLs for PSARC/2010/184 no longer work, but you can find the discussion here:
Updated by Robert Mustacchi over 7 years ago
- Subject changed from Eliminate use of LOGNAME_MAX in ON to want support for more than 8 character logins
Updated by Robert Mustacchi over 7 years ago
- Subject changed from want support for more than 8 character logins to LOGNAME_MAX should be increased to 32
Updated by Robert Mustacchi over 7 years ago
- Status changed from In Progress to Resolved
- Difficulty changed from Bite-size to Medium
- Tags deleted (
needs-triage)
Resolved in 0a1278f26ea4b7c8c0285d4f2d6c5b680904aa01.