Project

General

Profile

Bug #1166

useradd warns on names with more than 8 chars

Added by Igor Kozhukhov over 9 years ago. Updated about 7 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2011-06-30
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

useradd have warning with name more 8 chars
--------------
for example:
  1. useradd test567890
    UX: useradd: test567890 name too long.
  1. cat /etc/passwd | grep test
    test567890:x:1002:1::/home/test567890:/bin/sh
    --------------

the same problem with groupadd

#1

Updated by Alexander Eremin over 9 years ago

8 chars is POSIX standard (POSIX_LOGIN_NAME_MAX in
http://www.opengroup.org/onlinepubs/007908799/xsh/limits.h.html)

#2

Updated by Richard PALO over 9 years ago

from the comments in <limits.h>

LOGIN_NAME_MAX
    Maximum length of a login name. _Minimum_ Acceptable Value: _POSIX_LOGIN_NAME_MAX 

btw, this is changing apparently in Solaris 11,
http://opensolaris.org/jive/thread.jspa?messageID=510139&#510139

#3

Updated by Gary Mills over 7 years ago

  • Status changed from New to Feedback
  • Assignee set to Gary Mills
  • % Done changed from 0 to 80

I've modified this command so that it no longer issues a warning at 8 characters. Instead, it fails if the login name is longer than 32 characters:

# usr/src/cmd/oamuser/user/useradd aaaabbbbccccdddd
# usr/src/cmd/oamuser/user/useradd aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb
# usr/src/cmd/oamuser/user/useradd aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbcccccccccccccccc
UX: usr/src/cmd/oamuser/user/useradd: ERROR: aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbcccccccccccccccc is too long.  Choose another.

We can't change LOGNAME_MAX because it's mandated by POSIX to have a value of 8 . We can, however, substitute LOGNAME_MAX_ILLUMOS, with value 32, in the affected source files. We can also define LOGIN_NAME_MAX, which is the buffer size including the terminating NUL character, as long as its value is larger than 9 . I've defined it to be LOGNAME_MAX_ILLUMOS + 1 for these source changes.

#4

Updated by Robert Mustacchi about 7 years ago

  • Subject changed from useradd have warning with name more 8 chars to useradd warns on names with more than 8 chars
#5

Updated by Robert Mustacchi about 7 years ago

  • Category set to cmd - userland programs
  • Status changed from Feedback to Resolved
  • % Done changed from 80 to 100
  • Tags deleted (needs-triage)

Resolved in 0a1278f26ea4b7c8c0285d4f2d6c5b680904aa01.

Also available in: Atom PDF