[Pkg-shadow-devel] [pkg-shadow-Bugs][311367] useradd not accepting multibyte UTF8 string (unable to create username in local language/script )

pkg-shadow-bugs at alioth.debian.org pkg-shadow-bugs at alioth.debian.org
Fri Jan 23 09:20:16 UTC 2009


Bugs item #311367, was opened at 2009-01-23 09:11
Status: Open
Priority: 3
Submitted By: Pravin Satpute (pravins-guest)
Assigned to: Nobody (None)
Summary:  useradd not accepting multibyte UTF8 string (unable to create username in local language/script ) 
Category: None
Group: None
Resolution: None


Initial Comment:
Description of problem:
useradd giving error while inputting name in local language Devanagari


Version-Release number of selected component (if applicable):
shadow-4.1.2

How reproducible:
everytime

Steps to Reproduce:
1.become root
2.try to add user using useradd command
3.input any user name in UTF 8 string, says प्रविण
4.it is giving error invalid username

Actual results:
we cant create user in our own script/language

Expected results:
it should be get accepted, person should able to create username in his own
script/language other than Latin, 


Additional info:

----------------------------------------------------------------------

Comment By: Pravin Satpute (pravins-guest)
Date: 2009-01-23 09:20

Message:
solution will be
for checking good name we suppose to convert UTF8 string to UTF16 and then check it using glibc CTYPE fuctions 
iswalpha(i), iswdigit(i) etc.
using that thing i think we can check good name for all unicode characters and can cover all available scripts for username

i am trying for that will submit patch soon
please let me know if any suggestions

----------------------------------------------------------------------

Comment By: Pravin Satpute (pravins-guest)
Date: 2009-01-23 09:16

Message:
the problem in present in good_name function its check for ascii characters

if (!*name || !((*name >= 'a' && *name <= 'z')
             || (*name >= 'A' && *name <= 'Z')
             || (*name >= '0' && *name <= '9')
             || *name == '_' || *name == '.'))
  return 0;

 while (*++name) {
  if (!(  (*name >= 'a' && *name <= 'z')
       || (*name >= 'A' && *name <= 'Z')
                     || (*name >= '0' && *name <= '9')
                     || *name == '_' || *name == '.' || *name == '-'
                     || (*name == '$' && *(name + 1) == '\0')))
   return 0;

but if we input U+0915, its UTF-8 =  E0 A4 95
since E0 it is not valid, 
useradd not adding username saying its invalid username



----------------------------------------------------------------------

You can respond by visiting: 
http://alioth.debian.org/tracker/?func=detail&atid=411478&aid=311367&group_id=30580



More information about the Pkg-shadow-devel mailing list