Commit Graph

37 Commits

Author SHA1 Message Date
Kyle Evans
f5339b097a adduser: allow standard IFS characters in passwords
Notably, the default IFS contains space/tab, thus any leading/trailing
whitespace characters tend to be removed.

Set IFS= for just the read lines to mitigate this, allowing the user to be
less surprised when their leading/trailing spaces weren't actually captured
in the password as they are with other means of setting a user's password.

PR:		245342
Submitted by:	dereks_lifeofadishwasher.com
Reviewed by:	jilles
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D24292
2020-04-05 19:25:46 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Daniel Eischen
a2cdef71d1 When using uidstart in /etc/adduser.conf, get the next
available user id and show it in the "Uid [xxx]" prompt.

PR:		163863
Submitted by:	Moritz Wilhelmy (mw at wzff dot de)
MFC after:	2 weeks
2012-02-25 07:58:59 +00:00
Ulrich Spörlein
3df5ecac8c Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +00:00
Joel Dahl
05c9bdf579 Fix a few whitespace issues and comment typos that I found while reading
through this file.
2010-01-14 22:04:08 +00:00
Mike Makonnen
43cb08ceb6 Add the -M command-line option, which will set home directory permissions.
Works both in interactive or batch mode. This is a heavily modified version
of the patch submitted in the PR.

PR: bin/105060
MFC after: 1 week
2008-01-27 10:15:36 +00:00
Mike Makonnen
88b63feb56 Allow adding a user(s) to additional groups in batch mode as well.
Submitted by: Eygene Ryabinkin <rea-fbsd@codelabs.ru> (modulo minor changes)
MFC after: 2 weeks
2007-10-20 00:45:31 +00:00
Mike Makonnen
ac3cd4717c There are a couple of bugs in rev. 1.27:
1) The man page should describe the code, not the other way around.
2) Internal variables should not be documented or exposed, except in
   controlled circumstances (i.e. - That's what the -C flag is for).
   The variable should have been saved to the config file in save_config().
3) The next available userid doesn't get automatically updated. The
   end-result is the same (user gets added with the correct uid),
   but in an interactive session the default uid doesn't get updated in
   the display.

So,

