Commit Graph

35 Commits

Author SHA1 Message Date
bapt
4469579834 Cleanup a bit includes 2015-08-02 13:22:46 +00:00
bapt
c6afeed630 Add a new global struct pwconf to store etcpath, rootdir and struct userconf
Do not add anymore -R and -V to arglist
Add an error message if both -V and -R are set in arguments
2015-06-07 14:34:38 +00:00
bapt
dd2cfeb01c Remove uneeded intermediate variable 2015-05-31 10:18:10 +00:00
bapt
ebdc3de2ac The pwdb function is only used once to check the database rename it
pwdb_check and simplify it accordingly
2015-05-10 09:23:03 +00:00
bapt
15b9b89c4b if the check of the pw db fails return the failed value 2015-05-10 09:11:12 +00:00
bapt
cac4a2a5a5 Some style(9) fixes 2015-05-10 09:02:15 +00:00
bapt
9afcc43d24 Fix changing the username
PR:		189172
Submitted by:	fullermd@over-yonder.net
MFC after:	1 week
2014-06-20 10:38:08 +00:00
bapt
85394787a6 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
bapt
13dabd466a 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
eadler
91505a4776 Use strdup instead of malloc + strcpy
Submitted by:	db
Approved by:	cperciva
MFC after:	2 weeks
2012-12-05 13:56:49 +00:00
bapt
cfea627c58 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
kevlo
a93e845e54 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
jhb
42cd7531f9 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
stefanf
d768a89209 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
fjoe
b24e1d7b2a Do not expose password if it is empty and PWF_STANDARD format is requested
MFC after:	1 week
2003-01-23 19:51:48 +00:00
nectar
deebe243c0 Use correct mode for temporary file.
Reported by:	ryan beasley <ryanb@goddamnbastard.org>
2001-12-20 16:03:04 +00:00
brian
9e766e7f13 Handle snprintf() returning < 0 (not just -1)
MFC after:	2 weeks
2001-08-20 15:09:34 +00:00
brian
d48c427cd5 Handle snprintf() returning -1.
MFC after:	2 weeks
2001-08-20 13:24:39 +00:00
davidn
c85586d6d2 Don't dereference NULL in the userdel case. 2000-06-26 01:11:44 +00:00
davidn
faaa880c55 Second and hopefully final fix to .db sync when renaming a user; we must run
a full reindex in this case to remove the old record. #ifdef -u capability
since this is available on FreeBSD only.
PR: bin/16418
Problem pointed out by:	Masachika ISHIZUKA <ishizuka@ish.org>
2000-06-18 02:16:07 +00:00
davidn
bb77488761 Fix db syncronization when username is changed with -l under usermod.
pw(8) was calling pwd_mkdb -u oldusername instead of newusername, so
the update appears to have failed until the next full pwd_mkdb
syncronization.

PR:		bin/16418
2000-06-06 07:33:00 +00:00
davidn
297001db2a Missed statement in password update relating to the previous change
to fileupdate() which prevented pwd_mkdb(1) from being run.
1999-10-26 08:30:20 +00:00
davidn
7f7ff280d1 Clean up error handling in fileupdate(), which now returns 0 on success
instead of a boolean. This replicated through he front-end sub-functions
relating to add, delete, modify entries in passwd & group files
Errno is now preserved so output of errc()/warnc() will be less obfuscated
by subsequent errors when reporting the problem.

Add more intelligent error handling when attempting to modify/delete NIS
entries with no corresponding local database entry.

[MFC to stable in a couple of weeks to keep both in sync]
1999-10-26 04:27:14 +00:00
sheldonh
1f6d5bd10b Only do a full pwd_mkdb for deletions; other operations may use the -u
option as an optimization.

PR:	13346
Submitted by:	Neil Blakey-Milner <nbm@rucus.ru.ac.za>
1999-08-30 10:35:38 +00:00
peter
efabb9ccb1 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
davidn
aea1f6bc3c 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
wosch
95821ff4ba pwd_mkdb option '-c' was renamed to -C some weeks ago.
PR: bin/5715
Submitted by:  dannyman <dannyman@arh0300.urh.uiuc.edu>
1998-02-11 23:31:24 +00:00
charnier
c4198a70c7 Use err(3) instead of local redefinition. Add rcsid string. 1997-10-10 06:23:42 +00:00
peter
b782f4df30 Revert $FreeBSD$ to $Id$ 1997-02-22 16:15:28 +00:00
jkh
808a36ef65 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
davidn
923b71f7ef Remove duplicated #include. 1997-01-05 04:54:24 +00:00
davidn
ae5c463397 1) 200 users per group limitation removed and pw
will handle lines of any length in /etc/group.
2)	Fixed bug with usermod -d not updating user's home
	directory.
3)	Minor formatting display changes/fixes with *show -P.
1996-12-21 15:35:45 +00:00
joerg
7b15aed015 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
cb39d6c976 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
4a198ee0cb 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