Commit graph

214 commits

Author SHA1 Message Date
Yaroslav Tykhiy 1b0805da95 Allow weird characters in usernames if an admin persists on that:
a) Convert all the remaining older Perl system() calls to the new,
   more secure LIST format so they are robust to whitespace and
   shell metacharacters in their arguments.
b) Add a new option: -force, which allows adding usernames containing
   characters that are otherwise illegal.

PR:		bin/22860 bin/31049
2002-01-02 18:54:40 +00:00
Yaroslav Tykhiy 9666534916 Be consistent in what restriction is imposed on a username
in the code and what the warning message reads.
2002-01-02 16:19:14 +00:00
Yaroslav Tykhiy ff1ebf7e7d Forbid adding duplicate users with the name of "0".
Previously, it was possible due to 0 and "0" being
equivalent in Perl.
2002-01-02 15:49:49 +00:00
Yaroslav Tykhiy 55a0e28451 Parse atq(1) output correctly under various (but not all perhaps)
locale settings: allow any date and time separator characters.
2002-01-02 15:35:33 +00:00
Yaroslav Tykhiy 0dd4be31b5 In remove_at_jobs():
Don't print "Removing at jobs" if there are no jobs to remove.
Add a whitespace before "done." so the output looks better.
2002-01-02 15:24:10 +00:00
Dima Dorfman 6680d16d19 Print the correct filename if we fail to open $etc_passwd.
Submitted by:	Brian Poole <raj@cerias.purdue.edu>
2001-09-06 12:21:21 +00:00
Dima Dorfman e3d0beed03 Pass the username we just made to pwd_mkdb so that the latter doesn't
have to regenerate the entire database.

PR:		25798
Submitted by:	Domas Mituzas <domas.mituzas@delfi.lt>
2001-08-20 01:20:05 +00:00
Ruslan Ermilov 753d686d34 mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
Guy Helmer 3b62c20eda Add "use Fcntl" to resolve O_RDWR|O_CREAT|O_EXCL macros used in
new sysopen call.

PR:		29366 (in part)
2001-08-01 16:32:36 +00:00
Guy Helmer 80b9c37313 Install the new password file with pwd_mkdb, not the old one.
PR:		29366 (in part)
2001-08-01 15:27:39 +00:00
Guy Helmer 15bfd2c9b9 The variable giving the name of the temporary password file was
inconsistently named "ptmp" and "etc_ptmp".  This commit changes
it to "passwd_tmp" for consistency and to match OpenBSD's name
for the variable.

Consulted with: jedgar
2001-07-30 16:23:56 +00:00
Chris D. Faulhaber eea11e0277 Use a safer method of creating the temporary password file.
Submitted by:	dynamo@harvard.net
Obtained from:	OpenBSD
MFC after:	3 days
2001-07-25 11:55:33 +00:00
Guy Helmer ffbd2b9e9d Fix removal of at jobs.
PR:		bin/23052
Submitted by:	Mike Sellenschuetter <mike.sellenschuetter@bankofamerica.com>
MFC after:	1 week
2001-07-23 18:25:45 +00:00
Dima Dorfman 35904a3be8 Generate a bigger salt. This is necessary for blowfish to work
properly, and doesn't hurt the other algorithms.

PR:		28991
Submitted by:	Yoshihiro Koya <Yoshihiro.Koya@math.yokohama-cu.ac.jp>
2001-07-19 12:00:04 +00:00
Dima Dorfman f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Ruslan Ermilov a4c37c816b mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 15:12:08 +00:00
Adrian Chadd 127826924a Fix the rmuser script to correctly determine if a user does not exist.
PR: 26674
2001-05-02 13:30:42 +00:00
Adrian Chadd aa96491de1 Extend adduser to create "locked" accounts. Adduser can now lock an
account at creation, create accounts with a "*" password (so you can
use alternate authentication schemes without fearing a "default" password
biting you later), and blank passwords.

Yes, adduser could create a blank password account, but this makes it
slightly more difficult to shoot yourself in the foot.

The /etc/adduser.conf entries are:

# use password-based authentication for new users
# defaultusepassword =  "yes" | "no"
defaultusepassword = "yes"

# enable account password at creation
# (the password will be prepended with a star if the account isn't enabled)
# defaultenableaccount = "yes" | "no"
defaultenableaccount = "yes"

# allow blank passwords
# defaultemptypassword = "yes" | "no"
defaultemptypassword = "no"

