summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTobias Weingartner <weingart@cvs.openbsd.org>1998-09-22 01:40:31 +0000
committerTobias Weingartner <weingart@cvs.openbsd.org>1998-09-22 01:40:31 +0000
commitc759f76317f29418a840d0fe3225e1835175cd17 (patch)
treea92c4e0ce19a792801a23a43de470eca4ae6ea6e /usr.sbin
parent368cc025b7a8f5e8f3c775a87ca86e3cc23f2f80 (diff)
Add support for having UIDs past 32000. Changed the option -uid to
-uid_start, and added -uid_end to specify valid ranges to adduser. Manpage updated to relfect reality, plus a couple spelling errors.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/adduser/adduser.822
-rw-r--r--usr.sbin/adduser/adduser.perl26
2 files changed, 32 insertions, 16 deletions
diff --git a/usr.sbin/adduser/adduser.8 b/usr.sbin/adduser/adduser.8
index 3a1bd6297ff..ecce3dcc033 100644
--- a/usr.sbin/adduser/adduser.8
+++ b/usr.sbin/adduser/adduser.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: adduser.8,v 1.3 1998/08/29 21:11:15 deraadt Exp $
+.\" $OpenBSD: adduser.8,v 1.4 1998/09/22 01:40:30 weingart Exp $
.\"
.\" Copyright (c) 1995-1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
.\" All rights reserved.
@@ -39,7 +39,8 @@
[-check_only] [-config_create] [-dotdir dotdir]
[-e|-encrypt method] [-group login_group] [-h|-help]
[-home home] [-message message_file] [-noconfig]
- [-shell shell] [-s|-silent|-q|-quiet] [-uid uid_start]
+ [-shell shell] [-s|-silent|-q|-quiet]
+ [-uid_start uid_start] [-uid_end uid_end]
[-v|-verbose]
.Sh DESCRIPTION
@@ -75,9 +76,14 @@ is not permitted.
Only valid entries from the
.Xr shells 5
database or entries corresponding to sliplogin and pppd are permitted.
-.It Sy uid
-This value is automatically generated or assigned at the invoker's
-discretion; however, it must be less than 32000.
+.It Sy uid_start
+This value is the start of the range where free uid values are
+searched for. This value must be less than the value of uid_end.
+The default value is 1000 or as configured in the configuration file.
+.It Sy uid_end
+This value is the end of the range where free uid values are
+searched for. This value must be more than the value of uid_start.
+The default value is 32000 or as configured in the configuration file.
.It Sy gid/login group
This value is generated automatically, but it can be specified at the
discretion of the person invoking the program.
@@ -223,10 +229,10 @@ from /usr/share/skel to /home/falken. Send user falken
a welcome message.
.Pp
-$ adduser -uid 5000 -group guest -message no -batch vehlefanz
+$ adduser -uid_start 5000 -group guest -message no -batch vehlefanz
.Pp
-Create user 'vehlefanz' in login group guest. Uid is up to
-5000, for instance 5007. No other groups, no realname, no password.
+Create user 'vehlefanz' in login group guest. Start the free
+UID search at 5000. No other groups, no realname, no password.
Do not send a welcome message.
.Sh FILES
diff --git a/usr.sbin/adduser/adduser.perl b/usr.sbin/adduser/adduser.perl
index 08ac1e026fd..f80c8853797 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.9 1998/07/20 07:20:58 deraadt Exp $
+# $OpenBSD: adduser.perl,v 1.10 1998/09/22 01:40:30 weingart Exp $
#
# Copyright (c) 1995-1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
# All rights reserved.
@@ -45,6 +45,7 @@ if (!$check_only && $#batch < 0) {
# check
$changes = 0;
+&variable_check; # check for valid variables
&passwd_check; # check for valid passwdb
&shells_read; # read /etc/shells
&passwd_read; # read /etc/master.passwd
@@ -863,11 +864,12 @@ usage: adduser
[-noconfig]
[-shell shell]
[-s|-silent|-q|-quiet]
- [-uid uid_start]
+ [-uid_start uid_start]
+ [-uid_end uid_end]
[-v|-verbose]
home=$home shell=$defaultshell dotdir=$dotdir login_group=$defaultgroup
-message_file=$send_message uid_start=$uid_start
+message_file=$send_message uid_start=$uid_start uid_end=$uid_end
USAGE
exit 1;
}
@@ -947,9 +949,6 @@ sub hints {
if ($verbose) {
print "Use option ``-silent'' if you don't want see " .
"all warnings & questions.\n\n";
- } else {
- print "Use option ``-verbose'' if you want see more warnings & " .
- "questions \nor try to repair bugs.\n\n";
}
}
@@ -967,7 +966,8 @@ sub parse_arguments {
elsif (/^--?(home)$/) { $home = $argv[0]; shift @argv }
elsif (/^--?(shell)$/) { $defaultshell = $argv[0]; shift @argv }
elsif (/^--?(dotdir)$/) { $dotdir = $argv[0]; shift @argv }
- elsif (/^--?(uid)$/) { $uid_start = $argv[0]; shift @argv }
+ elsif (/^--?(uid_start)$/) { $uid_start = $argv[0]; shift @argv }
+ elsif (/^--?(uid_end)$/) { $uid_end = $argv[0]; shift @argv }
elsif (/^--?(group)$/) { $defaultgroup = $argv[0]; shift @argv }
elsif (/^--?(check_only)$/) { $check_only = 1 }
elsif (/^--?(message)$/) { $send_message = $argv[0]; shift @argv;
@@ -1442,7 +1442,7 @@ sub config_write {
print C <<EOF;
#
-# $OpenBSD: adduser.perl,v 1.9 1998/07/20 07:20:58 deraadt Exp $
+# $OpenBSD: adduser.perl,v 1.10 1998/09/22 01:40:30 weingart Exp $
# $config - automatic generated by adduser(8)
#
# Note: adduser read *and* write this file.
@@ -1492,6 +1492,7 @@ defaultgroup = $defaultgroup
# new users get this uid
uid_start = $uid_start
+uid_end = $uid_end
$do_not_delete
## your own variables, see /etc/adduser.message
@@ -1501,3 +1502,12 @@ EOF
close C;
}
+# check for sane variables
+sub variable_check {
+ local($abort) = 0;
+
+ # Check uid_start & uid_end
+ warn "WARNING: uid_start < 1000!\n" if($uid_start < 1000);
+ die "ERROR: uid_start >= uid_end!\n" if($uid_start >= $uid_end);
+}
+