History log of /freebsd-10.1-release/lib/libutil/pw_util.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 244744 27-Dec-2012 bapt

Add O_CLOEXEC to flopen

Requested by: jilles


# 244735 27-Dec-2012 bapt

Use flopen(3) instead of open(2) + flock(2)


# 242324 29-Oct-2012 bapt

backout r242319, racy and not done in the right place

Reported by: Garrett Cooper <yanegomi@gmail.com>


# 242319 29-Oct-2012 bapt

make pw_init and gr_init fail if the specified master password or group file is
a directory.

MFC after: 1 month


# 237268 19-Jun-2012 bapt

Revert user comparison back to user names as some user can share uids (root/toor
for example)

get the username information from old_pw structures to still allow renaming of a
user.

Reported by: Claude Buisson <clbuisson@orange.fr>
Approved by: des (mentor)
MFC after: 3 weeks


# 231383 10-Feb-2012 ed

Detect file modification properly by using tv_nsec.

POSIX 2008 standardizes st_mtim, meaning we can simply use nanosecond
precision to detect file modification.

MFC after: 2 weeks


# 229572 05-Jan-2012 bapt

Add new pw_make_v7 to make a passwd line (in v7 format) out of a struct passwd
while here, fix missing parentheses of the return statement of pw_make.

Approved by: des (mentor)


# 228545 15-Dec-2011 bapt

Modify pw_copy:
- if pw is NULL and oldpw is not NULL then the oldpw is deleted
- if pw->pw_name != oldpw->pw_name but pw->pw_uid == oldpw->pw_uid
then it renames the user

add new gr_* functions so now gr_util API is similar to pw_util API,
this allow to manipulate groups in a safe way.

Reviewed by: des
Approved by: des
MFC after: 1 month


# 211392 16-Aug-2010 des

Old patch I had lying around: clean up and use stpcpy(3) instead of
sprintf(3).


# 199826 26-Nov-2009 kib

sigset() is the name of function specified by SUSv4.
Replace it to avoid conflict.

MFC after: 3 weeks


# 165906 08-Jan-2007 imp

Remove California Regent's clause 3, per letter


# 162141 08-Sep-2006 thomas

Minor comment fix.


# 161997 04-Sep-2006 thomas

(pw_copy): Handle the case of a malformed line in master.passwd
(copy it silently, do not dereference NULL pointer).

PR: bin/102848
Reviewed by: security-officer (cperciva)
MFC after: 1 week


# 129392 18-May-2004 stefanf

Don't depend on NULL's expansion being a pointer, cast it before it is passed
to variadic functions.

Approved by: das (mentor)


# 121193 18-Oct-2003 markm

ANSIfy, WARNSify, CONSTify. Bit of style(9)-ify.


# 116344 14-Jun-2003 markm

Tidy up. Sort headers.


# 113333 10-Apr-2003 des

Brucify.


# 113305 09-Apr-2003 des

Correctly detect the case where a password entry was changed while we were
preparing to edit it.

PR: bin/50563


# 113301 09-Apr-2003 des

Apply the correct fix for bin/50679: don't mess around with process groups
or the tty, just block selected signals in the parent like system(3) does.
Many thanks to bde for his assistance in finding the correct solution.

PR: bin/50679


# 113265 08-Apr-2003 des

Band-aid for the "^C kills the editor" problem. I haven't yet found the
proper way to fix this. The way this works is to prepend "exec " to
the editor command to eliminate the "shell in the middle" which prevents
us from properly reawakening the editor after a SIGTSTP.

PR: bin/50679


# 112328 17-Mar-2003 das

Make pw_edit() use /bin/sh to interpret the EDITOR environment
variable.

PR: 48748
Reviewed by: mike (mentor)


# 106140 29-Oct-2002 des

Don't forget to '\n'-terminate new entries. This unbreaks chpass -a.

Submitted by: joerg


# 98693 23-Jun-2002 n_hibma

Be more clear in error messages.
Distinguish between a held lock and a failed lock op.

If rpc.lockd is not running on a diskless client this makes clearer
what the problem is.


# 96220 08-May-2002 des

If no old_pw was passed to pw_copy, compare just the name.

Sponsored by: DARPA, NAI Labs


# 96199 07-May-2002 des

Add passwd manipulation code based on parts of vipw and chpass.

Sponsored by: DARPA, NAI Labs


# 94897 16-Apr-2002 des

