History log of /freebsd-10.0-release/usr.sbin/pwd_mkdb/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

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


227257 06-Nov-2011 ed

Mark global functions and/or variables in pwd_mkdb(8) static where possible.

This allows compilers and static analyzers to do more thorough analysis.


223818 06-Jul-2011 gordon

Only increment the ypcnt once per data record. The old implementation
was incrementing it twice making it impossible to iterate the table
since the records were 1, 3, 5, 7 (or 2, 4, 6, 8 for the v3 records).

MFC after: 10 days


201390 02-Jan-2010 ed

The last big commit: let usr.sbin/ use WARNS=6 by default.


192432 20-May-2009 brian

Verify that the username length is smaller than MAXLOGNAME when
asked to verify a passwd file (pwd_mkdb -C).

Entries with oversized usernames are still permitted when building
the passwd database.

When entries are >= MAXLOGNAME in length, they are correctly stored
in passwd, pwd.db and spwd.db but are only correctly retrieved by
getpwent*() and getpwuid*(). getpwnam*() truncates to MAXLOGNAME - 1
when reading from a file (breaking at least sh, tcsh and bash)
and utilities such as su(1) check, complain and fail if the
passed name is >= MAXLOGNAME in length.

MFC after: 3 weeks


147395 15-Jun-2005 dd

Correctly handle an input file without a newline on the last line (and
avoid the confusing error message about the line being too long). This
change uses fgetln to detect the right conditions, but the fixed-width
line buffer is kept because too many other places in the program make
assumptions about its maximum width.

Approved by: re (scottl)


146755 29-May-2005 charnier

Even if variable is never used uninitialized by the semantic, reduce compiler
warning by giving an initial value in all cases.


142832 28-Feb-2005 ru

Add endianness support.

While version 4 entries are architecture-independent, we
also store old (version 3) entries in native byte order.
Also, the hash itself is created in a native byte order.

With this change, pwd_mkdb(8) can be used to cross-build
*pwd.db files for another architecture.

Tested on: i386, amd64, alpha, sparc64


141607 10-Feb-2005 stefanf

Turn K&R functions into prototypes.


140442 18-Jan-2005 ru

Sort sections.


133249 07-Aug-2004 imp

Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived software
(with permission of addtional copyright holders where appropriate)


133176 05-Aug-2004 imp

Add 'i' to the getopt string.

Noticed by: jhein


132509 21-Jul-2004 imp

Add support for ignoring locking failures. This is only enabled when
you've specified a directory. It is intended to be used in building
custom releases over NFS where locking may be unreliable at best and
there is no contention that the locking is designed to arbitrate.
Other uses of this flag are discouraged. Document same in usage and
man page (including the warning about unwise).

Sponsored by: Timing Solutions


132507 21-Jul-2004 imp

Two style related changes:
(1) use strlcpy instead of strncpy since the use here of the latter
was incorrect.
(2) Move 'N' case into proper sorted order (sorted the same way that
ls sorts its args).


131500 02-Jul-2004 ru

Mechanically kill hard sentence breaks.


114601 03-May-2003 obrien

Use __FBSDID over rcsid[]. Protect copyright[] where needed.


114159 28-Apr-2003 nectar

When updating a single entry (i.e. when the `-u' option is given),
do not add the "\xFF" "VERSION" key --- it should only be added once
ALL entries have been updated.

While I'm here, correct the logic that detects whether or not the
user-ID has changed so that it works even if all entries have not
yet been updated to the new format.

Users missing-in-action were
Reported by: tjr, Vallo Kallaste <vallo@estcard.ee>,
leafy <leafy@leafy.idv.tw>

Sponsored by: DARPA, Network Associates Laboratories


113666 18-Apr-2003 nectar

Revert the definitions of _PW_KEY* to their previous values. There is
at least one consumer outside of libc and pwd_mkdb.
Adjust the versioning in libc and pwd_mkdb accordingly.

named was the application affected, and that fact was first
Reported by: Zherdev Anatoly <tolyar@mx.ru>

Sponsored by: DARPA, Network Associates Laboratories


113596 17-Apr-2003 nectar

= Implement thread-safe versions of the getpwent(3) and getgrent(3)
family of functions using the new nsdispatch(3) core. Remove
arbitrary size limits when using the thread-safe versions.

= Re-implement the traditional getpwent(3)/getgrent(3) functions on
top of the thread-safe versions.

= Update the on-disk format of the hashed version of the passwd(5)
databases to allow for versioned entries. The legacy version is
`3'. (Don't ask.)

