Commit Graph

175 Commits

Author SHA1 Message Date
Baptiste Daroussin
4efe6c741d In NIS mode first chmod(2) the temporary file and is succeed then rename(2) 2012-11-20 14:05:46 +00:00
Baptiste Daroussin
7a43850530 Correctly set the password file mode after renaming in NIS mode 2012-11-20 10:59:41 +00:00
Baptiste Daroussin
fb2db03194 Teach pw(8) about how to use pw/gr API to reduce code duplication
MFC after:	2 months
2012-10-30 08:00:53 +00:00
Baptiste Daroussin
e7e5ec8773 Do not treat empty name as an uid 0
Reported by:	Robert Bonomi <bonomi@mail.r-bonomi.com>
2012-10-01 17:00:33 +00:00
Baptiste Daroussin
e6e9c14bdf Remove useless atoi(3), previous strspn(3) makes sure that a_name->val is a
number.
This also allow pw user show to work as expected.

PR:		bin/172112
Submitted by:	"Ilya A. Arkhipov" <rum1cro@yandex.ru>
MFC after:	1 month
2012-10-01 16:42:07 +00:00
Kevin Lo
ba670ce023 Make sure that each va_start has one and only one matching va_end,
especially in error cases.
2012-09-28 07:51:30 +00:00
Kevin Lo
29dcf726d2 Handle NULL return from crypt(3). Mostly from DragonFly 2012-02-22 06:27:20 +00:00
Kevin Lo
76a387fbba readlink len-1 2012-02-14 10:17:03 +00:00
Ulrich Spörlein
3df5ecac8c Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +00:00
Eitan Adler
19e1bf2997 - document the -l option to usermod
PR:		docs/161588
Submitted by:	"Luchesar V. ILIEV" <luchesar.iliev@gmail.com>
Approved by:	gjb
MFC after:	1 week
2011-12-22 03:36:54 +00:00
Dimitry Andric
5893527d84 In usr.sbin/pw/pw_user.c, use the correct printf length modifier for a
ptrdiff_t.

MFC after:	1 week
2011-12-17 23:46:47 +00:00
Xin LI
cfc3f46787 Backout r223115 which potentially caused a POLA violation, by restoring
historic behavior (create the default base directory in pw.conf) before
I came up with a better fix for this.

Requested by:	nwhitehorn
Approved by:	re (kib)
2011-07-31 03:00:00 +00:00
Xin LI
6a635ff4b4 Don't attempt to create the base directory when -d is specified.
MFC after:	1 month
2011-06-15 19:09:58 +00:00
Jung-uk Kim
644af48df6 Stop hard-coding default directory mode as 0777. 2011-03-08 20:13:29 +00:00
Jung-uk Kim
110df1daa0 Do not let pw.conf(5) or -M option affect creation of basehome, e.g., /home.
When the basehome does not exist, it creates all intermediate directories as
required, which is logically equivalent to mkdir(1) with -m and -p options.
However, it modifies all intermediate directories, not just the final home
directory unlike mkdir.  This problem was introduced in two revisions, i.e.,
r1.59 (SVN r167919) and r1.60 (SVN r168044).

MFC after:	1 month
2011-02-04 19:49:02 +00:00
Ulrich Spörlein
0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Jung-uk Kim
85a3024411 Revert the unrelated patch crept in the previous commit. 2010-10-05 18:47:51 +00:00
Jung-uk Kim
e116381d02 Prefer pmap_unmapbios() over pmap_unmapdev(). The binary does not change
after this because pmap_unmapbios() is a macro for pmap_unmapdev() on amd64.
2010-10-05 18:38:23 +00:00
Ed Schouten
71ccf09269 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
Ed Schouten
41d6f23028 Make pw(8) build without <utmp.h>.
The size of the username record in utmp files should not influence the
maximum username length. Right now ut_user/ut_name is big enough, so in
this case it's dead code anyway.
2009-12-06 01:27:28 +00:00
Andrey A. Chernov
f70f5c2077 Use arc4random_uniform() to avoid "modulo bias"
Remove pw_getrand() unneded now: arc4random_uniform() is stronger then
pw_getrand()'s MD5 tricks (inactive) and its active version, mixing
arc4random() bytes in one, not make things better at all.
2008-08-16 15:41:03 +00:00
John Baldwin
c746f22dea Before updating the password database, the pw(8) utility first performs a
sanity check by invoking "pwd_mkdb -C".  However, if this failed it
silently returned success.  Fix this so it fails the update operation
instead.

MFC after:	1 week
2008-07-17 13:47:59 +00:00
Antoine Brodin
e8e8c216d0 - Increase the size of the salt in pw(8) from 8 to 32 (same as in pam_unix(8)).
This makes blowfish password hashes look normal when set using
pw(8)/adduser(8). [1]
- Make it possible to have a '/' in the salt.

PR:		121146 [1]
Submitted by:	Jaakko Heinonen [1]
Approved by:	rwatson (mentor)
MFC after:	1 month
2008-05-27 19:04:31 +00:00
Sean Farley
bc991a6d5f Add the groupmod '-d' option to pw to allow the deletion of existing users
from a group without the need to perform the same operation by replacing
the existing list via the '-M' option.  The '-M' option requires someone
to fetch the existing members with pw, deleting the undesired members from
the list and sending the altered list back to pw.

