Commit Graph

91 Commits

Author SHA1 Message Date
sevan f7a3540ecf Drop main() prototype. 2017-05-04 16:26:09 +00:00
christos 9cfdbcfd93 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.
2014-01-26 01:57:04 +00:00
pooka 4037e69f4e 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?)
2012-11-26 20:13:54 +00:00
plunky 9f61b80465 NULL does not need a cast 2011-08-31 16:24:54 +00:00
joerg bec77c5f43 Use __dead 2011-08-31 13:32:36 +00:00
joerg 1c874f86e1 Use of non-literal format string 2011-08-25 16:53:25 +00:00
wiz a148caca6e Fix fd leaks in error cases. Found by cppcheck. 2011-01-04 10:01:51 +00:00
wiz 3d5790d7f6 Sort sections. 2010-08-18 10:00:49 +00:00
christos d8bfbcfa53 add syslog logging. 2010-08-18 08:06:39 +00:00
snj 34d0fbb3ff Add a missing semicolon. Noted by Tomasz Motyl in PR bin/42603. 2010-01-10 19:04:35 +00:00
joerg 4e2447c901 Don't leak two file descriptors in cp(). From Igor Zinovik.
Explicitly check the close for errors and bail out if needed.
2010-01-10 16:40:00 +00:00
joerg 3e36bb3dce Drop __SCCSID. It is only of archeological interest. 2009-11-06 15:00:31 +00:00
enami fad8f6cbde - 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.
2009-08-25 09:27:25 +00:00
christos c08a8944a8 fix typo 2009-06-20 16:19:46 +00:00
christos adee5457b1 don't complain if file does not exist either. 2009-06-20 14:25:47 +00:00
christos 33681fbe60 Fix for unprivileged build. 2009-06-19 16:46:52 +00:00
christos e946d9550c pass lint 2009-06-19 15:23:26 +00:00
wiz e6a36c516d Sort sections. New sentence, new line. Punctuation fixes. 2009-06-19 05:50:39 +00:00
christos 2739d569fd allow overwriting the version record. 2009-06-18 22:13:56 +00:00
christos 9dbe62df2a remove duplicated code by merging the insecure and secure database handling.
add warning flag.
2009-06-18 21:59:24 +00:00
christos ed742f5718 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.
2009-06-18 17:46:24 +00:00
lukem 4780f87772 Fix WARNS=4 issues (-Wsign-compare -Wcast-qual) 2009-04-18 08:08:36 +00:00
apb 09ba0a6ca8 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.
2009-03-06 19:05:11 +00:00
sketch 7ce9d1c8ea 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.
2009-02-24 22:25:24 +00:00
uebayasi 9281ce080c Make nbpwd_mkdb always generate version 1 by deciding version depending on
sizeof(pw_change).  No objection on tech-userlevel.
2009-02-02 04:24:18 +00:00
jmmv 9b08dc4841 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).
2009-01-16 10:42:36 +00:00
christos 5f47ffa430 Oops, forgot to merge this. 2009-01-14 23:18:57 +00:00
lukem 9c1945664c Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 13:36:57 +00:00
wiz 09cb1d6f1c s/existance/existence/, from Zafer. 2006-11-24 22:52:16 +00:00
wiz 4257327293 New sentence, new line. Add -c to SYNOPSIS.
Create EXIT STATUS section. Bump date for previous.
2006-09-23 20:09:41 +00:00
sketch e72d64c28d Resolve the second part of PR/19387 from Greg Woods: print error correctly. 2006-09-23 17:38:42 +00:00
sketch 4fea323db6 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.
2006-09-23 17:17:04 +00:00
hubertf 105b456cb7 Mention pwhash(1) in a few places,
suggested in PR 31125 by Stefan Schumacher.
2005-09-05 03:37:14 +00:00
lukem 90b888928b appease gcc -Wuninitialized 2005-06-02 09:18:14 +00:00
jmc b2f782612f 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
2004-06-20 22:20:14 +00:00
lukem 171d653219 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).
2003-10-27 00:12:41 +00:00
agc 9f1aac5bb3 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.
2003-10-13 15:36:33 +00:00
agc 326b2259b7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22366, verified by myself.
2003-08-07 11:25:11 +00:00
lukem 826a14607a Now that <bsd.prog.mk> DTRT if HOSTPROG is defined (i.e, it is a no-op),
there's no need to special-case .include-ing it.
2003-05-18 07:57:31 +00:00
itojun d0f8b66023 strncpy -> strlcpy 2003-05-17 19:18:59 +00:00
lukem 17d72c8a6b use NETBSDSRCDIR as appropriate 2002-09-18 03:54:26 +00:00
tv 9fbd88883c 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.
2002-01-31 22:43:33 +00:00
tv a328e34106 Make almost all tools compile and run properly on non-NetBSD hosts. (In
particular, most tools now run correctly on Solaris 7.)
2002-01-29 10:20:28 +00:00
wiz a2d753e3ef Whitespace nits. 2002-01-19 11:44:57 +00:00
lukem 92a4d3d477 pwd_mkdb doesn't need a private version of getpwent.o any more. 2002-01-15 11:41:43 +00:00
jmc 0ce9aa8e6c Add pwd_mkdb as a toolchain bit for builds 2001-12-07 02:28:53 +00:00
ad e04fd20395 Clean up previous. 2001-08-19 09:01:47 +00:00
ad e13d145336 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.
2001-08-18 19:29:31 +00:00
abs 46bc122c3c Do not try to reference dbm(3) 2001-07-06 18:07:15 +00:00
agc 2add959bb8 Mention that useradd(8), userdel(8) and usermod(8) all conform to the
locking scheme, and cross reference those utilities.
2001-02-21 12:14:37 +00:00