Bug 43677

Summary: Bug in /usr/sbin/adduser
Product: Base System Reporter: p01nt3r <p01nt3r>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description p01nt3r 2002-10-05 00:50:01 UTC
      When requested to enter username second time(such as Enter username[test]: ) - It just print
a message "Please enter a username". And it's looped.

Fix: 

In the /usr/sbin/adduser program, in &new_users_name_valid
subprogram:
replace "if ($name eq $usernameregexp)
{ print "Please enter a username\a\n"; exit 0; }" to
"if ($name ne $usernameregexp)
{ print "Please enter a username\a\n"; exit 0; }"
How-To-Repeat: Just run the adduser, and add some user (test, for example).
After "Ok, Let's go!", when it requested "Enter username [test]:"
press the Enter, or type "test", and press the Enter.
Comment 1 Tom Hukins freebsd_committer freebsd_triage 2002-11-20 12:07:45 UTC
State Changed
From-To: open->closed

This is not a bug in adduser(8):  you are using the command incorrectly. 
If you see the line: 
"Enter username[test]:" 
you have entered "test" in response to the line: 
"Usernames must match regular expression:" 

Instead of typing "test" as a regular expression, hit return to accept 
the default, or enter ^[a-z0-9_][a-z0-9_-]*$ if your adduser.conf has 
been modified to use "test" as the default regular expression. 

The fix you supplied misunderstands how the command should work - you do 
not "enter username second time", you enter a regular expression that 
valid usernames must match first, then a username later on.