Home | History | Annotate | Download | only in pwd_mkdb
History log of /src/usr.sbin/pwd_mkdb/pwd_mkdb.c
RevisionDateAuthorComments
 1.61  04-Oct-2024  christos add some static. remove trailing whitespace
 1.60  19-Jan-2024  christos simplify, we need to hard code the constant for tools anyway.
 1.59  27-Nov-2021  rillig usr.sbin: remove unnecessary CONSTCOND, lint no longer needs it

Since 2021-01-31, lint no longer requires a CONSTCOND comment in a
do-while-0 statement since this is a common code pattern, especially in
statement-like macros.

sed -i -E 's,} while \(/\* ?CONSTCOND ?\*/ ?0\),} while (0),' */*.[ch]
 1.58  04-May-2017  sevan Drop main() prototype.
 1.57  26-Jan-2014  christos branches: 1.57.16;
Fix the "separate root" test. If we get a permission error check for separate
root. But if we get ENOENT, always succeed. Otherwise if someone removes
the db files or they get corrupted, you can never recreate them.
 1.56  26-Nov-2012  pooka Attempt 2 at fixing DragonFly util.h conflicts: include util.h only for
non-tool builds.
(why does the tool build prefer host headers instead of compat headers?)
 1.55  31-Aug-2011  plunky branches: 1.55.2; 1.55.8;
NULL does not need a cast
 1.54  31-Aug-2011  joerg Use __dead
 1.53  04-Jan-2011  wiz Fix fd leaks in error cases. Found by cppcheck.
 1.52  18-Aug-2010  christos add syslog logging.
 1.51  10-Jan-2010  snj Add a missing semicolon. Noted by Tomasz Motyl in PR bin/42603.
 1.50  10-Jan-2010  joerg Don't leak two file descriptors in cp(). From Igor Zinovik.
Explicitly check the close for errors and bail out if needed.
 1.49  06-Nov-2009  joerg Drop __SCCSID. It is only of archeological interest.
 1.48  25-Aug-2009  enami - The value getdbent() returns when no record is found is not -1 but 1.
Testing if it returns -1 is always false.
- Use the same expression for the size to write and for the size to
advance a pointer.
 1.47  20-Jun-2009  christos fix typo
 1.46  20-Jun-2009  christos don't complain if file does not exist either.
 1.45  19-Jun-2009  christos Fix for unprivileged build.
 1.44  19-Jun-2009  christos pass lint
 1.43  18-Jun-2009  christos allow overwriting the version record.
 1.42  18-Jun-2009  christos remove duplicated code by merging the insecure and secure database handling.
add warning flag.
 1.41  18-Jun-2009  christos support reading and writing both version 0 and version 1 databases using
-V <version>. By default the databases stay in their current version when
rebuilding/updating.
 1.40  18-Apr-2009  lukem Fix WARNS=4 issues (-Wsign-compare -Wcast-qual)
 1.39  06-Mar-2009  apb Replace local swap16, swap32, and swap64 inline functions with the
NetBSD conventional bswap16, bswap32, and bswap64 functions or macros.

In a non-tools build, include <sys/types.h> and <machine/bswap.h> to
get definitions of these functions. In a tools build, rely on the
functions or macros being provided by nbtool_config.h, but don't incluce
<machine/bswap.h> (which might not exist in a cross build).

This should address a problem building on OpenBSD, which has swap16,
swap32, and swap64 macros that conflicted with the local definitions.
The problem was reported by Alexander Bluhm, but this patch is quite
different from the one he suggested.
 1.38  24-Feb-2009  sketch Make 'build.sh tools' work with the Sun Studio compiler, although bugs in
some of the generated tools still prevent building a full release using them.
 1.37  02-Feb-2009  uebayasi branches: 1.37.2;
Make nbpwd_mkdb always generate version 1 by deciding version depending on
sizeof(pw_change). No objection on tech-userlevel.
 1.36  16-Jan-2009  jmmv Make sure that the database version is correct if we are updating a single
record; otherwise, bail out early to avoid leaving the database in an
inconsistent state (some old-format records, one new-format record).
 1.35  14-Jan-2009  christos Oops, forgot to merge this.
 1.34  21-Jul-2008  lukem branches: 1.34.6;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.33  24-Nov-2006  wiz branches: 1.33.18;
s/existance/existence/, from Zafer.
 1.32  23-Sep-2006  sketch Resolve the second part of PR/19387 from Greg Woods: print error correctly.
 1.31  23-Sep-2006  sketch Add a -c flag to specify the size of cache to use. For very large databases,
increasing this value accordingly gives massive speed improvements.

Prompted by Greg Woods in PR/19387, although mostly taken from FreeBSD.
 1.30  02-Jun-2005  lukem appease gcc -Wuninitialized
 1.29  20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.28  27-Oct-2003  lukem branches: 1.28.2;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.27  13-Oct-2003  agc Move Jason Downs's code from a 4-clause to a 3-clause licence by
removing the advertising clause. Diffs provided in PR 22410 by Joel
Baker, confirmed to the board by Jason Downs.

With additional thanks to Jason Thorpe.
 1.26  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22366, verified by myself.
 1.25  17-May-2003  itojun strncpy -> strlcpy
 1.24  31-Jan-2002  tv Roll in fixes to permit cross-compiling from non-NetBSD hosts. This
round has been tested on Solaris/x86 and Linux hosts.

* Add host tools cap_mkdb, ctags, m4, uudecode.
* Protect __RCSID() and __COPYRIGHT() better.
* Reduce the number of places that need to include "config.h", to keep
sources closer to their "vanilla" versions.
* Add more compat #defines and autoconf-checked functions.
 1.23  29-Jan-2002  tv Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
 1.22  18-Aug-2001  ad Speed things up a bit. Parts dredged from OpenBSD/FreeBSD.

- Add -u option, to update one user's records only.
- Add -s option, to update the secure database only.
- Give us roughly 1MB of cache per 50kB of password file, but keep within
a 2MB minimum and 8MB maximum.
- Tidy a little.
 1.21  20-Nov-2000  tron Use empty string as default prefix so that e.g "/etc/spwd.db" is used
instead of "//etc/spwd.db".
 1.20  08-Aug-2000  ad Remove extraneous M_32_SWAP().
 1.19  07-Aug-2000  ad - Move some duplicated code from main() into subroutines. In doing this,
fix -p (it was broken if used in conjunction with either -B or -L).
- const, KNF.
 1.18  07-Jul-2000  itojun errx?/warnx? audit. do not pass variable alone, use %s. idea from openbsd
 1.17  23-Jan-2000  mycroft branches: 1.17.4;
Add explicit endianness overrides.
 1.16  27-Jul-1998  mycroft const poisoning.
 1.15  08-Jun-1998  lukem treat single "+" as "+:::::::::" (pw_scan() doesnt like former). minor KNF
 1.14  07-Jun-1998  lukem clear flags before calling pw_scan()
 1.13  14-Apr-1998  fair fix my boo-boo documented by PR#5293
 1.12  14-Apr-1998  fair A few more error message changes for better information.
 1.11  13-Apr-1998  fair Handle the problem cited in PR#1328 (no checking for I/O errors).

Improve some of the error messages to provide more accurate information.

Repaired a bug by inspection (function pointer reference through a
free'd DB structure!! How did this *ever* work?)
 1.10  17-Oct-1997  lukem branches: 1.10.2;
WARNSify, getopt returns -1 not EOF
 1.9  24-Nov-1996  thorpej Print a warning to stderr if a YP inclusion (`+') specifies a value of
0 for uid or gid. Based on a patch posted to tech-userlevel by
Paul Kranenburg <pk@NetBSD.ORG>.
 1.8  22-Nov-1996  lukem Implement '-d directory' option, to override the default of '/'.
Useful for building ~ftp/etc/pwd.db without using chroot or unionfs.
Inspired by FreeBSD, closes [bin/2566]
 1.7  15-May-1996  jtc Updated to use new password file functions in libutil.
From Greg Hudson <ghudson@MIT.EDU>.
 1.6  28-Jul-1995  phil Improvements to YP support from Jason Downs.
 1.5  28-Aug-1994  mycroft branches: 1.5.2;
Update to 4.4-Lite version.
 1.4  10-Apr-1994  cgd DTRT is a too-restricve umask is specified. Bug pointed out by Andrew Chernov.
 1.3  01-Aug-1993  mycroft Add RCS identifiers.
 1.2  21-Apr-1993  proven Changed pwd_mkdb to use dbopen.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  28-Aug-1994  mycroft Import original 4.4-Lite version.
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.5.2.2  28-Aug-1994  mycroft Update to 4.4-Lite version.
 1.5.2.1  28-Aug-1994  mycroft file pwd_mkdb.c was added on branch netbsd-1-0 on 1994-08-28 23:32:55 +0000
 1.10.2.1  08-May-1998  mycroft Pull up 1.11-1.13, per request of fair.
 1.17.4.4  03-Feb-2001  he Pull up revision 1.21 (requested by tron):
Use empty string as default prefix so that e.g. ``/etc/spwd.db''
is used instead of ``//etc/spwd.db''.
 1.17.4.3  09-Aug-2000  ad Pull up revision 1.20 (approved by releng-1-5):
Remove extraneous M_32_SWAP().
 1.17.4.2  07-Aug-2000  ad Pull up revision 1.19 (approved by releng-1-5):
- Move some duplicated code from main() into subroutines. In doing this,
fix -p (it was broken if used in conjunction with either -B or -L).
- const, KNF.
 1.17.4.1  27-Jul-2000  itojun pullup (approved by releng-1-5)
printf-like format pedant. do not pass string variable alone. use "%s".
from openbsd.

/cvsroot/basesrc/usr.sbin/netgroup_mkdb/netgroup_mkdb.c 1.9 -> 1.10
/cvsroot/basesrc/usr.sbin/pwd_mkdb/pwd_mkdb.c 1.17 -> 1.18
/cvsroot/basesrc/usr.sbin/quotaon/quotaon.c 1.14 -> 1.15
/cvsroot/basesrc/usr.sbin/rdate/rdate.c 1.10 -> 1.11
/cvsroot/basesrc/usr.sbin/rpc.yppasswdd/yppasswdd_mkpw.c 1.5 -> 1.6
/cvsroot/basesrc/usr.sbin/traceroute6/traceroute6.c 1.12 -> 1.13
/cvsroot/basesrc/usr.sbin/wsconscfg/wsconscfg.c 1.6 -> 1.7
/cvsroot/basesrc/usr.sbin/ypserv/revnetgroup/revnetgroup.c 1.7 -> 1.8
/cvsroot/basesrc/usr.sbin/ypserv/ypserv/ypserv.c 1.10 -> 1.11
 1.28.2.1  22-Jun-2004  tron Pull up revision 1.29 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.33.18.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.34.6.2  28-Dec-2008  christos - provide and use our own swapping functions instead of db's (XXX convert
to htole?)
- add version record.
 1.34.6.1  21-Jul-2008  christos file pwd_mkdb.c was added on branch christos-time_t on 2008-12-28 01:21:23 +0000
 1.37.2.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.55.8.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.8.1  25-Feb-2013  tls resync with head
 1.55.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.55.2.1  16-Jan-2013  yamt sync with (a bit old) head
 1.57.16.1  11-May-2017  pgoyette Sync with HEAD

RSS XML Feed