Commit Graph

199 Commits

Author SHA1 Message Date
Baptiste Daroussin
113f96dd0b Removed compatibility with pre FreeBSD 2.2 pw_mkdb command
Fix some broken indentattion

PR:		189173
Submitted by:	fullermd@over-yonder.net
MFC after:	1 week
2014-06-20 10:34:32 +00:00
Baptiste Daroussin
c145c34c09 Simplify reading pw.conf(5) by using getline(3) 2014-04-22 21:07:56 +00:00
Devin Teske
933db55545 Fix pw(8) deletion of group "username" on userdel even if group "username"
is not associated with user "username". E.g., user "foo" has primary group
"wheel" and is unassociated with group "foo", yet userdel would delete the
group "foo" when deleting user "foo" (despite the fact that user "foo" is
not associated with group "foo" in any way).

Patch committed with minor style(9) changes.

PR:		bin/169471
Submitted by:	Alexander Pyhalov <apyhalov@gmail.com>
2014-03-13 18:16:42 +00:00
Julian Elischer
bbd054cb33 Part 2 of bug 187310.. had to commit separately due to local confusion.
Don't let pw crash when give certain input.

PR:		187310
Submitted by:	Kim Shrier
MFC after:	1 week
2014-03-06 19:58:03 +00:00
Julian Elischer
5691bbf05d Stop pw(8) from segfaulting when given certain input
PR:187310
Submitted by:	Kim Shrier
Obtained from:	bug
MFC after:	1 week
2014-03-06 19:26:08 +00:00
Dag-Erling Smørgrav
d28832a05e Fall back to sha512 if passwd_format is not set.
MFC after:	3 days
2013-07-04 07:59:11 +00:00
Dag-Erling Smørgrav
a05aa38cb1 There is no reason to disallow setting the password or account expiry
date to the current date.

MFC after:	3 days
2013-07-03 09:48:24 +00:00
Tim Kientzle
1d47232e08 Fix -Wunsequenced warning
Submitted by:	  dt71@gmx.com
2013-06-29 15:54:17 +00:00
Joel Dahl
37b983c09b mdoc sweep 2013-05-13 18:13:50 +00:00
Daniel Eischen
605e5bbc41 Prevent a null pointer dereference in pw userdel when deleting
a user whose group != username.
2013-02-01 05:19:49 +00:00
Eitan Adler
535460c7dc Remove unused variables
Approved by:	cperciva
MFC After:	3 days
2013-01-16 05:03:49 +00:00
Mateusz Guzik
1f09eec3f8 pw: free group returned by gr_add 2013-01-06 21:56:58 +00:00
Baptiste Daroussin
b3075010f8 Simplify vnextgrent and vnextpwent reusing pw_scan and gr_scan from libutil. 2012-12-27 19:43:29 +00:00
Baptiste Daroussin
0c50344969 Fix a regression in "pw group show" introduced r242349:
print a newline after printing each group line.

PR:		bin/174731
Submitted by:	Jan Beich <jbeich@tormail.org>
2012-12-27 14:44:13 +00:00
Baptiste Daroussin
460a6dac0b Simplify the code by using the new gr_add function 2012-12-27 14:35:06 +00:00
Baptiste Daroussin
ae61f4dda6 Simplify copying of group members by using memcpy
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2012-12-26 23:16:24 +00:00
Baptiste Daroussin
c195c1ba19 Fix off-by-one error in memory allocation: j entries, one new and a null
terminator is j + 2.

Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2012-12-26 23:14:33 +00:00
Baptiste Daroussin
0083d61abc In case of the deletion of a user those whole database has to be regenerated,
otherwise the user planned to be deleted remain in the pwd.db while removed from
the plain text password file.
2012-12-26 18:28:17 +00:00
Baptiste Daroussin
dc0f2b4217 Fix creating a user and adding it to a group
Reported by:	"Sam Fourman Jr." <sfourman@gmail.com>, dim
2012-12-26 18:14:45 +00:00
Eitan Adler
fa65b91ab3 Simplify string duplication: use strdup instead of malloc + strcpy
Submitted by:	db
Approved by:	cperciva
MFC after:	2 weeks
2012-12-05 13:56:56 +00:00
Eitan Adler
dae7204032 Avoid overflowing the file buffer
Submitted by:	db
Approved by:	cperciva
MFC after:	2 weeks
2012-12-05 13:56:52 +00:00
Eitan Adler
91d073903e Use strdup instead of malloc + strcpy
Submitted by:	db
Approved by:	cperciva
MFC after:	2 weeks
2012-12-05 13:56:49 +00:00
Eitan Adler
6c3c59886c Avoid overflow of file buffer
Submitted by:	db
Approved by:	cperciva
MFC after:	2 weeks
2012-12-05 13:56:46 +00:00
Eitan Adler
61fd27bb3b Remove useless check for NULL prior to free.
Approved by:	cperciva
MFC after:	2 weeks
2012-12-05 13:56:43 +00:00
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