= Add support for version `4' entries in the passwd(5) database.
Entries in this format are identical to version 3 entries except
that all integers are stored as 32-bit integers in network byte
order (big endian).

= pwd_mkdb is updated to generate both version 3 and version 4
entries.

Sponsored by: DARPA, Network Associates Laboratories


113091 04-Apr-2003 obrien

style.Makefile(5)


107788 12-Dec-2002 ru

Uniformly refer to a file system as "file system".

Approved by: re


99968 14-Jul-2002 charnier

The .Nm utility


99819 11-Jul-2002 alfred

WARNS=4 cleanup, de-__P()


96705 16-May-2002 trhodes

Consistancy check: s/file system/filesystem/g


91923 09-Mar-2002 dd

When reporting that a line is too long, include the line number in the
error message. While I'm here, add a note that the "line too long"
message isn't always accurate.

PR: 35395
Submitted by: andrew@ugh.net.au


85572 27-Oct-2001 peter

Explicitly use int32_t for on-disk records for pw_change and pw_expire,
since that is what we use now and this insulates us from any time_t
tweaks here. We can define a record format that uses 64 bit times if/when
we need to.


81144 04-Aug-2001 dd

It's bad enough to capitalize the name of the executable at the
beginning of the sentence, but at the very least it shouldn't be done
in the middle of a sentence!


80029 20-Jul-2001 obrien

Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.


79755 15-Jul-2001 dd

Remove whitespace at EOL.


74816 26-Mar-2001 ru

- Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.


74532 20-Mar-2001 ru

Set the default manual section for usr.sbin/ to 8.


68965 20-Nov-2000 ru

mdoc(7) police: use the new features of the Nm macro.


65532 06-Sep-2000 nectar

Add nsswitch support. By creating an /etc/nsswitch.conf file, you can
configure FreeBSD so that various databases such as passwd and group can be
looked up using flat files, NIS, or Hesiod.

= Hesiod has been added to libc (see hesiod(3)).

= A library routine for parsing nsswitch.conf and invoking callback
functions as specified has been added to libc (see nsdispatch(3)).

= The following C library functions have been modified to use nsdispatch:
. getgrent, getgrnam, getgrgid
. getpwent, getpwnam, getpwuid
. getusershell
. getaddrinfo
. gethostbyname, gethostbyname2, gethostbyaddr
. getnetbyname, getnetbyaddr
. getipnodebyname, getipnodebyaddr, getnodebyname, getnodebyaddr

= host.conf has been removed from src/etc. rc.network has been modified
to warn that host.conf is no longer used at boot time. In addition, if
there is a host.conf but no nsswitch.conf, the latter is created at boot
time from the former.

Obtained from: NetBSD


57868 09-Mar-2000 paul

Fix various unsigned vs signed errors that caused problems with uids
and gids bigger than 16 bits. Added checks for uids and gids that are
bigger than 32 bits.

Approved by: jkh (partly, this fix is bigger than I first intended)


57673 01-Mar-2000 sheldonh

Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.


54034 02-Dec-1999 sheldonh

Replace the -q option to pwd_mkdb with a test for PW_SCAN_BIG_IDS in
the environment. This allows big ID warnings to be suppressed for
vipw and chpass as well.

Since the environment variable test is only performed for callers
of pw_scan() that do not set pw_big_ids_warning, the test can still
be overriden. Currently, chpass and pwd_mkdb are the only users
of pw_scan() and neither of them overrides the environment variable
test.


53581 22-Nov-1999 eivind

Allow empty UIDs if we are processing NIS records. I am not entirely
happy with how this end up and will re-visit the entire empty field
problem, but this patch solves the NIS problem for now.

Submitted by: Dan Nelson <dan@emsphone.com>
PR: 14865,14984


53183 15-Nov-1999 sheldonh

Add to pwd_mkdb a -q option to silence warnings about large IDs. Add a
suitably ominous warning in the manual page.

The diff applied is not the one provided in the attributed PR.

PR: 13344
Reviewed by: bde


52921 06-Nov-1999 eivind

Flag empty UID entries as errors (to stop typos from turning into
alternate root accounts).


51025 06-Sep-1999 peter

Unifdef -DPASSWD_IGNORE_COMMENTS. This wasn't really optional and
we have enough pseudo-options already.


50700 31-Aug-1999 sheldonh

Back out previous commit. I mistook passing commentary from bde for
review.

Requested by: bde


50644 30-Aug-1999 sheldonh

Only issue a warning for the first occurrence of a UID > USHRT_MAX and
the first occurrence of a GID > USHRT_MAX.

PR: 13344
Reviewed by: bde


50479 28-Aug-1999 peter

$Id$ -> $FreeBSD$


48791 12-Jul-1999 nik

Add $Id$, to make it simpler for members of the translation teams to
track.

The Id line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

.\" $Id$
.\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by: bde


42241 01-Jan-1999 billf

Enable source file locking in pwd_mkdb by including the proper letter
in getopt(). The code was there, the means to use it wasn't.

Also update the usage() statment to reflect reality.

PR: bin/9248
Submitted by: Jos Backus <jbackus@plex.nl>
Forgotten By: dillon


41712 13-Dec-1998 dillon

PR: bin/3478

Have pwd_mkdb lock the source file while rebuilding the database. When
called by programs such as vipw, the source file is a temporary file and
this does not conflict with the lock on /etc/master.passwd already held
by vipw. When run manually, however, master.passwd is typically specified
as the argument and the locking prevents other programs from messing with
master.passwd during the database rebuild.

Also pwd_mkdb uses a blocking exclusive lock as it may be called from
a script. The -N option was added to cause pwd_mkdb to get the lock
non-blocking and exit with an error if the attempt fails, again useful
for scripts.


41697 12-Dec-1998 foxfair

Close PR bin/8753 pwd_mkdb problem when having comments in passwd file

Submitted by Chia-liang Kao clkao@CirX.ORG .


39777 29-Sep-1998 dt

Rename a static variable, so it will not shadowed by a local variable.
Now comments will be ignored, rather than put junk in the password database.

Broken in: rev. 1.21


36820 09-Jun-1998 ache

Fix usage string


35286 19-Apr-1998 phk

Allow specification of cache-size to pwd_mkdb
PR: 5193
Reviewed by: phk
Submitted by: Nick Hilliard <nick@foobar.org>


33614 19-Feb-1998 guido

Reenable building of /etc/passwd.
Pointed out by: "Julie M. Juracich" <julie@xaqti.com>


33434 16-Feb-1998 guido

Apparently, if fprintf() fails, it can return any negative value
Pointed out by: Bruce


33413 15-Feb-1998 guido

Check return values of fprintf, fclose (this one is overdone I guess)
and pw_db->close.
PR: 4202 (probably, I askd the submitter)
Obtained from: OpenBSD


32397 10-Jan-1998 wosch

Rename the pwd_mkdb(8) option '-c' to '-C' for better compatiblity
with BSD/OS.


30260 10-Oct-1997 charnier

Staticize usage(). Cosmetics.


28385 18-Aug-1997 jlemon

db close routine actually writes data out to disk; return value was
not being checked. Change code to fail if db->close errors.

PR: 4202


24599 04-Apr-1997 mpp

Document the -u option.

Forgotten by: guido


24428 31-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


24059 20-Mar-1997 davidn

Fix possible (not stack) overflow from -d <dir> commandline option.


23517 08-Mar-1997 wosch

Allow comments in password database. The comments are copied from
the password file into /etc/master.passwd and optional (-p) into
/etc/passwd. Enable this feature with the compile
option -DPASSWD_IGNORE_COMMENTS.

The character `#' introduces a comment. Leading spaces and tabs are
ignored: '^[ \t]*#.*\n$'

