Commit Graph

122 Commits

Author SHA1 Message Date
David Nugent
25fa020ea5 Fix a long-standing bug in the rename case previously masked by another bug
just fixed in .db file updating.
2000-06-18 02:18:15 +00:00
David Nugent
f52bcb0a5c 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
David Nugent
6a1eaeca35 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
Jake Burkholder
e39756439c Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others
2000-05-26 02:09:24 +00:00
Jake Burkholder
740a1973a6 Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by:	phk
Reviewed by:	phk
Approved by:	mdodd
2000-05-23 20:41:01 +00:00
Sheldon Hearn
4e86fcacf6 Remove more single-space hard sentence breaks. 2000-03-02 14:54:02 +00:00
Sheldon Hearn
f2e366a105 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.
2000-03-01 14:09:25 +00:00
David Nugent
923dc0b2c3 Portability fixes for other bsd4.4 derivatives. 2000-01-15 00:20:22 +00:00
Peter Wemm
6e2578e4c4 Revert the libcrypt/libmd stuff back to how it was. This should not have
happened as it was working around problems elsewhere (ie: binutils/ld
not doing the right thing according to the ELF design).  libcrypt has
been adjusted to not need the runtime -lmd.  It's still not quite right
(ld is supposed to work damnit) but at least it doesn't impact all the
users of libcrypt in Marcel's cross-build model.
1999-12-18 13:55:17 +00:00
Marcel Moolenaar
7c99ddf2cc Add libmd (or move it after libcrypt). We don't want the linker to be
smart because it will definitely get it wrong. This popped up during
cross-linking.
1999-12-16 10:55:45 +00:00
David Nugent
05c30f03e6 Don't try updating the passwd file if no data has changed. This allows things
like "pw usermod <name> -m" to work for non-local NIS users; since no attempt
is made to update the password entry, the home directory will be created and
populated as expected without error.
1999-10-26 15:07:20 +00:00
David Nugent
2399cd14a7 Add new functionality "lock" and "unlock" to provide a simple password
locking mechanism for users. This works by prepending the string
"*LOCKED*" to the password field in master.passwd to prevent successful
decoding.
1999-10-26 08:34:09 +00:00
David Nugent
480207ab3d 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
David Nugent
c190a0f584 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
Sheldon Hearn
8ca1dc4b47 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 Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
David Nugent
479bcf69f7 Remove some more warnings. 1999-07-28 12:49:34 +00:00
David Nugent
2bffe0d58e Fix date parsing to allow '0' (none) date value. 1999-03-15 08:16:01 +00:00
David Nugent
f35227220f Add the ability to print user records in unix version 7 (old) format. 1999-03-02 00:53:33 +00:00
David Nugent
7291e2179c Fix minor nit with command line parsing for pw -V DIR action. 1999-02-23 11:01:50 +00:00
David Nugent
e3921b2795 Fix tpyo (sic) and missing 'else' (bad cut n' paste). 1999-02-23 10:35:47 +00:00
David Nugent
5f12594a29 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
Dag-Erling Smørgrav
c8e126f7f0 Don't assume a_name is a number just because the first character
is a digit.

PR:		bin/9484
Submitted by:	Matthew D. Fuller <fullermd@futuresouth.com>
1999-02-08 21:26:44 +00:00
David Nugent
08fe832b6e Remove bogus file locking in main(). 1999-01-08 10:52:38 +00:00
Bill Fumerola
9fb99cddfc -Clarification of last commit-
The char that the random letters and numbers are being pulled from is
ended with a '\0'. Using sizeof() includes this '\0' in the 'pool' of
possible characters. This patch decrements by one the size so we don't
accidently end the new password prematurly.
1999-01-04 14:07:53 +00:00
Bill Fumerola
5d1711220c Let's make sure we're at the end of the password string before we apply a \0
and terminate it. This patch ensures passwords will be the correct length of 8,
which is what is implied in the source (but not reflected in the man page).

PR:		bin/7817
Reviewed by:	Alfred Perlstein <bright@hotjobs.com>
Submitted by:	Hiroshi Nishikawa <nis@pluto.dti.ne.jp>
1999-01-02 04:37:46 +00:00
Joerg Wunsch
524245066d Fix the spelling of `FreeBSD'.
Submitted by:	Peter Philipp <pjp@bsd-daemon.net>
1998-12-27 12:01:07 +00:00
David E. O'Brien
2887f586f0 Remove useless `BINOWN=root' now that it is the default. 1998-09-19 22:42:14 +00:00
Joseph Koshy
7ecd7a42c5 Fix inappropriate use of .Ql macro.
PR:		docs/7905
Submitted by:	kuma@jp.freebsd.org
1998-09-18 04:45:43 +00:00
Joseph Koshy
06f64964ea The `group{del,mod,show}' take require a '[group|gid]' argument.
PR: docs/7788
1998-08-31 04:49:04 +00:00
Nate Williams
5e91a8ac91 - On second thought, attempt to get the read-only lock, but don't
consider it a exit failure if it doesn't work.  This means that root
  processes can safely get the lock, but normal processes can still use
  the 'pw' utility to get information (which may change out from under
  them.)
1998-08-04 22:31:26 +00:00
Nate Williams
2a6797aae2 - Removed read-only lock from 'pw'. This removes portions of the FIX
from PR/6787, but allow non-root users to use pw to get password
  information.  However, this should be safe since the fixes for
  disallowing multiple instances from modifying the DB are still intact.

Bug noted by:	 dima@best.net (Dima Ruban)
1998-08-04 22:20:11 +00:00
Nate Williams
73375325b1 Fix race condition in pw caused by multiple instances of pwd_mkdb being
run at the same time.

Notes:
    The fileupdate function is still somewhat broken.  Instead of
    returning a failure code if it can't modify the original file it
    renames the .new file and continues as though nothing is wrong.
    This will cause the lock on the original file to be lost and could
    lead to a similar race condition.  I left that portion of the code
    alone since I feel that the maintainer of the code would have a
    better concept of how he wants to handle errors in that function
    than I do.

PR:		bin/6787
Submitted by:	Craig Spannring <cts@internetcds.com>
1998-07-16 17:18:25 +00:00
Philippe Charnier
325970a9ff .Nm pw -> .Nm. 1998-03-23 08:28:12 +00:00
Steve Price
137db389ed Overhaul this manpage - removing typos, awkward phrasing, and addressing
a few technical faults.

PR:		5692
Submitted by:	dannyman@arh0300.urh.uiuc.edu
1998-02-14 18:33:37 +00:00
Wolfram Schneider
27f8f85b7e 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
Tim Vanderhoek
dfb9495b2a Use consistent spelling,
writeable -> writable (recall prior debate over this? :-)
	initialise -> initialize
	recognise -> recognize

Merry Christmas! :)
1997-12-25 09:36:42 +00:00
Philippe Charnier
1dcc6ec750 Use err(3) instead of local redefinition. Add rcsid string. 1997-10-10 06:23:42 +00:00
David Nugent
d3329f56fa Unquote default group in pw.conf.
PR: 4365
Submitted by: "Andrew L. Moore" <alm@mclink.com>
1997-09-01 09:33:08 +00:00
David Nugent
5e779680a9 Fix -p switch. 1997-08-01 15:06:21 +00:00
David Nugent
fa7e83d492 getuid() -> geteuid(). 1997-07-17 08:37:47 +00:00
Andrey A. Chernov
687ee69a2a Remove srandomdev fallback code 1997-06-14 00:27:03 +00:00
David Nugent
57ae32e5e8 Fixes skeleton directory test-it-is-a-directory logic.
PR:		3666
Reviewed by:
Submitted by:	iaint@css.tuu.utas.edu.au
Obtained from:
1997-05-24 10:41:49 +00:00
Andrey A. Chernov
a200d18a76 Initialize RNG only once
Use srandomdev() now
1997-03-24 15:09:41 +00:00
Andrey A. Chernov
f2a6c90b00 Fix srandom arg according to Lite2 1997-03-11 14:11:43 +00:00
Daniel O'Callaghan
3a7e707703 Typo fix 'and' -> 'an'.
This is a 2.2 candidate.
1997-03-04 07:55:43 +00:00
Andrey A. Chernov
08a77c42e1 Back out MAXLOGNAME fix, Bruce points that copyinstr require NUL 1997-03-03 07:59:54 +00:00
Andrey A. Chernov
431efa59e3 Fix MAXLOGNAME usage, the code has wrong assumption that
it must be NUL terminated
1997-03-02 21:36:17 +00:00
Peter Wemm
476602a9d0 Revert $FreeBSD$ to $Id$ 1997-02-22 16:15:28 +00:00
David Nugent
e56644ad0e Yet another formatting consistency check. 1997-02-07 11:31:42 +00:00
David Nugent
e57b5686c6 Fix useage of MAXLOGNAME to include terminating NUL, by using
max(MAXLOGNAME-1,UT_NAMESIZE).
Tidy up "pretty" printing format for longer usernames.
1997-02-07 10:58:13 +00:00
Wolfram Schneider
bfd34a4a60 Sort cross references. 1997-01-20 00:03:00 +00:00
Jordan K. Hubbard
1130b656e5 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
David Nugent
f1d684fad9 Adds optional NIS passwd file updating and optionally rebuilding
NIS maps.

Suggested by:	Peter Wemm
1997-01-05 07:15:37 +00:00
David Nugent
c7fefa0352 Remove duplicated #include. 1997-01-05 04:54:24 +00:00
David Nugent
9d8caa0abd Fix reference /etc/acct/pw.conf -> /etc/pw.conf.
Pointed-Out-By: Peter Wemm.
1997-01-05 04:05:22 +00:00
David Nugent
f2400d4658 Implemented /home -> /usr/home symlink kludge.
If home basedir would be created in the root partition, create
it under /usr instead, and symlink /basedir -> /usr/basedir.
1997-01-03 04:42:18 +00:00
David Nugent
39791ab333 1) Base home directory is created if it does not already exist if
useradd -m or useradd -D -b are used.
2)	Hyphen allowed in username if not first character. Fix trivial
	bug in error fmt string.
3)	/etc/skeykeys updating changed to do 'inplace' update, commenting
	out a username rather than removing it completely.
1996-12-30 11:52:34 +00:00
David Nugent
b5cc56ab27 Correct file modes on updated /etc/skeykeys. 1996-12-23 02:27:29 +00:00
David Nugent
0970881ff6 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
David Nugent
5e75134d21 Bugfix (cosmetic) for output of generated passwords. 1996-12-20 10:45:39 +00:00
David Nugent
d9b711b719 Allow 8-bit characters in the passwd gecos field, and adds a paragraph
to the mangpage explaining the consequences (to be updated at a later
date after login class conf support is added).
1996-12-19 15:22:45 +00:00
David Nugent
2e3db6fbe0 Changes to password generator: fallback to MD5 generator disabled
(/dev/urandom used by default under FreeBSD), and implemented a
"portable" but less secure generator for other systems.
Add display of expiry/password change dates in -P user display.
1996-12-17 14:15:35 +00:00
David Nugent
a36f769f47 Submitted by: proff@iq.org
Minor fix for security patch.
1996-12-17 01:43:30 +00:00
David Nugent
b7d2ba7cb8 Reviewed by: davidn@blaze.net.au
Submitted by:	proff@iq.org
	Security patch for better random password generation.
1996-12-16 17:37:58 +00:00
Joerg Wunsch
669d204645 Update from David, reflecting Wolfram's wishes regarding limitation of
the allowable character set.

Submitted by:	David Nugent
1996-12-11 15:10:47 +00:00
Joerg Wunsch
db34a7105c Merg-o-matic. 1996-12-11 00:07:19 +00:00
Joerg Wunsch
ad7cf975be 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 Wunsch
9fd0dafc15 Merge from the vendor-branch. 1996-12-10 00:21:28 +00:00
Joerg Wunsch
48aee7f33a 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
Mike Pritchard
053375e81b Minor spelling/mdoc/style fixes. 1996-12-09 16:44:13 +00:00
Joerg Wunsch
d6f907dc7a 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