Make mppath and masterpasswd pointers instead of arrays, and initialize
them to point at static strings that contain the default paths. This
makes 'vipw -d' work again (I broke it in rev 1.21; apologies for taking
so long to fix it.)

Spotted by: Olivier Houchard <doginou@cognet.ci0.org>
Sponsored by: DARPA, NAI Labs


# 94776 15-Apr-2002 des

Remove bogus reference to _use_yp.


# 90233 05-Feb-2002 des

ANSIfy and constify.

Sponsored by: DARPA, NAI Labs


# 79452 09-Jul-2001 brian

Fix the type of the NULL arg to execl()

Idea from: Theo de Raadt <deraadt@openbsd.org>


# 75821 22-Apr-2001 dd

Don't pass NULL to the %s format.

Reviewed by: kris


# 62988 11-Jul-2000 kris

Don't call warn() without a format string.


# 50479 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 48328 28-Jun-1999 pb

Move call to umask(0) back into pw_util(), because the latter
function is also used by chpass(1) and passwd(1).


# 48241 26-Jun-1999 pb

Force umask to 077 (instead of 000) during the edit phase, to get
secure permissions in case the user attempts to save something to
a file of his own.

Move umask stuff out of pw_init() into main() for better visibility
of overall umask tweaking logic.

PR: misc/11797


# 48232 26-Jun-1999 sheldonh

Add -d option to vipw(8) to allow selection of an alternative directory
for the password files.

PR: 2703
Submitted by: jmg


# 41711 12-Dec-1998 dillon

oops. Fix indentation of the 'for' loop I just added.


# 41710 12-Dec-1998 dillon

Handle the race condition where vipw may lock a password file which has
just been replaced. After our lock succeeds we check if st_nlink is 0
and if it is we close the descriptor and retry our open/lock sequence.


# 40538 20-Oct-1998 des

Since vfork() was changed to fork(), we have to pass errno back from the
child to the parent somehow.

PR: 8353
Submitted by: Andrew J. Korty <ajk@purdue.edu>


# 40301 13-Oct-1998 des

Calls one or more of malloc(), warn(), err(), syslog(), execlp() or
execvp() in the child branch of a vfork(). Changed to use fork()
instead.

Some of these (mv, find, apply, xargs) might benefit greatly from
being rewritten to use vfork() properly.

PR: Loosely related to bin/8252
Approved by: jkh and bde


# 30765 27-Oct-1997 charnier

Statisize usage().


# 30113 05-Oct-1997 jkh

Changes to support full make parallelism (-j<n>) in the world
target.
Reviewed by: <many different folks>
Submitted by: Nickolay N. Dudorov" <nnd@nnd.itfs.nsk.su>


# 29980 29-Sep-1997 wosch

Endless loop.

$ vipw
[corrupt a line in editor, exit editor]
pwd_mkdb: corrupted entry
pwd_mkdb: at line #2
pwd_mkdb:
/etc/pw.012585: Inappropriate file type or format
re-edit the password file? [y]: n^D^D
[hang]


# 28662 24-Aug-1997 joerg

Cosmetic: distinguish in diag message between rebuilding and updating
the database.

PR: 3397
Submitted by: taob@risc.org (Brian Tao)


# 16876 01-Jul-1996 guido

Implement incremental passwd database updates. This is done by ading a '-u'
option to pwd_mkdb and adding this option to utilities invoking it.
Further, the filling of both the secure and insecure databases has been
merged into one loop giving also a performance improvemnet.
Note that I did *not* change the adduser command. I don't read perl
(it is a write only language anyway).
The change will drastically improve performance for passwd and
friends with large passwd files. Vipw's performance won't change.
In order to do that some kind of diff should be made between the
old and new master.passwd and depending the amount of changes, an
incremental or complete update of the databases should be agreed
upon.


# 10048 13-Aug-1995 wpaul

Small NIS tweak: frob pw_error() a little so that it can say either
'NIS information unchanged' or '/etc/master.passwd unchanged'
depending on which was is being modified (conditional on -DYP).

This is to save me the trouble of writing a whole other error
routine (nis_error()?) for the upcoming changes to passwd and
chpass.


# 8857 30-May-1995 rgrimes

Remove trailing whitespace.


# 6972 09-Mar-1995 ache

Fix suspended vipw hangs
Obtained from: NetBSD


# 1553 26-May-1994 rgrimes

BSD 4.4 Lite usr.sbin Sources