[Adduser-devel] Bug#283110: adduser won't add usernames containing dots

Jesús M. Navarro "Jesús M. Navarro" , 283110@bugs.debian.org
Fri, 26 Nov 2004 18:36:21 +0100


Hi, Michelle:

El Viernes, 26 Noviembre 2004 17:43, Michelle Konzack escribió:
> Am 2004-11-26 16:11:22, schrieb Jesús M. Navarro:
> > Still, useradd will gladly add these kind of usernames.  For all I
> > know,
> > usernames containing dots used to be POSIX illegal, but they are
> > illegal no
> > more.  chmod, for instance, will allow `chmod user:group whatever`
> > syntax (using colon instead of dot-separating old notation) just for
> > this very reason.
>
> Are you sure ?
> It works since POTATO...

Well, the example I sent you in my first message has been tested on two 
different boxes, both with current as 25/NOV/2004 Sarge packages.
[...]

> I have changed it since the first WOODY Release...

[...]


> # is name ok?
> sub checkname {
>     my ($name) = @_;
>     if ($allow_badname && $name !~ /^[A-Za-z_][-_.A-Za-z0-9]*\$?$/) {
> ------------------------------------------------------------------------
>                                                  ^
>                             There is a added point

I think you will have to recheck that.  Your change seems to have been lost 
somewhere along the way:

#!/usr/bin/perl
#
# adduser 3.59
#

[...]

# is name ok?
sub checkname {
    my ($name) = @_;
    if ($allow_badname && $name !~ /^[A-Za-z_][-_A-Za-z0-9]*\$?$/) {
                                                ^ See? No dot here
        print STDERR
"$0: ",_("To avoid problems, the username should consist of a letter or
underscore followed by letters, digits, underscores, and dashes. For
compatibility with Samba machine accounts \$ is also supported at the
end of the username\n");
        exit 1;
    }
    elsif ($name !~ /^[a-z][a-z0-9\-]*$/) {
        if (!$allow_badname) {
            print STDERR
"$0: ",_("Please enter a username consisting of a lower case letter
followed by lower case letters and numbers.  Use the `--force-badname'
option to allow underscores, and uppercase.\n");
            exit 1;
        }
        print _("Allowing use of questionable username.\n") if ($verbose);
    }
}

By the way, the last but one error message here should have to be changed to 
"...Use the '--force-badname' option to allow undercores, *dots* and 
uppercase.\n".

Thanks for your interest.