Requested by: alfred
Reviewed by: alfred
2001-05-02 13:20:12 +00:00
Doug Barton 555dff94cc By popular demand, have adduser preserve comments at the top of the
group file. Because of the way the group sorting works while printing
out the new file it's not possible at this time to restore comments
in other locations, but at least they won't just disappear altogether.
2001-04-17 09:42:07 +00:00
Doug Barton cf6490c9c7 Add a more useful solution to the problem of password files with more than
one user who differs only by case. The other perl tools assume (or enforce)
the all lowercase requirement, therefore making the search through
master.passwd case insensitive seemed a reasonable optimization, IMO.

I understand, although I do not sympathize with, the argument that someone
might want to do this on purpose, and might subsequently want to use the
wrong tool for the job. So, this fix should hopefully satisfy both camps.
2001-04-15 20:43:49 +00:00
David E. O'Brien 5efcb24b76 Rev 1.11 introduced a bug where the processing became case insensative for
username to rm.

PR:		25961
Submitted by:	Linh Pham <lplist@closedsrc.org>
2001-04-15 20:01:02 +00:00
Ruslan Ermilov b9ad8c8635 beforeinstall -> SCRIPTS. 2001-04-07 11:21:35 +00:00
Ruslan Ermilov 345e52e742 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
Ruslan Ermilov 610a5778c5 mdoc(7) police: split punctuation characters + misc fixes. 2001-02-01 16:44:04 +00:00
Ruslan Ermilov 1bfea903ed Prepare for mdoc(7)NG. 2001-01-16 09:39:23 +00:00
Ruslan Ermilov 8b5c4af3ff Prepare for mdoc(7)NG. 2000-12-27 15:30:30 +00:00
Doug Barton 6fce744ee3 * Fix a long line that I introduced in the last commit
* Backslash escape non-alphanumeric chars in the login name so that perl
  doesn't choke on things like '$'.
2000-12-17 23:42:45 +00:00
Ruslan Ermilov ed40311694 mdoc(7) police: removed history info from the .Os FreeBSD call. 2000-12-14 11:52:05 +00:00
Doug Barton 56cda6bf39 If a user is in the database, rmuser ought to be able to remove them.
Address this by using getpwnam(), thus killing several birds with
the same stone. My fix is slightly more aggressive than the
originators. :)

PR:		misc/22278
2000-11-21 05:52:35 +00:00
Ruslan Ermilov e97407b4f2 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 20:10:44 +00:00
Ruslan Ermilov 726b61ab5f Avoid use of direct troff requests in mdoc(7) manual pages. 2000-11-10 17:46:15 +00:00
Gregory Neil Shapiro 2216e2a2cd Complete migration of aliases file to /etc/mail/aliases.
The maintainers of share/examples/diskless/README.TEMPLATING and mergemaster
have been contacted so those may be updated as well.
2000-08-13 18:38:58 +00:00
Mark Newton 545dccdc92 Un-botch my botched reduction in permitted characters in the permitted
username check which resulted from my attempt to expand them.

PR:		bin/17372
Reviewed by:	sheldonh
2000-03-14 14:27:34 +00:00
Mark Newton 44dfd6a858 Fix the case where username validity test would incorrectly fail if
the specified username contained uppercase alphabetics.

PR:		bin/17372
2000-03-14 14:19:17 +00:00
Sheldon Hearn 2ed2dc52a6 Remove more single-space hard sentence breaks. 2000-03-06 09:45:37 +00:00
Sheldon Hearn f2e366a105 Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.
2000-03-01 14:09:25 +00:00
Peter Wemm 97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Nik Clayton 9657f84c0f Remove references to the non-existent addgroup(8) and rmgroup(8)
commands.

