Commit Graph

37 Commits

Author SHA1 Message Date
Baptiste Daroussin
90edef4fe0 Fix wrong message when using pw -V with a non existent directory
Add a regression test about it

PR:		194971
Submitted by:	Freddy DISSAUX <bugzilla@dsx.bsdsx.fr>
2014-11-12 22:27:53 +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
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
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
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
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
Brian Somers
7bc6d0158f Fix the type of the NULL arg to execl()
Idea from: Theo de Raadt <deraadt@openbsd.org>
2001-07-09 09:24:06 +00:00
Kris Kennaway
cab0fb4e48 Fix a harmless format string bogon and mark a function as __printflike().
There is still one instance of non-constant format string use inside that
function, but it's hard to fix.

MFC after:	1 week
2001-07-05 08:01:15 +00:00
Dima Dorfman
ed6fd55a59 Document the lock and unlock commands. This fixes a segmentation fault.
PR:		25187
Approved by:	nik
2001-03-14 03:24:30 +00:00
Ben Smithurst
d0d78e1303 Convert to use the <sys/queue.h> macros rather than fiddling with the queue
structure internals.

Reviewed by:	markm
2000-12-29 18:04:54 +00:00
David E. O'Brien
1a37aa566b Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.
2000-12-09 09:35:55 +00:00
Andrey A. Chernov
39610c7229 Localize ctype too.
Add weekday to showuser expired fields
2000-06-24 13:36:13 +00:00
Andrey A. Chernov
e7161f368a Localize time/date.
Use ISO 8601 date in logs.
Fix wrong argument type in ctype functions.
2000-06-22 16:48:41 +00:00
David Nugent
c4e667b9d7 Be a little more strict about handling command line args. This allows user and
group names like 'help' 'mod' 'user' 'group' etc. to work correctly without
requiring the -n style invocation.
PR:		misc/17069
2000-06-18 02:39:17 +00:00
David Nugent
923dc0b2c3 Portability fixes for other bsd4.4 derivatives. 2000-01-15 00:20:22 +00:00
David Nugent
2399cd14a7 Add new functionality "lock" and "unlock" to provide a simple password
locking mechanism for users. This works by prepending the string
"*LOCKED*" to the password field in master.passwd to prevent successful
decoding.
1999-10-26 08:34:09 +00:00
Peter Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
David Nugent
f35227220f Add the ability to print user records in unix version 7 (old) format. 1999-03-02 00:53:33 +00:00
David Nugent
7291e2179c Fix minor nit with command line parsing for pw -V DIR action. 1999-02-23 11:01:50 +00:00
David Nugent
e3921b2795 Fix tpyo (sic) and missing 'else' (bad cut n' paste). 1999-02-23 10:35:47 +00:00
David Nugent
5f12594a29 1) Do not blindly ignore file update errors which may occur due to concurrent
updating
2) Add -V <etcdir>, which allows maintaining user/group database in alternate
   locations other than /etc.
1999-02-23 07:15:11 +00:00
David Nugent
08fe832b6e Remove bogus file locking in main(). 1999-01-08 10:52:38 +00:00
Nate Williams
5e91a8ac91 - On second thought, attempt to get the read-only lock, but don't
consider it a exit failure if it doesn't work.  This means that root
  processes can safely get the lock, but normal processes can still use
  the 'pw' utility to get information (which may change out from under
  them.)
1998-08-04 22:31:26 +00:00
Nate Williams
2a6797aae2 - Removed read-only lock from 'pw'. This removes portions of the FIX
from PR/6787, but allow non-root users to use pw to get password
  information.  However, this should be safe since the fixes for
  disallowing multiple instances from modifying the DB are still intact.

Bug noted by:	 dima@best.net (Dima Ruban)
1998-08-04 22:20:11 +00:00
Nate Williams
73375325b1 Fix race condition in pw caused by multiple instances of pwd_mkdb being
run at the same time.

Notes:
    The fileupdate function is still somewhat broken.  Instead of
    returning a failure code if it can't modify the original file it
    renames the .new file and continues as though nothing is wrong.
    This will cause the lock on the original file to be lost and could
    lead to a similar race condition.  I left that portion of the code
    alone since I feel that the maintainer of the code would have a
    better concept of how he wants to handle errors in that function
    than I do.

PR:		bin/6787
Submitted by:	Craig Spannring <cts@internetcds.com>
1998-07-16 17:18:25 +00:00
Philippe Charnier
1dcc6ec750 Use err(3) instead of local redefinition. Add rcsid string. 1997-10-10 06:23:42 +00:00
David Nugent
fa7e83d492 getuid() -> geteuid(). 1997-07-17 08:37:47 +00:00
Peter Wemm
476602a9d0 Revert $FreeBSD$ to $Id$ 1997-02-22 16:15:28 +00:00
David Nugent
e57b5686c6 Fix useage of MAXLOGNAME to include terminating NUL, by using
max(MAXLOGNAME-1,UT_NAMESIZE).
Tidy up "pretty" printing format for longer usernames.
1997-02-07 10:58:13 +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
David Nugent
f1d684fad9 Adds optional NIS passwd file updating and optionally rebuilding
NIS maps.

Suggested by:	Peter Wemm
1997-01-05 07:15:37 +00:00
Joerg Wunsch
ad7cf975be Copyright update by the author, to be more in line with our sample
copyright.

Submitted by:	David Nugent
1996-12-10 23:59:04 +00:00
Joerg Wunsch
48aee7f33a Upgrade from the author, reflecting all my wishes resulting out of the
sysinstall use of this tool (plus some bug fixes).

2.2 candidate...

Submitted by:	David Nugent <davidn@nserver.usn.blaze.net.au>
1996-12-09 23:55:27 +00:00
Joerg Wunsch
d6f907dc7a pw(8) -- a backend utility to manage the user and group databases.
sysinstall's new User&group menu will use it, hence it's a 2.2
candidate despite of providing new functionality.

Submitted by:	David L. Nugent, <davidn@blaze.net.au>
1996-12-09 14:05:35 +00:00