History log of /freebsd-9.3-release/usr.sbin/pw/pw_user.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

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

# 253157 10-Jul-2013 des

MFH (r252556): allow setting expiry to current date / time
MFH (r252688): fall back to sha512 if passwd_format is not set


# 242916 12-Nov-2012 bapt

Remove useless atoi(3), previous strspn(3) makes sure that a_name->val is a
number.
This also allow pw user show to work as expected.

PR: bin/172112
Submitted by: Ilya A. Arkhipov <rum1cro@yandex.ru>


# 229237 01-Jan-2012 dim

MFC r228673:

In usr.sbin/pw/pw_user.c, use the correct printf length modifier for a
ptrdiff_t.


# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 224535 31-Jul-2011 delphij

Backout r223115 which potentially caused a POLA violation, by restoring
historic behavior (create the default base directory in pw.conf) before
I came up with a better fix for this.

Requested by: nwhitehorn
Approved by: re (kib)


# 223115 15-Jun-2011 delphij

Don't attempt to create the base directory when -d is specified.

MFC after: 1 month


# 219408 08-Mar-2011 jkim

Stop hard-coding default directory mode as 0777.


# 218293 04-Feb-2011 jkim

Do not let pw.conf(5) or -M option affect creation of basehome, e.g., /home.
When the basehome does not exist, it creates all intermediate directories as
required, which is logically equivalent to mkdir(1) with -m and -p options.
However, it modifies all intermediate directories, not just the final home
directory unlike mkdir. This problem was introduced in two revisions, i.e.,
r1.59 (SVN r167919) and r1.60 (SVN r168044).

MFC after: 1 month


# 213459 05-Oct-2010 jkim

Revert the unrelated patch crept in the previous commit.


# 213458 05-Oct-2010 jkim

Prefer pmap_unmapbios() over pmap_unmapdev(). The binary does not change
after this because pmap_unmapbios() is a macro for pmap_unmapdev() on amd64.


# 200173 05-Dec-2009 ed

Make pw(8) build without <utmp.h>.

The size of the username record in utmp files should not influence the
maximum username length. Right now ut_user/ut_name is big enough, so in
this case it's dead code anyway.


# 181785 16-Aug-2008 ache

Use arc4random_uniform() to avoid "modulo bias"

Remove pw_getrand() unneded now: arc4random_uniform() is stronger then
pw_getrand()'s MD5 tricks (inactive) and its active version, mixing
arc4random() bytes in one, not make things better at all.


# 179365 27-May-2008 antoine

- Increase the size of the salt in pw(8) from 8 to 32 (same as in pam_unix(8)).
This makes blowfish password hashes look normal when set using
pw(8)/adduser(8). [1]
- Make it possible to have a '/' in the salt.

PR: 121146 [1]
Submitted by: Jaakko Heinonen [1]
Approved by: rwatson (mentor)
MFC after: 1 month


# 168045 30-Mar-2007 le

Accept passwords which contain whitespace.

PR: bin/53434


# 168044 30-Mar-2007 le

Add home directory creation mode to pw.conf(5) and be a bit
more specific about the effect of the current umask on -M.


# 167919 26-Mar-2007 le

Introduce the new option -M to allow to set the permissions of
the user's newly created home directory. If omitted, it's derived
from the current umask.

PR: bin/16880, bin/83253 (partially), bin/104248
MFC in: 1 month


# 148584 31-Jul-2005 pjd

Change /home symbolic link, so it will point to usr/home instead of /usr/home.

Previous symlink was confusing:

# cd /jails/virtual_system_1/home
# realpath .
/usr/home

...and slower.

OK'ed by: rwatson, phk


# 130633 17-Jun-2004 robert

Use strlcpy(3) to replace the idiomatic

strncpy(d, s, l);
d[l - 1] = '\0';

statements.


# 130629 17-Jun-2004 robert

Fix a bug which occurred when the home directory given by the
-d option was equal to the one already saved and which caused
the pw utility to avoid updating values passed by other options
processed before the -d option in the code path.

Spotted by: Richard Caley <rjc@interactive.co.uk>


# 124382 11-Jan-2004 iedowse

Add a `-H <fd>' option that is like `-h <fd>', but accepts an already
encrypted password on the specified file descriptor.

PR: bin/22033
MFC after: 2 weeks


# 110667 11-Feb-2003 ache

There is no sense to use random random() and arc4random() in the same program.
Switch to arc4random() completely.


# 109962 27-Jan-2003 gad

This is just a forced-commit to note that the previous commit addresses
PR 28773 (not 28733!). I have closed both PR 28773 and PR 46890.


# 109961 27-Jan-2003 gad

Changes so the 'pw' command will allow '$' as the last character in a userid
or group name (mainly for the benefit of samba). This pretty much rewrites
he pw_checkname() routine, but should work exactly the same except for the
above change, and that error messages are somewhat more informative.

PR: 28733 46890
Inspired by: example patch written by Terry Lambert
Reviewed by: no objections on freebsd-arch and freebsd-current
MFC plans: no plans, but will do if people want it in stable.


# 98744 24-Jun-2002 dwmalone

Print a long with %ld not %d. (We possibly should be using %j here, but
that can be fixed when the many other warnings here are being fixed.)

PR: 39741
Submitted by: Dan Lukes <dan@obluda.cz>
MFC after: 1 week


# 85145 19-Oct-2001 ache

Change rmskey() to rmopie() - we don't have skey anymore


# 82868 03-Sep-2001 dd

For new users, create the home directory before sending the welcome
mail, if configured to do so. Some sites have setups where the user's
mail is delivered to their home directory, so sending mail before is
exists didn't work.

PR: 29892


# 82059 21-Aug-2001 joerg

