Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 431750 - sys-apps/shadow - allow upper case in account names
Summary: sys-apps/shadow - allow upper case in account names
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2012-08-17 14:52 UTC by BlackCore
Modified: 2012-08-27 10:19 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to allow user to create a username with UpperCase. (uppercase_portage.patch,452 bytes, patch)
2012-08-17 14:53 UTC, BlackCore
Details | Diff
Patch to add my patch to shadow-4.1.4.3 (shadow-4.1.4.3-uppercase-in-usernames.patch,871 bytes, patch)
2012-08-17 14:54 UTC, BlackCore
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description BlackCore 2012-08-17 14:52:10 UTC
I need to create accounts whose usernames contain uppercase characters (example : 
UpperCasedName).

useradd UpperCasedName tells me : useradd: invalid user name 'UpperCasedName'
I can change it 'by hand' in the password file. But not easy to script, and sounds dangerous :-P

Reproducible: Always
Steps to Reproduce:
1. useradd UpperCasedName

Actual Results:  
invalid user name 'UpperCasedName'

And the system refuses to create the account

Expected Results:  
It should have created the account.

Similar to bug #22920
Comment 1 BlackCore 2012-08-17 14:53:56 UTC
Created attachment 321566 [details, diff]
Patch to allow user to create a username with UpperCase.


Patch allows users to create a username with UpperCase.
Comment 2 BlackCore 2012-08-17 14:54:59 UTC
Created attachment 321568 [details, diff]
Patch to add my patch to shadow-4.1.4.3

This adds an extra two lines to the ebuild so that the
shadow-4.0.3-chkname.patch to be used.
Comment 3 BlackCore 2012-08-17 14:58:16 UTC
Whoops, mistook the descriptions.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2012-08-17 15:45:15 UTC
PASSWD(5):

              account:password:UID:GID:GECOS:directory:shell

       The field are as follows:

       account     the name of the user on the system.  It should not contain
                   capital letters.

I suppose you could ask Linus.
Comment 5 Jeroen Roovers (RETIRED) gentoo-dev 2012-08-17 15:46:39 UTC
The workaround for the problem you are trying to solve might be to use (part of) GECOS.
Comment 6 BlackCore 2012-08-17 16:08:45 UTC
I've migrated from mandriva 2010, and the passwd file was created with it.
After migrating, i couldn't even delete the users without editing the file itself.
Is this the normal behavior?
Also, in FreeBSD man 5 passwd login isn't restricted at all.
Comment 7 BlackCore 2012-08-17 16:22:13 UTC
(In reply to comment #6)
> I've migrated from mandriva 2010, and the passwd file was created with it.
> After migrating, i couldn't even delete the users without editing the file
> itself.
> Is this the normal behavior?
> Also, in FreeBSD man 5 passwd login isn't restricted at all.

As a proof, here is this short log:
[root@BatMan ~]$ useradd TeSt.USeR\$
[root@BatMan ~]$ tail -n1 /etc/passwd
TeSt.USeR$:x:10004:10005::/home/TeSt.USeR$:/bin/bash
[root@BatMan ~]$ cat /etc/release
Mandriva Linux release 2010.0 (Official) for x86_64
[root@BatMan ~]$ uname -a
Linux BatMan.XNet 2.6.38.1-1 #2 SMP Tue Mar 29 14:14:09 MSD 2011 x86_64 Intel(R) Atom(TM) CPU D510 @ 1.66GHz GNU/Linux
Comment 8 SpanKY gentoo-dev 2012-08-17 17:09:06 UTC
that we've been running for more than a decade and no one has asked for this functionality is a bit telling

you could submit your patch here if you like:
http://pkg-shadow.alioth.debian.org/getinvolved.php

while i can't see the bother of adding new users with upper case letters, i tend to agree that the delete code paths should be more tolerant of garbage.  if it's in the passwd file (and even if it contains invalid characters), it'd probably be a good thing if the deluser code path could clean up.
Comment 9 BlackCore 2012-08-17 17:36:03 UTC
If it works flawlessly, why not make it at least optional?Like via USE flags...
Or, if needed, we could notify the upstream to add this functionality globally.
Comment 10 SpanKY gentoo-dev 2012-08-17 19:26:03 UTC
(In reply to comment #9)

because it's less effort to not maintain a patch.  you're the first to ask for this which means most people don't care or have their own system.

i added a call to epatch_user so you can keep that patch in /etc/portage/patches/ and have it applied automatically.
Comment 11 BlackCore 2012-08-18 11:55:22 UTC
As a final note, manpages in BSD and the shadow itself(in the source, ./man/passwd.5.xml) say that login name is not restricted.
Therefore, Jeroen Roovers was wrong in comment #4.
Going to notify the upstream.
Comment 12 Nyxis 2012-08-27 10:19:17 UTC
I need this feature too.

Author of this application, releases a patch for Debian. SVN here: http://anonscm.debian.org/viewvc/pkg-shadow/debian/tags/debian/4.1.5.1-1/debian/patches/506_relaxed_usernames?revision=3748&view=markup
It says "POSIX indicate that usernames are composed of characters from the portable filename character set [A-Za-z0-9._-], and that the hyphen should not be used as the first character of a portable user name."
Patch is well-maintained.
Many other distros use that patch. I tested FreeBSD6, FreeBSD8, Debian6 and RHEL6.
I can post proof, if you want.

Adding such a patch will not limit Gentoo compatibility, but improove it.