PR:             docs/12659
Submitted by:   Mark Diekhans <markd@Grizzly.COM>
1999-07-27 18:22:18 +00:00
Kris Kennaway dac696d0ca Grammar and spelling fixes
Obtained from:	OpenBSD
1999-06-30 12:49:56 +00:00
Wolfram Schneider 1c9a0db841 Added myself as maintainer. 1999-02-09 17:23:03 +00:00
Daniel O'Callaghan 47bc1e1873 Print yyyy/mm/dd in /var/log/adduser, instead of yy/mm/dd
Submitted by:	Peter Jeremy <peter.jeremy@alcatel.com.au>
1999-01-15 10:26:59 +00:00
Wolfram Schneider 10e41acac5 Removing -batch option from adduser. Adduser was written as
an *interactive* command for newbies. The pw(8) does now a much better
job for adding users from command line.  Also, the -batch option is
not well tested, buggy and unsupported.
1998-08-17 18:50:29 +00:00
Wolfram Schneider 5b496c24c1 Always ask for homedir.
PR: 6754
Submitted by: uhlar@netlab.sk
1998-06-07 18:38:32 +00:00
Tim Vanderhoek 41c01ead61 MF22: Remove confusing comma 1998-03-18 16:21:55 +00:00
Steve Price 1b95182f20 Clarify the -batch arguments.
PR:		5677
Submitted by:	Adrian Filipi-Martin <adrian@virginia.edu>
1998-02-14 22:55:23 +00:00
Wolfram Schneider 7bf7308c7b Typo. 1998-02-02 15:46:44 +00:00
Wolfram Schneider d7f712093f Rename the pwd_mkdb(8) option '-c' to '-C' for better compatiblity
with BSD/OS.
1998-01-10 17:27:28 +00:00
Wolfram Schneider 86e2983aa5 Small bugfix: store $uid_start instead hard coded value 1000
in /etc/adduser.conf.
1997-12-24 11:44:14 +00:00
James Raynard 6632f06e7a Typo alert. 1997-11-02 00:58:39 +00:00
Wolfram Schneider 142123c17e Do not complain about non existing shell "/nonexistent"
Smarter error check if a uid is already in use.

Submitted by: "Eugene Radchenko" <genie@qsar.chem.msu.su>
1997-09-20 19:59:54 +00:00
Wolfram Schneider 163f94979e Do not accept empty user names. 1997-09-20 18:26:22 +00:00
Philippe Charnier b8594fe054 Cosmetic changes. 1997-09-01 06:14:17 +00:00
Wolfram Schneider 956737a7a6 Stop the growing list of shells if /etc/adduser.conf
was updated.
1997-08-26 22:47:51 +00:00
Paul Traina 8a04c9dcc9 Nologin is also a valid 'invalid' shell 1997-07-31 15:25:35 +00:00
Wolfram Schneider 0298e80d89 Delete dead test code. 1997-07-24 17:44:46 +00:00
Wolfram Schneider 2aec92dd66 cp -r' -> cp -R'
Option -r is obsolete and buggy.
1997-07-18 12:05:43 +00:00
Paul Traina c0156f51b7 Remove addgroup/rmgroup -- they are completely replaced by pw(1).
Adduser/rmuser stay for now until we get a good user-friendly front-end
for pw.
1997-07-05 19:12:45 +00:00
Steve Price d0dff61cfb Fix a minor nit in the .Dd macro invocation so that
the revision date is displayed correctly.
1997-06-23 04:52:13 +00:00
Andrey A. Chernov 2105643e74 Change "no" answer to "default" for login class, because "no" class
can exists and "default" class is really equal to empty class.
1997-05-01 23:34:25 +00:00
Andrey A. Chernov a0c103b58d Allow "no" answer on login class prompt override non-empty
/etc/adduser.conf defaultclass with empty one
1997-05-01 23:23:06 +00:00
Andrey A. Chernov 84dc96f1be 1. Deal with login classes now
2. Turn on send_message by default for security reasons (mailbox
must be pre-created)
1997-05-01 22:55:58 +00:00
Wolfram Schneider 29a932b562 Variable name typo.
Reviewed by: Guy Helmer <ghelmer@cs.iastate.edu
Submitted by:	Paul Sandys <myj@nyct.net>
1997-04-02 14:34:57 +00:00
Wolfram Schneider eac4b079c7 Support comments in password database (/etc/master.passwd).
Comments in group database (/etc/group) are currently not
supported - adduser silently delete blank lines and comments.
1997-03-09 12:21:45 +00:00
Wolfram Schneider 1e85e4dbb0 Cleaned up some messages, added a check to remove a leftover popd file
from /var/mail, added a routine to delete the removed user's files
from /tmp, /var/tmp, & /var/tmp/vi.recover, and added code to kill any
running processes owned by the removed user).  I've also added a flag
for non-interactive execution, cleaned up the man page, and adjusted
my address.