Count an empty line - only spaces, tabs or newline - also as a comment.
An empty line at the bottom of /etc/master.passwd is a common
novice error and increased my mail load: '^[ \t]*\n$'


19085 22-Oct-1996 wpaul

Begin closing out PR #1519 (this requires a change to chpass too,
and both changes need to be pulled into the stable branch). The
problem here is that when pwd_mkdb creates /etc/passwd, it turns
empty UID and GID fields into zeroes. To fix this, we check the
_PWF_UID and _PWF_GID bits in the pw_fields flag: if the bits
are not set, we print an empty field instead of a zero. This way,
you don't get zeroes in the UID or GID fields unless you explicit
want them.


17672 19-Aug-1996 wosch

New option: [-c]
Check if the password file is in the correct format. Do not
change, add, or remove any files.


17125 12-Jul-1996 bde

Fixed brackets in usage message.

Reformatted some of recent changes to KNF.


16946 03-Jul-1996 martin

Check if username is a NULL pointer before dereferencing it.


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.


16552 20-Jun-1996 julian

Submitted by: archie@whistle.com
This program should COMPLAIN about uids > 65K but not abort.. they are after
all legal, and some of us NEED them!


15268 16-Apr-1996 wpaul

NIS cleanups and fixes, the next generation, continued.