Properly initialize the random number generator in pw_getpass().
Right now, the automatically generated passwords have been rather
predictable. :-(

MFC after: 1 day


# 82047 21-Aug-2001 joerg

Fix a typo in a variable name that made pw(8) coredump when using
USE_MD5RAND.

MFC after: 2 days


# 74569 21-Mar-2001 ache

Use %c for expire/change dates


# 73563 05-Mar-2001 kris

Switch from using rand() or random() to a stronger, more appropriate PRNG
(random() or arc4random())

Reviewed by: bde


# 70486 29-Dec-2000 ben

Convert to use the <sys/queue.h> macros rather than fiddling with the queue
structure internals.

Reviewed by: markm


# 64918 22-Aug-2000 green

Add working and easy crypt(3)-switching. Yes, we need a whole new API
for crypt(3) by now. In any case:

Add crypt_set_format(3) + documentation to -lcrypt.
Add login_setcryptfmt(3) + documentation to -lutil.
Support for switching crypt formats in passwd(8).
Support for switching crypt formats in pw(8).

The simple synopsis is:
edit login.conf; add a passwd_format field set to "des" or "md5"; go nuts :)

Reviewed by: peter


# 63600 20-Jul-2000 davidn

Move test for -w flag outside of the code dealing with -D (defaults).
This should cause -w's argument not to be ignored in the usermod case,
so it will affect modification of the user's password instead of using
the pw.conf (or internal default=no '*') password method.
PR: bin/11168


# 63596 20-Jul-2000 davidn

Allow -g with an empty argument in the -D case. This allows -g "" to set
no default group (and thus fall back to user-based groups instead).
PR: bin/5717


# 63572 19-Jul-2000 davidn

Fix another missed case where usermod would not set the "modified" flag:
-h - to set no password. But only mark modified if the account is not
already locked (i.e. first char of crypt password field is '*').
PR: bin/19999


# 62461 03-Jul-2000 davidn

Fix breakage introduced by bypassing update for additional 'mod'
functionality when nothing had actually changed; -d changes would
not set the 'something had changed flag'. Actually test for a
change in homedir.
PR: bin/19649


# 62034 24-Jun-2000 ache

Localize ctype too.
Add weekday to showuser expired fields


# 61957 22-Jun-2000 ache

Localize time/date.
Use ISO 8601 date in logs.
Fix wrong argument type in ctype functions.


# 61762 18-Jun-2000 davidn

Fix obvious braino in assignment statement. usermod -g should work again.
PR: 17877
Submitted by: pius@zyan.com


# 61759 18-Jun-2000 davidn

Fix a long-standing bug in the rename case previously masked by another bug
just fixed in .db file updating.


# 56000 14-Jan-2000 davidn

Portability fixes for other bsd4.4 derivatives.


# 52527 26-Oct-1999 davidn

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.


# 52512 26-Oct-1999 davidn

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.


# 52502 26-Oct-1999 davidn

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]


# 50479 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 49171 28-Jul-1999 davidn

Remove some more warnings.


# 44386 01-Mar-1999 davidn

Add the ability to print user records in unix version 7 (old) format.


# 44229 23-Feb-1999 davidn

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.


# 43780 08-Feb-1999 des

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>


# 42287 04-Jan-1999 billf

-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.


# 42245 02-Jan-1999 billf

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>


# 30259 10-Oct-1997 charnier

Use err(3) instead of local redefinition. Add rcsid string.


# 27831 01-Aug-1997 davidn

Fix -p switch.


# 26626 13-Jun-1997 ache

Remove srandomdev fallback code


# 26088 24-May-1997 davidn

Fixes skeleton directory test-it-is-a-directory logic.
PR: 3666
Reviewed by:
Submitted by: iaint@css.tuu.utas.edu.au
Obtained from:


# 24214 24-Mar-1997 ache

Initialize RNG only once
Use srandomdev() now


# 23700 11-Mar-1997 ache

Fix srandom arg according to Lite2


# 23318 03-Mar-1997 ache

Back out MAXLOGNAME fix, Bruce points that copyinstr require NUL


# 23299 02-Mar-1997 ache

Fix MAXLOGNAME usage, the code has wrong assumption that
it must be NUL terminated


# 22997 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 22394 07-Feb-1997 davidn

Fix useage of MAXLOGNAME to include terminating NUL, by using
max(MAXLOGNAME-1,UT_NAMESIZE).
Tidy up "pretty" printing format for longer usernames.


# 21673 14-Jan-1997 jkh

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.


# 21330 05-Jan-1997 davidn

Adds optional NIS passwd file updating and optionally rebuilding
NIS maps.

Suggested by: Peter Wemm


# 21242 03-Jan-1997 davidn

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.


# 21052 30-Dec-1996 davidn

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.


# 20842 23-Dec-1996 davidn

Correct file modes on updated /etc/skeykeys.


# 20747 21-Dec-1996 davidn

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.


# 20712 20-Dec-1996 davidn

Bugfix (cosmetic) for output of generated passwords.


# 20679 19-Dec-1996 davidn

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).


# 20590 17-Dec-1996 davidn

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.


# 20576 16-Dec-1996 davidn

Submitted by: proff@iq.org
Minor fix for security patch.


# 20555 16-Dec-1996 davidn

Reviewed by: davidn@blaze.net.au
Submitted by: proff@iq.org
Security patch for better random password generation.


# 20325 11-Dec-1996 joerg

Update from David, reflecting Wolfram's wishes regarding limitation of
the allowable character set.

Submitted by: David Nugent


# 20303 10-Dec-1996 joerg

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


# 20302 10-Dec-1996 joerg

Copyright update by the author, to be more in line with our sample
copyright.

Submitted by: David Nugent


# 20267 09-Dec-1996 joerg

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>


# 20253 09-Dec-1996 joerg

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>