Submitted by: ghelmer@cs.iastate.edu (Guy Helmer)
1997-03-08 18:04:45 +00:00
Peter Wemm 476602a9d0 Revert $FreeBSD$ to $Id$ 1997-02-22 16:15:28 +00:00
Wolfram Schneider bfd34a4a60 Sort cross references. 1997-01-20 00:03:00 +00:00
Jordan K. Hubbard 1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Wolfram Schneider d26d5268ed Allow dash -' (except for first char) and underscore _' in usernames.
pointed out by: max
1996-12-29 21:56:31 +00:00
Wolfram Schneider 9a43d0d77b remove group limits checks 1996-12-29 15:06:52 +00:00
Wolfram Schneider c84f83e0c2 increase username length limit to 16 1996-12-29 15:05:19 +00:00
Mike Pritchard 787a18dba6 Minor internal mdoc usage changes. 1996-12-23 00:57:46 +00:00
Mike Pritchard 574d7dc09d Minor style fixes.
I also renamed the adduser "-quit" option to "-quiet", since
it is supposed to be the same as the -s/-silent option,
and -quit must have beena typo.
1996-12-23 00:10:22 +00:00
Andrey A. Chernov 2f71230e78 Expand username limit to 16 1996-12-07 21:25:12 +00:00
Andrey A. Chernov 28c5126cfb Don't show on the screen just securely entered password
(in /etc/adduser.message text)
Sending password by E-mail on local machine is joke in any case
1996-11-27 22:04:55 +00:00
Wolfram Schneider 42eacfd392 do not print 'illegal shell' for pseudo users news and xten
Submitted by:	 kuku
1996-11-20 01:07:46 +00:00
Wolfram Schneider 901c028ed7 install rmuser, addgroup, rmgroup in /usr/sbin 1996-11-17 03:51:33 +00:00
Wolfram Schneider bb0d295728 manpages for rmgroup(8) and addgroup(8) 1996-11-04 17:21:11 +00:00
Wolfram Schneider eb651d9f73 rmgroup - delete a Unix group
usage: rmgroup group
1996-10-30 20:58:47 +00:00
Wolfram Schneider 627199df42 addgroup - add a group or add users to a group
addgroup [-g gid] group [user[,user,...]]
1996-10-29 20:31:43 +00:00
Wolfram Schneider d45496e5c4 warn if reach group line limit (>200 users, >1024 bytes per line)
close PR#1595

suggested by: Seppo Kallio <kallio@beeblebrox.cc.jyu.fi
1996-09-17 19:34:56 +00:00
Wolfram Schneider 896f207c80 Do not backup master.passwd if pwd_mkdb returned an error. This
was to paranoid, pwd_mkdb(8) is carefully enough to not
corrupt master.passwd on failure.

Submitted by: joerg
1996-09-14 23:22:23 +00:00
Jordan K. Hubbard 79b69435d9 Make passwords no longer echo or display. Because of this, we now also
ask for matching confirmation.  I'm sure there is a clever direct-from-perl
ioctl way of putting the terminal into noecho mode, but I don't feel like
learning perl so I just used system.  [yes, I'll put stty on the installation
boot floppy as necessary]
1996-09-11 08:36:54 +00:00
Adam David 718737f0fb typo police
I couldn't make any sense of the sentence "Eval variables in this file." so I
left it alone.

also allow creation of new local group when NIS groups are used.
this can probably be done more elegantly, and needs more thought.
1996-08-28 17:54:14 +00:00
Wolfram Schneider 5a80fb277e sync copyright with /usr/share/examples/etc/bsd-style-copyright 1996-08-27 20:04:45 +00:00
Mike Pritchard 85cf659a76 Use the .Fx macro where appropriate. 1996-08-23 00:57:08 +00:00
Wolfram Schneider f99f7b462b run pwd_mkdb with new check option [-c] to verify correctness
of /etc/master.passwd
1996-08-20 19:57:23 +00:00
Wolfram Schneider 8a368b34b0 Do not add an user to a group if the group is also the login group. 1996-08-14 19:06:04 +00:00
Wolfram Schneider 2e8b782306 Do not send "welcome mail" as default. If you want this feature
you can still enable it. Better, use mail client like elm or pine.