pwd_mkdb.c:

- Don't save the PLUSCNT and MINUSCNT tokens: we don't need them anymore.

- Count the + and - entires for NIS together instead of counting + and -
entries seperately. Index all special NIS entries using new _PW_KEYYPBYNUM
token.

pwd.h:

- Remove the PLUSBYNUM, MINUSBYNUM, PLUSCNT and MINUSCNT tokens and replace
then with a single _PW_KEYYPBYNUM token.


8857 30-May-1995 rgrimes

Remove trailing whitespace.


7326 24-Mar-1995 jkh

Add what looks to be the right fix to this bogus code.


7291 23-Mar-1995 wpaul

Re-enable +::::::::: wildcards that I had previously disallowed.

Note: if you put +::0:0:::::: in /etc/master.passwd as your only NIS
entry, it will cause all NIS uids and gids to be remapped to zero. This
is *intentional*. That's the way it's supposed to work. Enabling NIS with
no remapping at all is done with +:::::::::, not +::0:0::::::. Similarly,
+:::::::::/bin/csh will remap the shells of all NIS users to /bin/csh.
Or, you could do +wpaul:::::::::/bin/csh to remap NIS user wpaul's shell
to /bin/csh but leave everyone else alone.


7277 23-Mar-1995 wpaul

Summarily enable YP as soon as any a '+' is detected instead of generating
special values when +user substitutions are in effect. The new getpwent
code can handle all the special cases itself now.


7257 23-Mar-1995 wpaul

- Add support for embedding special entries in the password databases
for +@netgroup/-@netgroup entries. This saves the getpwent functions
from having to do all the work.

- Fix potential bug: when pwd_mkdb writes the YP-enabled flag to the secure
password database, it uses the wrong database descriptor. (It uses the
descriptor from the non-secure database, which is already closed by the time
things are being written into the secure dastabase).


5964 27-Jan-1995 dg

Be sure to properly fail if there are not enough fields. Problem
reported by MARC Giannoni <marc@cmc.eng.comsat.com>, this fix is by me.


2934 20-Sep-1994 wollman

Fix security hole in YP password support, which wouldmake +user entries
act like + entries in some cases. Requires support in libc from next
commit.


2916 20-Sep-1994 wollman

Maintain pw_fields, and output same to password database.

!!!!!!!!
NB
!!!!!!!!
You MUST pwd_mkdb /etc/master.passwd before attempting to use the new
libc, or things may go wrong. (I doubt anything actually /will/ go
wrong, but the actual behavior is undefined. YOU HAVE BEEN WARNED.)
The database format is, however, backwards-compatible, so old executables
will still work.


2551 07-Sep-1994 gpalmer

Added the -d <directory> functionality to allow construction of the
password databases somewhere other than /etc.


1863 05-Aug-1994 wollman

Get rid of update. Make man page installation work with our scheme
(and rename a few in the process).


1554 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1553,
which included commits to RCS files with non-trunk default branches.