Approved by:	wes (mentor)
MFC after:	5 days
2008-02-23 01:25:22 +00:00
Sean Farley
72d1b828b3 style(9) (verified no object changes)
Approved by:	wes (mentor)
MFC after:	5 days
2008-02-23 01:17:42 +00:00
Mike Makonnen
40ab104eaa Clarify in what formats the grouplist for the '-G' switch may be accepted.
Submitted by: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
2008-01-25 15:54:14 +00:00
Lukas Ertl
1b692a8c44 Do the right thing with symlinks in the skeleton directory.
PR:     bin/63659
2007-03-30 13:18:52 +00:00
Lukas Ertl
e57f8ca5cd Accept passwords which contain whitespace.
PR:     bin/53434
2007-03-30 12:57:25 +00:00
Lukas Ertl
85204142eb Add home directory creation mode to pw.conf(5) and be a bit
more specific about the effect of the current umask on -M.
2007-03-30 11:23:10 +00:00
Lukas Ertl
1dd634b049 Add -M argument to usage() output. 2007-03-30 10:02:47 +00:00
Lukas Ertl
eebbeceec9 Introduce the new option -M to allow to set the permissions of
the user's newly created home directory.  If omitted, it's derived
from the current umask.

PR:      bin/16880, bin/83253 (partially), bin/104248
MFC in:  1 month
2007-03-26 23:29:20 +00:00
Tom Rhodes
fd59f59ae3 Better mdoc(7). Bump doc date.
Kicked by:	ru
2006-10-09 19:01:02 +00:00
Tom Rhodes
31e224dd37 Note the naming convention of files in share/skel and explain the "dot"
prefix is removed.

PR:	103828
2006-10-09 17:57:40 +00:00
Maxim Konovalov
04cfd91b6a o Fix groupadd getopt line and make 'pw groupadd -o' work.
PR:		bin/100684
Submitted by:	Devon H. O'Dell
MFC after:	3 weeks
2006-09-18 14:00:39 +00:00
Pawel Jakub Dawidek
49630c2335 Change /home symbolic link, so it will point to usr/home instead of /usr/home.
Previous symlink was confusing:

	# cd /jails/virtual_system_1/home
	# realpath .
	/usr/home

...and slower.

OK'ed by:	rwatson, phk
2005-07-31 08:25:53 +00:00
Stefan Farfeleder
18b51f792f Remove unused variables. 2005-04-09 14:59:10 +00:00
Stefan Farfeleder
3ce1d6bb59 The variable `arglist' has internal linkage in pw.c, don't declare it as extern
here.
2005-02-10 09:05:27 +00:00
Ruslan Ermilov
59a3c79da6 Sort sections. 2005-01-18 20:02:45 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Stefan Farfeleder
2475565a7a Don't rely on NULL being a pointer, add a cast before passing it to a variadic
function.
2004-10-03 14:40:27 +00:00
Ruslan Ermilov
07bfccd71e Mechanically kill hard sentence breaks. 2004-07-02 23:13:00 +00:00
Robert Drehmel
b8938b667e Use strlcpy(3) to replace the idiomatic
strncpy(d, s, l);
  d[l - 1] = '\0';

statements.
2004-06-17 14:07:16 +00:00
Robert Drehmel
1040317076 Fix a bug which occurred when the home directory given by the
-d option was equal to the one already saved and which caused
the pw utility to avoid updating values passed by other options
processed before the -d option in the code path.

Spotted by: Richard Caley <rjc@interactive.co.uk>
2004-06-17 10:29:12 +00:00
Ken Smith
fc1007e186 Shift file locking to source file instead of temp file. This fixes
data buffering issue that corrupts files if two pw(8)'s run at the
same time as well as changing pw(8) so it uses the same locking
mechanism as PAM, vipw(8), pwd_mkdb(8), etc.

PR:		bin/23501
Submitted by:	Alex Kapranoff <alex (at) kapran (dot) bitmcnit (dot) bryansk (dot) su>
Approved by:	rwatson (mentor)
MFC after:	5 days
2004-03-08 20:31:37 +00:00
Ian Dowse
87d6b5caf6 Add a -H <fd>' option that is like -h <fd>', but accepts an already
encrypted password on the specified file descriptor.

PR:		bin/22033
MFC after:	2 weeks
2004-01-11 18:28:08 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Philippe Charnier
860f0df364 The .Xr utility. Spelling. Put NIS under .Tn 2003-06-08 14:28:38 +00:00
Tom Rhodes
0603fbc3ae Add information about the log file.
PR:		35575
Submitted by:	"Simon L. Nielsen" <simon@nitro.dk> (original version)
2003-05-08 00:28:36 +00:00
David E. O'Brien
052238b16c style.Makefile(5) 2003-04-04 17:49:21 +00:00
Andrey A. Chernov
c6c9094f0c There is no sense to use random random() and arc4random() in the same program.
Switch to arc4random() completely.
2003-02-11 02:17:11 +00:00