Requested by: Jordan
1996-08-13 21:50:51 +00:00
Wolfram Schneider b86759fd0f documented login name limit
Obtained from: mailing list
1996-06-09 20:45:35 +00:00
Gary Clark II b8ff21bda2 We DON'T ship bash by default, why is it the default shell?
We also don't ship tcsh or ksh by default.
Correct these two things to make sh the default and increase csh and sh
to be higher priority.
1996-05-06 06:15:19 +00:00
Wolfram Schneider 5038dc1abd Submitted by: Masafumi NAKANE <masafumi@tky007.tth.expo96.ad.jp>
bugfix: chown home directory if don't copy dotfiles
1996-02-10 17:15:47 +00:00
Mike Pritchard 4a8d02835c Fix a bunch of spelling errors in a bunch of man pages. 1996-01-30 13:52:50 +00:00
Peter Wemm a5b996a7ec recording cvs-1.6 file death 1995-12-30 19:02:48 +00:00
Jordan K. Hubbard cfe7e224b8 Clean up some of the english here.. 1995-10-22 11:44:16 +00:00
Jordan K. Hubbard 2abfdd7f9c Various fixes to make this work better when called from other tools.
Submitted by:	Coranth Gryphon <gryphon@healer.com> & Wolfram Schneider <wosch@cs.tu-berlin.de>
1995-10-19 06:26:49 +00:00
Jordan K. Hubbard 7b74963e46 The problem is the returned salt, while the freebsd man pages asks that the
crypt salt string begin with a '_', no other crypt's do.  If you remove the
initialization of $salt to '_' in sub salt(), everything works as advertised.
Submitted by:	Charles Henrich <henrich@crh.cl.msu.edu>
1995-05-20 13:05:22 +00:00
Andrey A. Chernov 7439966a40 Don't accept usernames longer than 8 characters
Submitted by: Wolfram Schneider <wosch@cs.tu-berlin.de>
1995-04-30 19:20:25 +00:00
Andrey A. Chernov 6b234a88dc Non-blocking lock
Remove old salt cause possible endless loop
Submitted by: <wosch@cs.tu-berlin.de>
1995-04-09 03:34:10 +00:00
Andrey A. Chernov f01592bbca o more options
o less restrictive, you can choise uid, gid ...
	o invite user into some groups
	o encrypted passwords with crypt
	o batch mode (for instance, this works now:
	  $ adduser -batch jkh guest,uuadmin "Jordan K. Hubbard" passwd
	  see manpage for more details)

Submitted by: Wolfram Schneider <wosch@cs.tu-berlin.de>
1995-03-08 22:44:37 +00:00
Jordan K. Hubbard 0817ade904 Correct some of the english. 1995-01-09 11:32:01 +00:00
Jordan K. Hubbard 8f1133e6ec Wolfram Schneider <wosch@cs.tu-berlin.de>:
o manpage
	o save configuration in /etc/adduser.conf
	o send message file (/etc/adduser.message)
Submitted by:	woschcs.tu-berlin.de
1995-01-09 11:26:31 +00:00
Jordan K. Hubbard 5cc75e1e12 Update adduser to version by Wolfram Schneider. Sorry, Gary, but his
adduser is a Cadillac to your Volkswagen.. :-)
Submitted by:	wosch@cs.tu-berlin.de
1995-01-03 09:46:14 +00:00
Andrey A. Chernov 71d5664cdc Change ${COPY} to -c, always needed here
Remove manpage reference to BSD adduser, add pwd_mkdb reference
1994-12-31 11:12:35 +00:00
Andrey A. Chernov 99e4807ade Remove extra targets per Bruce suggestion.
Use more macros instead of hardcoded things
1994-12-30 15:38:04 +00:00
Andrey A. Chernov 33148aa5e7 Change man section 1994-12-30 12:15:39 +00:00
Andrey A. Chernov e3763702e6 Oops, rename adduser.sh to adduser.perl
Add empty clean and obj targets.
1994-12-30 12:13:08 +00:00
Andrey A. Chernov 4298bedc38 Yet one cleanup 1994-12-30 12:03:48 +00:00
Bruce Evans b367f6bf5f Fix everything. 1994-12-30 07:18:23 +00:00
Gary Clark II c6fc9f62f9 Changed my copyright back. Too many problems with new one. 1994-12-28 17:27:21 +00:00
Andrey A. Chernov 7a9bf0aeb8 Fix configfile path 1994-12-28 13:49:55 +00:00
Andrey A. Chernov 36e94efd67 Move conf files to src/etc 1994-12-28 13:47:31 +00:00
Gary Clark II 0b102aed10 Add makefile for adduser.
Would a makefile guru please look this over to make sure I did this right?
1994-12-28 07:35:09 +00:00
Gary Clark II 4baf40c2ef Add Id strings 1994-12-28 07:11:29 +00:00
Gary Clark II 6f91ec858d Adding my adduser command. I only have to add a makefile for it to
be compleate.
1994-12-28 06:55:42 +00:00