summaryrefslogtreecommitdiffstats
path: root/usr.sbin/adduser
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-05-13 01:23:10 +0000
committermillert <millert@openbsd.org>2003-05-13 01:23:10 +0000
commit6b22066caf62b601784f86bc632f4db428a2a48c (patch)
tree50cf7938151dcafe9ca81f8fbabf9d22cdc30000 /usr.sbin/adduser
parentDon't allow usernames to begin with a dash since pwd_mkdb(8) (diff)
downloadwireguard-openbsd-6b22066caf62b601784f86bc632f4db428a2a48c.tar.xz
wireguard-openbsd-6b22066caf62b601784f86bc632f4db428a2a48c.zip
Sync valid username check w/ user(1). Patch from Brian Poole,
problem reported by juncus on misc
Diffstat (limited to 'usr.sbin/adduser')
-rw-r--r--usr.sbin/adduser/adduser.88
-rw-r--r--usr.sbin/adduser/adduser.perl10
2 files changed, 10 insertions, 8 deletions
diff --git a/usr.sbin/adduser/adduser.8 b/usr.sbin/adduser/adduser.8
index 27f81a75b42..46d8a31e6a0 100644
--- a/usr.sbin/adduser/adduser.8
+++ b/usr.sbin/adduser/adduser.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: adduser.8,v 1.27 2003/01/29 16:53:36 jmc Exp $
+.\" $OpenBSD: adduser.8,v 1.28 2003/05/13 01:23:10 millert Exp $
.\"
.\" Copyright (c) 1995-1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
.\" All rights reserved.
@@ -216,8 +216,10 @@ politely refuses to remove users whose UID is 0 (typically root).
.Sh RESTRICTIONS
.Bl -tag -width Ds
.It Sy username
-Login names should contain only lowercase characters or digits.
-They should be no longer than 31 characters (see BUGS section of
+It is recommended that login names contain only lowercase characters
+and digits. They may also contain uppercase characters, non-leading
+hyphens, periods, and a trailing '$'.
+Login names may not be longer than 31 characters (see BUGS section of
.Xr setlogin 2 ) .
.\" The reasons for this limit are "Historical".
.\" Given that people have traditionally wanted to break this
diff --git a/usr.sbin/adduser/adduser.perl b/usr.sbin/adduser/adduser.perl
index 74c85ec2f3d..f50487136cd 100644
--- a/usr.sbin/adduser/adduser.perl
+++ b/usr.sbin/adduser/adduser.perl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# $OpenBSD: adduser.perl,v 1.41 2003/04/03 18:55:33 jmc Exp $
+# $OpenBSD: adduser.perl,v 1.42 2003/05/13 01:23:10 millert Exp $
#
# Copyright (c) 1995-1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
# All rights reserved.
@@ -89,7 +89,7 @@ sub variables {
$group = "/etc/group";
$pwd_mkdb = "pwd_mkdb -p"; # program for building passwd database
$encryptionmethod = "blowfish";
- $rcsid = '$OpenBSD: adduser.perl,v 1.41 2003/04/03 18:55:33 jmc Exp $';
+ $rcsid = '$OpenBSD: adduser.perl,v 1.42 2003/05/13 01:23:10 millert Exp $';
# List of directories where shells located
@path = ('/bin', '/usr/bin', '/usr/local/bin');
@@ -365,7 +365,7 @@ sub new_users_name {
local($name);
while(1) {
- $name = &confirm_list("Enter username", 1, "a-z0-9_-", "");
+ $name = &confirm_list("Enter username", 1, "", "");
if (length($name) > 31) {
warn "Username is longer than 31 characters\a\n";
next;
@@ -378,9 +378,9 @@ sub new_users_name {
sub new_users_name_valid {
local($name) = @_;
- if ($name !~ /^[a-z0-9_][a-z0-9_\-]*$/ || $name eq "a-z0-9_-") {
+ if ($name !~ /^[a-zA-Z0-9_\.][a-zA-Z0-9_\.\-]*\$?$/ || $name eq "") {
warn "Illegal username. " .
- "Please use only lowercase characters or digits\a\n";
+ "Please see the restrictions section of the man page.\a\n";
return 0;
} elsif ($username{$name}) {
warn "Username ``$name'' already exists!\a\n"; return 0;