diff options
author | 2002-01-28 16:37:35 +0000 | |
---|---|---|
committer | 2002-01-28 16:37:35 +0000 | |
commit | c0fc19294771e6372fd763e930bf81f33ee01330 (patch) | |
tree | 1032c9f37914aa8d026b0ff3c78b27872dda4cae /adduser/adduser.perl | |
parent | 4df4262c0c47ca5c5c853a690a3d5214871c2024 (diff) | |
download | pw-darwin-c0fc19294771e6372fd763e930bf81f33ee01330.tar.gz pw-darwin-c0fc19294771e6372fd763e930bf81f33ee01330.tar.zst pw-darwin-c0fc19294771e6372fd763e930bf81f33ee01330.zip |
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 'adduser/adduser.perl')
-rw-r--r-- | adduser/adduser.perl | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/adduser/adduser.perl b/adduser/adduser.perl index defebe0..cf3ce05 100644 --- a/adduser/adduser.perl +++ b/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 } |