Bug 118371

Summary: manage username starting with digit 0 from Yast2
Product: [openSUSE] SUSE LINUX 10.0 Reporter: Roberto Vottero <roberto.vottero>
Component: YaST2Assignee: Jiří Suchomel <jsuchome>
Status: RESOLVED FIXED QA Contact: Adrian Schröter <adrian.schroeter>
Severity: Normal    
Priority: P5 - None CC: mvidner
Version: unspecified   
Target Milestone: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Roberto Vottero 2005-09-22 09:14:15 UTC
When you modify CHARACTER_CLASS in /etc/login.defs to allow username starting with  
number digit, strange behavior appen if username it start with digit 0.
If you add a username 012345 it works only first time when you create it (in the
Suse 9.2 it never works). When you reopen Yast->Security and Users->Edit and
Create users, your username 012345 is changed to 5349 (n.b. octal number 012345
is 5349 decimal), and if you change some properties username is changed in
/etc/passwd.
Comment 1 Martin Vidner 2005-09-22 09:40:26 UTC
Jirka, Roberto also wrote me that he was able to work around it by hacking 
ycp.pm: 
    elsif ($reftype eq "HASH") 
    { 
        print "\$["; 
        while (my ($key, $value) = each %$val) 
        { 
            Return ($key, $quote_everything); 
            print ":"; 
# just to test 
            if ($key eq "uid") { 
               print WriteYcpString($value); 
            } 
            else { 
               Return ($value, $quote_everything); 
            } 
            print ","; # trailing comma is allowed 
        } 
        print "] "; # no "]:" 
    } 
 
Comment 2 Jiří Suchomel 2005-09-22 15:37:47 UTC
Martin, the "conversion" (to octal number) is done on the way from agent (here
ag_passwd) to yast (Users.pm). It looks like I can't handle it from my code...
Comment 3 Jiří Suchomel 2005-09-22 15:48:59 UTC
short test shows that ycp::Return (\%myhash, 1); could work and yast2-users is
able to read all the data (including integers) correctly. However proper testing
would be necessary.
Comment 4 Roberto Vottero 2005-09-23 13:30:08 UTC
I agree with Jiri that problem is in ag_passwd; if I use ycp::Return(\%myhash,
1), the second parameter (1) tell to ycp::Return routine to handle every values
in the hash '%myhash' quoted as a string. File ag_passwd probably need to be
changed starting from line 646 (ycp::Return (\%{$users{"local"}}) ) adding the
second parameter to quote values almost for hashes users, shadow and groups
(local and system). We should verify if uidnumbers quoted (i.e. '12345') is a
problem to the modules that are using ag_passwd.
Comment 5 Jiří Suchomel 2005-09-29 14:42:07 UTC
done in yast2-pam-2.13.0