Commit Graph

53 Commits

Author SHA1 Message Date
dwmalone
3c8217a982 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
2002-06-24 11:33:17 +00:00
ache
a77a486fbc Change rmskey() to rmopie() - we don't have skey anymore 2001-10-19 10:45:14 +00:00
dd
2df19d79ba 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
2001-09-03 14:12:42 +00:00
joerg
4a659a05e2 Properly initialize the random number generator in pw_getpass().
Right now, the automatically generated passwords have been rather
predictable. :-(

MFC after:	1 day
2001-08-21 13:33:20 +00:00
joerg
a8d6f38e47 Fix a typo in a variable name that made pw(8) coredump when using
USE_MD5RAND.

MFC after:	2 days
2001-08-21 10:29:01 +00:00
ache
333747c493 Use %c for expire/change dates 2001-03-21 13:46:09 +00:00
kris
279e311e78 Switch from using rand() or random() to a stronger, more appropriate PRNG
(random() or arc4random())

Reviewed by:	bde
2001-03-05 02:15:38 +00:00
ben
5a90713c4b Convert to use the <sys/queue.h> macros rather than fiddling with the queue
structure internals.

Reviewed by:	markm
2000-12-29 18:04:54 +00:00
green
83520f8d05 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
2000-08-22 02:15:54 +00:00
davidn
1f768cbbec 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
2000-07-20 05:11:56 +00:00
davidn
cce226e47d 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
2000-07-20 04:37:00 +00:00
davidn
e9e5da853a 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
2000-07-20 00:09:29 +00:00
davidn
381c8d4d3d 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
2000-07-03 12:13:10 +00:00
ache
ec30366657 Localize ctype too.
Add weekday to showuser expired fields
2000-06-24 13:36:13 +00:00
ache
2046ad945b Localize time/date.
Use ISO 8601 date in logs.
Fix wrong argument type in ctype functions.
2000-06-22 16:48:41 +00:00
davidn
9e5a20b332 Fix obvious braino in assignment statement. usermod -g should work again.
PR:		17877
Submitted by:	pius@zyan.com
2000-06-18 02:48:56 +00:00
davidn
3b8f4fc741 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
davidn
8ec6947593 Portability fixes for other bsd4.4 derivatives. 2000-01-15 00:20:22 +00:00
davidn
f7ccb2973e 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
davidn
1eb57a5aee 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
davidn
81f9461104 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
peter
b6784c4210 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
davidn
fc1c90c001 Remove some more warnings. 1999-07-28 12:49:34 +00:00
davidn
c01a7e63d1 Add the ability to print user records in unix version 7 (old) format. 1999-03-02 00:53:33 +00:00
davidn
dc804219b0 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
des
30e1d1ca5e 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
billf
2bd2de496a -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
billf
d727ae5c4c 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
charnier
1b2a43aa3f Use err(3) instead of local redefinition. Add rcsid string. 1997-10-10 06:23:42 +00:00
davidn
eb14663e40 Fix -p switch. 1997-08-01 15:06:21 +00:00
ache
3eb72e5222 Remove srandomdev fallback code 1997-06-14 00:27:03 +00:00
davidn
9cbae70c69 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
ache
ec758b2cd3 Initialize RNG only once
Use srandomdev() now
1997-03-24 15:09:41 +00:00
ache
8db013e86b Fix srandom arg according to Lite2 1997-03-11 14:11:43 +00:00
ache
26e48e5f06 Back out MAXLOGNAME fix, Bruce points that copyinstr require NUL 1997-03-03 07:59:54 +00:00
ache
f625b97409 Fix MAXLOGNAME usage, the code has wrong assumption that
it must be NUL terminated
1997-03-02 21:36:17 +00:00
peter
32d6b795de Revert $FreeBSD$ to $Id$ 1997-02-22 16:15:28 +00:00
davidn
23e88dfc02 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
jkh
9c0cd3f9df 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
davidn
5e162a50e5 Adds optional NIS passwd file updating and optionally rebuilding
NIS maps.

Suggested by:	Peter Wemm
1997-01-05 07:15:37 +00:00
davidn
be419e50a6 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
davidn
febc049d80 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
davidn
1944529458 Correct file modes on updated /etc/skeykeys. 1996-12-23 02:27:29 +00:00
davidn
2e6eac74c6 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
davidn
0fd047068f Bugfix (cosmetic) for output of generated passwords. 1996-12-20 10:45:39 +00:00
davidn
69ec6d3d5f 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
davidn
d7f4368373 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
davidn
11aa8f9087 Submitted by: proff@iq.org
Minor fix for security patch.
1996-12-17 01:43:30 +00:00
davidn
b2883cffde 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
301af3f52a 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