diff options
author | yar <yar@FreeBSD.org> | 2002-01-28 16:37:35 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2002-01-28 16:37:35 +0000 |
commit | 35ba356060facb5287763fea13e8e16a3d3ddd76 (patch) | |
tree | e9100f06ff2cb3e14b0f65b1b6d2ac427361a3db /usr.sbin/adduser | |
parent | fd850072e807af92d7bbe6e9788ad1512ed52986 (diff) | |
download | FreeBSD-src-35ba356060facb5287763fea13e8e16a3d3ddd76.zip FreeBSD-src-35ba356060facb5287763fea13e8e16a3d3ddd76.tar.gz |
Remove the newly added -force option because it made adduser(8)
less robust to possible errors of the user/admin while adduser(8)
had been intended to minimize their possibility.
An alternative way of introducing strange symbols into usernames
to be committed really soon.
Diffstat (limited to 'usr.sbin/adduser')
-rw-r--r-- | usr.sbin/adduser/adduser.8 | 8 | ||||
-rw-r--r-- | usr.sbin/adduser/adduser.perl | 23 |
2 files changed, 2 insertions, 29 deletions
diff --git a/usr.sbin/adduser/adduser.8 b/usr.sbin/adduser/adduser.8 index 435d16c..71078a3 100644 --- a/usr.sbin/adduser/adduser.8 +++ b/usr.sbin/adduser/adduser.8 @@ -37,7 +37,6 @@ .Op Fl class Ar login_class .Op Fl config_create .Op Fl dotdir Ar dotdir -.Op Fl f | force .Op Fl group Ar login_group .Op Fl h | help .Op Fl home Ar home @@ -61,9 +60,6 @@ directory, dotfiles and sends the new user a welcome message. .It Sy username Login name. May contain only lowercase characters or digits. -(See also the -.Fl force -option.) Maximum length is 16 characters (see .Xr setlogin 2 @@ -158,10 +154,6 @@ to read/execute/write .Pa prv , .Pa iscreen , .Pa term . -.It Fl force , f -Add a user even if the username contains illegal characters. -Only semicolon or newline characters will be disallowed in -usernames to avoid breaking the password file format. .It Fl group Ar login_group Login group. .Ar USER diff --git a/usr.sbin/adduser/adduser.perl b/usr.sbin/adduser/adduser.perl index defebe0..cf3ce05 100644 --- a/usr.sbin/adduser/adduser.perl +++ b/usr.sbin/adduser/adduser.perl @@ -30,7 +30,6 @@ # read variables sub variables { $verbose = 1; # verbose = [0-2] - $force = 0; # relax username validity check if true $defaultusepassword = "yes"; # use password authentication for new users $defaultenableaccount = "yes"; # enable the account by default $defaultemptypassword = "no"; # don't create an empty password @@ -328,29 +327,13 @@ sub new_users_name { sub new_users_name_valid { local($name) = @_; - if ($force) { - if ($name eq "a-z0-9_-") { - warn "Please enter a username.\a\n"; - return 0; - } - if ($name =~ /[:\n]/) { - warn "Illegal username, which would break your passwd file.\a\n"; - return 0; - } - if ($name !~ /^[a-z0-9_][a-z0-9_\-]*$/) { - warn "Caution: Username contains illegal characters.\n" . - "Adding this user may cause utilities " . - "or applications to malfunction,\n" . - "or even impose a security risk on your system.\a\n"; - } - } elsif ($name !~ /^[a-z0-9_][a-z0-9_\-]*$/ || $name eq "a-z0-9_-") { + if ($name !~ /^[a-z0-9_][a-z0-9_\-]*$/ || $name eq "a-z0-9_-") { warn "Illegal username.\n" . "Please use only lowercase Roman, decimal, underscore, " . "or hyphen characters.\n" . "Additionally, a username should not start with a hyphen.\a\n"; return 0; - } - if ($username{$name}) { + } elsif ($username{$name}) { warn "Username ``$name'' already exists!\a\n"; return 0; } return 1; @@ -878,7 +861,6 @@ usage: adduser [-class login_class] [-config_create] [-dotdir dotdir] - [-f|-force] [-group login_group] [-h|-help] [-home home] @@ -952,7 +934,6 @@ sub parse_arguments { if (/^--?(v|verbose)$/) { $verbose = 1 } elsif (/^--?(s|silent|q|quiet)$/) { $verbose = 0 } elsif (/^--?(debug)$/) { $verbose = 2 } - elsif (/^--?(f|force)$/) { $force = 1 } elsif (/^--?(h|help|\?)$/) { &usage } elsif (/^--?(home)$/) { $home = $argv[0]; shift @argv } elsif (/^--?(shell)$/) { $defaultshell = $argv[0]; shift @argv } |