o Use the uidstart variable instead of uuid (bug #3)
o Actually save the variable to adduser.conf (bug #2)
o (bug #1 to be fixed in an upcomming commit to adduser.conf.5)

MFC After: 2 weeks
2007-04-12 08:17:56 +00:00
Mike Makonnen
f30cdb6e7d Errm... I don't see how rev. 1.26 could have possibly worked or been tested.
Fix it for real.

Submitted by: Johnny Lee <johnny@bmtk.com>
MFC After: 2 weeks
2007-04-12 07:38:26 +00:00
Lukas Ertl
a80d527f45 Check if the new user already exists right after entering the
username instead of watching the final call to pw(8) fail.
2007-03-26 22:22:10 +00:00
Matteo Riondato
f4c595b794 Honour the "uuid" directive in adduser.conf
PR:		conf/87914
Approved by:	philip (mentor)
MFC after:	3 days
2006-01-22 18:37:51 +00:00
Robert Drehmel
989090c052 - Act according to the documentation (man page):
When adding users from a preformatted file, do not exit
   silently when empty lines or lines starting with a '#'
   are encountered - ignore them instead.
 - Fix a spelling error in a comment.

PR:		bin/80058
2005-04-28 12:44:02 +00:00
Peter Pentchev
ce655e042c In fullpath_from_shell(), move the nologin detection before the cat | while
loop to avoid an incorrect display of the nologin path twice.

PR:		71786
Submitted by:	Andrew Hayden <andrew.hayden@gmail.com>
Reviewed by:	mtm
MFC after:	3 days
2004-09-23 13:09:42 +00:00
Mike Makonnen
a53b524bb4 Also, match the full path to the special nologin shell.
Previously, it would recognize it as a valid shell only
if the basename (nologin) was specified. Now, it will
recognize both the basename and the full path.

NOTE: The full path as adduser(8) understands it is /usr/sbin/nologin.
      There is a symlink, /sbin/nologin, but that's deprecated and
      only there for backwards compatibility.
2004-08-28 14:32:10 +00:00
Mike Makonnen
e7291a6b12 Accept full path names in addition to base names for shells.
Make explicit in the documentation that valid shells need to be
supplied only if the -S option is not given.
2004-06-06 17:55:55 +00:00
Colin Percival
680500334e Sychronize with reality: nologin(8) is now in /usr/sbin
Reminded by:	trhodes
2004-03-30 19:24:56 +00:00
Mike Makonnen
0d640c0d4b o Add an -S option to not attempt to ascertain the validity of a shell.
o Add a -D option to not attempt to create the home directory.
o Treat the /nonexistent home directory specially. It means the user has
  no home directory and it should not be created.
o Update Copyright year and my email.
2004-03-16 13:46:29 +00:00
Mike Makonnen
fdbc43bd82 Typo.
This has worked so far because the variable was empty by default.

Submitted by: Kostyuk Oleg <cub@cub.org.ua>
2003-06-24 15:20:43 +00:00
Mike Makonnen
0e08168e03 s/warn/info/ 2003-06-20 19:36:56 +00:00
Mike Makonnen
8923e98bdc Add support for the special shell nologin.
Prodded by:	mikeh
2003-06-20 19:23:55 +00:00
Mike Makonnen
22884fdd75 Update my email address. 2003-06-20 16:53:36 +00:00
Mike Makonnen
b0c151b850 Don't forget the -r on the second password prompt.
PR: bin/53550
2003-06-20 16:52:06 +00:00
Mike Makonnen
e33b8d973e Document the -g option in the usage message.
Approved by:	markm (mentor)(implicit)
2003-03-23 23:06:44 +00:00
Mike Makonnen
642a7af59a Add a -g option to specify a default login group.
Approved by:	markm (mentor)(implicit)
2003-03-20 16:36:03 +00:00
Mike Makonnen
187a97aab9 o initialize a couple of local flags so the user can re-edit groups
next time the subroutine is re-entered
o s/configrun/configflag/
o Make the prompt make sense if the user was creating a configuration file

Approved by:	markm (mentor)(implicit)
2003-03-19 08:07:15 +00:00
Mike Makonnen
fc89586093 Update copyright. 2003-02-16 18:06:04 +00:00
Mike Makonnen
c95c14d4e1 Revisit the shell special characters issue and settle it once-and-forall.
All characters will be accepted, and pw(8) can sort out which ones it
will allow and which ones it won't.

Approved by:	markm (mentor)
Prodded by:	Philippe Bourcier <philippe@cyberabuse.org>
2003-02-09 18:29:09 +00:00
Adrian Chadd
3386ded6a9 Change the behaviour of adduser to match the previous incarnation a little more.
If any of the given groups do not exist complain and let the user try again.
This saves the user from discovering at the end of the process that they've
forgotten to add a group or they've typoed.

Thanks to cmc/dougb for pointing out how bad my sh fu actually is.

Original code by: me
Scary sh rewrite by: dougb

Reviewed by:	dougb
2003-02-08 08:04:53 +00:00
Max Khon
cf8a185d8d back out logging to /var/log/adduser
(/usr/sbin/pw already logs to /var/log/userlog)
2003-01-24 02:05:51 +00:00
Mike Makonnen
21084fe3e4 In interactive mode, ask the user if he/she wants to add another
user and re-run interactive questions or quit depending on the
answer.

Submitted by: Scot Hetzel <hetzels@westbend.net>
Approved by: markm (mentor)
2003-01-24 00:24:26 +00:00
Max Khon
e63bd70a30 - restore an ability to write log of added users (default to
/var/log/adduser, disabled if empty or adduserlog="no")
- do not ask for password in configure mode
- print $passwdtype instead of password in configure mode
- add DATECMD, GREPCMD (not overridable but with full path)
2003-01-23 20:07:40 +00:00
Mike Makonnen
c83365999e *blush*
While I'm here properly quote all the other input I neglected
to quote.

Approved by: markm (mentor)(implicit)
2003-01-23 01:57:30 +00:00
Mike Makonnen
acb3f07afd Don't forget to properly quote input.
Approved by: markm (mentor)(implicit)
Submitted by: Robin Breathe <robin@isometry.net>
2003-01-21 12:11:35 +00:00
Max Khon
8b6caf2634 do not loose trailing space when asking uid 2003-01-20 17:55:31 +00:00
Scott Long
7cdfce092a Replace the perl versions of adduser and rmuser with shell script versions.
Submitted by:	Mike Makonnen <mtm@identd.net>
Approved by:	re
2002-12-03 05:41:09 +00:00
Peter Wemm
a5b996a7ec recording cvs-1.6 file death 1995-12-30 19:02:48 +00:00
Andrey A. Chernov
4298bedc38 Yet one cleanup 1994-12-30 12:03:48 +00:00