History log of /freebsd-current/usr.bin/login/login.c
Revision Date Author Comments
# 1e25eb28 12-Jan-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

login: Missed an instance of getpwnam().

Fixes: a3d80dd8aa6ac15877e00102ab174b417ac81d79
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D43423


# a3d80dd8 12-Jan-2024 Dag-Erling Smørgrav <des@FreeBSD.org>

login: Use getpwnam_r() instead of getpwnam().

Since we expect the entry to still be valid after calling into PAM,
which may call getpwnam() itself, we need to use getpwnam_r().

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans, imp, allanjude, markj
Differential Revision: https://reviews.freebsd.org/D43376


# 5e3934b1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# bdcbfde3 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d552825 06-Jul-2021 Alex Richardson <arichardson@FreeBSD.org>

usr.bin/login: send errors to console if syslog isn't running

I was debugging why login(1) wasn't working as expected on a minimal
MFS_ROOT disk image. This image doesn't have syslogd running so the
warnings were lost and I had to use GDB to find out why login(1) was
failing (missing PAM libraries) instead of being able to see it in
the console output.

MFC after: 1 week
Reviewed By: pfg
Differential Revision: https://reviews.freebsd.org/D30892


# dcc6f625 18-Dec-2020 Pedro F. Giffuni <pfg@FreeBSD.org>

login(1): when exporting variables check the result of setenv(3)

When exporting a variable we correctly check all the preconditions that
could make setenv(3) fail. Checking the setenv(3) return value seems
redundant, but given that login(1) is critical, it doesn't hurt to have
a post-check.

This change is based on the "Principles of Secure Coding" course by
Matthew Bishop, PhD., which specifically discusses this code in FreeBSD.

(This change redoes r368776 due to a silly mistake)


# a0bed901 18-Dec-2020 Pedro F. Giffuni <pfg@FreeBSD.org>

Revert r368776:
login(1): when exporting variables check the result of setenv(3)

mismatch: the return value upon error is -1, so the code was not
doing nothing.


# ebb4fcc7 18-Dec-2020 Pedro F. Giffuni <pfg@FreeBSD.org>

login(1): when exporting variables check the result of setenv(3)

When exporting a variable we correctly check all the preconditions that
could make setenv(3) fail. Checking the setenv(3) return value seems
redundant, but given that login(1) is critical, it doesn't hurt to have
a post-check.

This change is based on the "Principles of Secure Coding" course by
Matthew Bishop, PhD., which specifically discusses this code in FreeBSD.

Differential Revision: https://reviews.freebsd.org/D26966


# df57947f 18-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

spdx: initial adoption of licensing ID tags.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

Initially, only tag files that use BSD 4-Clause "Original" license.

RelNotes: yes
Differential Revision: https://reviews.freebsd.org/D13133


# 60b0aa6a 10-Sep-2015 Xin LI <delphij@FreeBSD.org>

login.c doesn't really need libutil.h, don't include it.

login_fbtab.c includes paths.h and pathnames.h, and pathnames.h includes
paths.h. Eliminate the paths.h inclusion in login_fbtab.c.

MFC after: 2 weeks


# 06224a94 17-Aug-2014 Neel Natu <neel@FreeBSD.org>

Remove LOG_ODELAY because it does nothing.

Reviewed by: jilles
CR: https://reviews.freebsd.org/D611


# 07426f1f 19-Apr-2014 Jilles Tjoelker <jilles@FreeBSD.org>

login: Remove broken dialup log message.

For 10 years, the "DIALUP <tty>, <user>" message has required having a
hostname (-h) instead of not having a hostname; therefore, it is never
logged. Given that dialup is obsolete and this has not been fixed, remove
the log message.

Note that LOGALL, which is defined by default, logs a message for all
logins, including dialup logins.


# 2482c270 26-Jan-2014 Jilles Tjoelker <jilles@FreeBSD.org>

login: Clean up PAM and audit, then exit, on SIGHUP and SIGTERM.

This avoids leaving stale entries in utmpx after the connection is closed on
an open login session. It also allows a clean way (SIGTERM) to forcibly
terminate a user's terminal session.

This does not affect the situation for "hung" processes after the connection
is closed. The foreground process group receives SIGHUP and the tty becomes
inaccessible.

Also replace all use of the obsolete signal() function with sigaction() (not
only the part where it is actually required: SIGHUP and SIGTERM must mask
the other as well when caught).

PR: misc/183495
Reviewed by: ed


# e83ebd8d 13-Nov-2013 Ed Schouten <ed@FreeBSD.org>

Fix whitespace.


# ba675b41 03-May-2011 Doug Rabson <dfr@FreeBSD.org>

Call pam_setcred() before login_getpwclass to support home directories
on GSS-API authenticated NFS where the kerberos credentials need to be
saved so that the kernel can authenticate to the NFS server.


# 587250b2 20-Oct-2010 Ed Schouten <ed@FreeBSD.org>

Get rid of hand-rolled closefrom(3).


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 905571c0 28-Sep-2010 Ed Maste <emaste@FreeBSD.org>

Remove copyright strings printed at login time via login(1) or sshd(8).
It is not clear to what this copyright should apply, and this is in line
with what other operating systems do.

For ssh specifically, printing of the copyright string is not in the
upstream version so this reduces our FreeBSD-local diffs.

Approved by: core, des (ssh)


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# ef636796 02-Jan-2010 Ed Schouten <ed@FreeBSD.org>

ANSIfy various tools in usr.bin/.

Most of these tools properly build at WARNS=6, except for their K&R
function declarations. Fix this, so we can bump WARNS as well.


# 821df508 12-Dec-2009 Xin LI <delphij@FreeBSD.org>

Revert most part of 200420 as requested, as more review and polish is
needed.


# 6f2d3221 11-Dec-2009 Xin LI <delphij@FreeBSD.org>

Remove unneeded header includes from usr.bin/ except contributed code.

Tested with: make universe


# 95e7b94a 27-Mar-2009 Ed Schouten <ed@FreeBSD.org>

Don't strip TTY device name to the last '/'.

We've seen this bug in other applications before: we have some
applications that use strrchr(tty, '/') on the TTY device name. This
isn't valid when using pts(4), because the device name will be stripped
to "0" instead of "pts/0".

This fixes issues with login(1) ignoring /etc/ttys and missing utmp
records.

Reported by: Barney Cordoba <barney_cordoba yahoo com>
Reviewed by: rwatson


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 2966d28c 03-Jul-2007 Sean Farley <scf@FreeBSD.org>

Significantly reduce the memory leak as noted in BUGS section for
setenv(3) by tracking the size of the memory allocated instead of using
strlen() on the current value.

Convert all calls to POSIX from historic BSD API:
- unsetenv returns an int.
- putenv takes a char * instead of const char *.
- putenv no longer makes a copy of the input string.
- errno is set appropriately for POSIX. Exceptions involve bad environ
variable and internal initialization code. These both set errno to
EFAULT.

Several patches to base utilities to handle the POSIX changes from
Andrey Chernov's previous commit. A few I re-wrote to use setenv()
instead of putenv().

New regression module for tools/regression/environ to test these
functions. It also can be used to test the performance.

Bump __FreeBSD_version to 700050 due to API change.

PR: kern/99826
Approved by: wes
Approved by: re (kensmith)


# ba174a5e 01-May-2007 Andrey A. Chernov <ache@FreeBSD.org>

Back out all POSIXified *env() changes.

Not because I admit they are technically wrong and not because of bug
reports (I receive nothing). But because I surprisingly meets so
strong opposition and resistance so lost any desire to continue that.

Anyone who interested in POSIX can dig out what changes and how
through cvs diffs.


# 8673ed15 29-Apr-2007 Andrey A. Chernov <ache@FreeBSD.org>

Slightly tune previous fix: free memory if !export


# 2efaac81 29-Apr-2007 Andrey A. Chernov <ache@FreeBSD.org>

Prepare for upcoming POSIXed putenv() rewrite:
don't free memory after putenv()


# 0c59c145 12-Dec-2006 Christian S.J. Peron <csjp@FreeBSD.org>

Teach login(1) about the make.conf NO_AUDIT variable. This allows us to
conditionally build in audit support.

Submitted by: bz
MFC after: 1 week


# 8f9370b0 28-Mar-2006 Olivier Houchard <cognet@FreeBSD.org>

Don't call audit_logout() if pwd is NULL, as audit_logout() attempts to
dereference it.
This will happen if we ^D at the Login: prompt without having provided a
valid login before.
Set pwd to NULL on bad login attempts to prevent audit_logout() from being
called for a user which didn't actually log on.

Reported by: Jerome Magnin jethro at docisland dot org


# a1c73d21 04-Feb-2006 Wayne Salamon <wsalamon@FreeBSD.org>

Make login audit-enabled, submitting audit records for the login and logout
events. The specifics of submitting the records is contained within
login_audit.c.
Document the auditing behavior in the man page.

Obtained from: TrustedBSD Project, Apple Computer, Inc.
Approved by: rwatson (mentor)


# 42dc3715 31-May-2005 Maxim Konovalov <maxim@FreeBSD.org>

o Teach login(1) to respect "hushlogin" and "nocheckmail" attributes
defined in user's $HOME/.login_conf.

PR: bin/75001
Submitted by: Rostislav Krasny
MFC after: 2 weeks


# 71f4a30d 26-Jan-2004 Max Khon <fjoe@FreeBSD.org>

Fix ~/.hushlogin handling.

PR: 61354
Submitted by: Eugeny Grosbein <eugen (at) kuzbass.ru>


# a2ba8df6 25-Apr-2003 Robert Watson <rwatson@FreeBSD.org>

When the tty chown() fails, report a chown() failure rather than a
chmod() failure.


# 5c4b7a56 25-Apr-2003 Dag-Erling Smørgrav <des@FreeBSD.org>

The documented login.conf variable for setting the login prompt is
"login_prompt". This makes more sense than "prompt" which is what
login actually used, so change the code to match the documentation.

PR: docs/51396
MFC in: 3 days


# d477c0ca 15-Feb-2003 Dag-Erling Smørgrav <des@FreeBSD.org>

Back out previous commit, I wasn't thinking clearly.


# b9c53543 15-Feb-2003 Dag-Erling Smørgrav <des@FreeBSD.org>

Set PAM_RHOST to "localhost" if no remote host was specified. This allows
pam_opieaccess() to work as expected for local logins.


# fea1e414 08-Feb-2003 Dag-Erling Smørgrav <des@FreeBSD.org>

Use waitpid() instead of wait() since we know the pid of the process we
are waiting for, and we don't want to reap the wrong process.


# 2517862e 04-Dec-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Change the process title as soon as possible to mask information passed on
the command line by getty(8). This is not a perfect fix, but drastically
reduces the window of exposure.

Approved by: re (rwatson)
MFC after: 1 week


# 0845b8fa 15-Oct-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Be consistent about functions being static.

Spotted by: FlexeLint


# 84bbb6ca 19-Aug-2002 Warner Losh <imp@FreeBSD.org>

When login tries to do the chmod/chflags on a read only file system,
it complains that it can't do it because the filesystem is readonly.
Assume that when the user has a readonly /dev that they don't care if
login can't change the permissions/flags. While this does break a few
things like msgs, we'll assume that the user setting up the read only
system knows what they are doing.

All this change does is to stop the complaint when the file system is
read only. It also adds comments as to why EROFS and EOPNOTSUPP are
ignored.

This allows one to have a read-only / w/o a /dev MFS and have a
relatively warning-free existence. /etc/rc still complains when it
can't chown/chflags/chmod things, but that's easy to ignore/tweak.

Reviewed by: roberto, phk
Sponsored by: Timing Solutions


# 81b4504b 28-Jul-2002 David Malone <dwmalone@FreeBSD.org>

Don't reuse a const char * when we really want a char *.


# 55f0377c 28-Jun-2002 Andrey A. Chernov <ache@FreeBSD.org>

Simplify TERM handling since now libutil not overwrites existen TERM for "term"


# 79a20d3b 27-Jun-2002 Andrey A. Chernov <ache@FreeBSD.org>

Overwrite "term" from login.conf(5) for any known TERM


# c51edfb7 28-May-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Drive-by whitespace cleanup.


# 05da55ee 22-Apr-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Don't use PAM_SILENT unless hushlogin is set (perforce change 10123)

Sponsored by: DARPA, NAI Labs


# b897c4df 16-Apr-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Remove unused #define.


# f2f306b6 08-Apr-2002 Ruslan Ermilov <ru@FreeBSD.org>

Align for const poisoning in -lutil.


# 3be0f8f0 12-Mar-2002 Garance A Drosehn <gad@FreeBSD.org>

Simple fix so the 'LOGIN FAILURE' message send to syslog will include
the correct userid, instead of random garbage. This bug does not
exist in -stable.

Reviewed by: freebsd-audit


# 519b6a4c 05-Mar-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Switch to OpenPAM. Bump library version. Modules are now versioned, so
applications linked with Linux-PAM will still work.
Remove pam_get_pass(); OpenPAM has pam_get_authtok().
Remove pam_prompt(); OpenPAM has pam_{,v}{error,info,prompt}().
Remove pam_set_item(3) man page as OpenPAM has its own.

Sponsored by: DARPA, NAI Labs


# c60ed00a 30-Jan-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Still with asbestos longjohns on, completely PAMify login(1) and remove
code made redundant by various PAM modules (primarily pam_unix(8)).

Sponsored by: DARPA, NAI Labs


# 554b9a6e 29-Jan-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Back out rev 1.78, which is incorrect now that the PAM modules have been
fixed to accept a NULL PAM_RHOST.


# f2c44cce 21-Jan-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

When running on a local terminal, set PAM_RHOST to the local hostname.

Sponsored by: DARPA, NAI Labs


# 07977587 19-Jan-2002 Andrey A. Chernov <ache@FreeBSD.org>

Back out PAM_CRED_ERR addition


# 3e4f7c7f 19-Jan-2002 Andrey A. Chernov <ache@FreeBSD.org>

Add PAM_CRED_ERR as valid failure case


# 9f5b04e9 10-Dec-2001 David Malone <dwmalone@FreeBSD.org>

Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.


# 1a8b24c2 02-Dec-2001 Mark Murray <markm@FreeBSD.org>

Use __FBSDID(). Also do a bit of cosmetic #if and header-order
cleaning-up.


# a9648779 01-Dec-2001 Mark Murray <markm@FreeBSD.org>

Sort includes.


# d2f6cd8f 01-Dec-2001 Mark Murray <markm@FreeBSD.org>

Style fixups.

Sort function declarations, includes. Make consistent WRT use of _P()
macro (ugh!)

Inspired by: bde


# e317b970 01-Dec-2001 Mark Murray <markm@FreeBSD.org>

WARNS=2 fixes.

Reviewed by: bde (a while back)


# 0e80e8b2 15-Nov-2001 Robert Watson <rwatson@FreeBSD.org>

o Add support for a 'nocheckmail' capability, which (if true) prevents
the 'You have mail.' check. This is useful for sites that rely on
remote mail access, rather than a local mail spool. Due to the
behavior of login_getcapbool(), the negated form is required so as
to have appropriate results.
o This behavior may have to be independently added to sshd due to
redundant implementation.


# 2c19b38f 15-Sep-2001 Robert Watson <rwatson@FreeBSD.org>

o Modify NFS rights comment to note that the early credential changes
to test for a home directory don't set up the additional groups, and
as such may limit users conservatively. This does not affect the
eventual credentials selected.


# 142277ce 30-Aug-2001 Mark Murray <markm@FreeBSD.org>

Like su(1), make PAM use mandatory. Remove parts of the authentication
logic that are handled by PAM. Fix documentation to reflect this.


# ede8b1c5 12-Aug-2001 Mike Barcroft <mike@FreeBSD.org>

Fix some bogus strncpy(3) to strlcpy(3) changes I made in the previous
revision. <utmp.h> structures don't leave room for a NUL character.
Also fix "UNKNOWN" which should have just been UNKNOWN.

Pointed out by: bde


# 9ab4f412 12-Aug-2001 Mike Barcroft <mike@FreeBSD.org>

o Replace occurrences of strncpy(3) with strlcpy(3); most of
the uses of it were wrong anyway.
o Always check for NULL returns on strdup(3).
o Fix a possible buffer overflow in strcpy(3).
o Fix a format string vulnerability.
o t->ty_type in stypeof() could be NULL and eventually cause
a segmentation fault in setenv(3), so check for that.

Eyeballed by: kris
Reviewed by: murray
MFC after: 3 days


# 9567ba9d 28-Jul-2001 Mark Murray <markm@FreeBSD.org>

Fix the environment handling:

However, there's still a bug in login.c
because you copy the environment *before* the call to pam_open_session,
which won't set the necessary variables set by /usr/ports/security/pam_ssh.

Submitted by: Volker Stolz <stolz@hyperion.informatik.rwth-aachen.de>


# 7bc6d015 09-Jul-2001 Brian Somers <brian@FreeBSD.org>

Fix the type of the NULL arg to execl()

Idea from: Theo de Raadt <deraadt@openbsd.org>


# a37b5e8e 22-May-2001 Eric Melville <eric@FreeBSD.org>

Remove an accidentaly added extra blank line.

Approved by: murray


# 5345e89b 21-May-2001 Guido van Rooij <guido@FreeBSD.org>

Disable SIGHUP while getting the login name.

Reviewed by: security-officer


# 5de20e57 17-May-2001 David E. O'Brien <obrien@FreeBSD.org>

Missed a few things.


# 91a72a92 17-May-2001 David E. O'Brien <obrien@FreeBSD.org>

In a word -- style(9).


# 078ae588 17-May-2001 David E. O'Brien <obrien@FreeBSD.org>

Add the "prompt" and "passwd_prompt" fields to /etc/login.conf,
which makes lgoin more like getty in its ability to be configured.

Submitted by: tlambert (code only)


# 40c65ba9 16-May-2001 Eric Melville <eric@FreeBSD.org>

Check for the expiration of an account and its password in the proper
order.

Reviewed by: -audit (silence)
Approved by: murray
Obtained from: OpenBSD
MFC after: 5 days


# 5bc9d93d 27-Mar-2001 Mark Murray <markm@FreeBSD.org>

Add full PAM support for account management and sessions.

The PAM_FAIL_CHECK and PAM_END macros in su.c came from the util-linux
package's PAM patches to the BSD login.c

Submitted by: "David J. MacKenzie" <djm@web.us.uu.net>


# 17ada684 09-Feb-2001 Jacques Vidrine <nectar@FreeBSD.org>

Fix login so that it exports environmental variables that are set by PAM
modules (via pam_putenv). The following variables will never be set in
this fashion:

SHELL, HOME, LOGNAME, MAIL, CDPATH, IFS, PATH
any variable starting with `LD_'


# 8ad26684 23-Jan-2001 Jacques Vidrine <nectar@FreeBSD.org>

Call pam_setcred.

Reviewed by: markm, months ago


# 69f2cf17 26-Apr-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Add braces to avoid ambiguity in a nested conditional (silences a gcc
warning).


# 508d9a5b 25-Apr-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Fix excessive use of parenthesis in previous commit.

Requested by: bde


# 1806a85c 13-Apr-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Do not issue a warning when chflags() fails with EOPNOTSUPP.

PR: 17875
Submitted by: Bjoern Fischer <bfischer@Techfak.Uni-Bielefeld.DE>


# 5403e5e3 27-Feb-2000 Andrey A. Chernov <ache@FreeBSD.org>

Fix diagnostic printing test condition (was always true)

Approved by: jkh


# 6d939e82 19-Feb-2000 Yoshinobu Inoue <shin@FreeBSD.org>

Added IPv6 name resolving support for utmp logging.

Approved by: jkh


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# a761a465 21-Aug-1999 Warner Losh <imp@FreeBSD.org>

Clear all file flags when taking ownership of devices. Do not ignore
chown failures in some places, but instead log them like we do all
other errors.


# 0514336d 24-Apr-1999 Andrey A. Chernov <ache@FreeBSD.org>

remove uid switching before login_getpwclass, now done inside libutil
add gid switching before chdir and comment why it needed


# 3a6afd0d 07-Apr-1999 Brian Somers <brian@FreeBSD.org>

Don't perform the trimdomain() functionality twice,
trimdomain() now works as expected.


# 11468b74 19-Jan-1999 Andrzej Bialecki <abial@FreeBSD.org>

Add a compile knob to avoid using PAM code (login will use standard Unix
authentication only). This comes handy when you're tight on space.

Submitted by: mostly John Baldwin <jobaldwi@vt.edu>
Reviewed by: John D. Polstra <jdp@polstra.com>


# b606e33c 03-Jan-1999 Eivind Eklund <eivind@FreeBSD.org>

Make the timeout handler log any failed logins, to make sure failed
logins get logged.


# e8334816 20-Nov-1998 John Polstra <jdp@FreeBSD.org>

ATTENTION: INSTALL "/etc/pam.conf" FROM "src/etc"!!!

Change login to use PAM for authentication. I kept the built-in
passwd/NIS authentication support, to handle cases where the system
is missing its "/etc/pam.conf" file. S/Key and KerberosIV
authentication methods are removed from the login program, but
still available in PAM modules.


# 6717b4a8 10-Nov-1998 John Polstra <jdp@FreeBSD.org>

unifdef -DLOGIN_CAP. After almost 2 years, I think we can assume
it's here to stay.

This code is starting to look almost reasonable again.


# 8e32ad3b 10-Nov-1998 John Polstra <jdp@FreeBSD.org>

Remove support for LOGIN_CAP_AUTH. It was never enabled, it was
not complete, and it hasn't been touched for 18 months. All the
ifdefs obfuscate the code. I discussed the LOGIN_CAP_AUTH support
with its author and he agreed that it is a dead end. I am bringing
PAM into the tree within the next two weeks. It is much more
flexible than LOGIN_CAP_AUTH, and will serve as a superior replacement
for it.


# 069b715f 10-Nov-1998 John Polstra <jdp@FreeBSD.org>

Fix a const-related compiler warning.


# 8f176b43 09-Oct-1998 Mark Murray <markm@FreeBSD.org>

Use KJH's auth.conf parser to turn on/off Kerberos in userland.


# 580367f2 16-Aug-1998 Joseph Koshy <jkoshy@FreeBSD.org>

Remove hardcoded constant in favour of login.conf value.

PR: 6529
Submitted by: Dan Lukes <dan@obluda.cz>


# e662741c 31-Jul-1998 Bruce Evans <bde@FreeBSD.org>

Backed out rev.1.31. It was a workaround for bugs in rev.1.4 of
libc/gen/getpass.c. The old behaviour of blocking SIGINT and not
changing SIGQUIT was restored in rev.1.5 of getpass.c. The change
here completely restores the old behaviour of not supporting killing
login with keyboard signals (only) at the password prompt. There
is no reason to support this, since login can be exited normally
by typing a couple of ^D's. Login certainly shouldn't dump core
in response to user input. Previously, SIGQUIT killed login
immediately but SIGINT killed it only after the password was
entered.

PR: 7444


# 79bdd98b 21-Jul-1998 John Polstra <jdp@FreeBSD.org>

Fix a couple of little bugs that prevented login.c from compiling
if LOGIN_CAP_AUTH was defined. This is kind of silly, because
LOGIN_CAP_AUTH doesn't work anyway, is not defined currently,
probably will never be defined, and IMHO should not be defined.
But I'm sure you'll sleep better tonight, knowing that these bugs
are gone.


# 89caae29 01-Jun-1998 Atsushi Murai <amurai@FreeBSD.org>

Trim a domain part for wtmp as same as showed by "netstat -r".
Here is a some example for avoiding a confusion.

It asssumes a logged host domain is "spec.co.jp". All
example is longer than UT_HOSTNAMELEN value.

1) turbo.tama.spec.co.jp: 192.19.0.2 -> trubo.tama
2) turbo.tama.foo.co.jp : 192.19.0.2 -> 192.19.0.2
3) specgw.spec.co.jp : 202.32.13.1 -> specgw

Submitted by: Atsushi Murai <amurai@spec.co.jp>


# c8ff1808 30-Apr-1998 Peter Wemm <peter@FreeBSD.org>

*blush*, typo during last minute editing..


# 159da441 30-Apr-1998 Peter Wemm <peter@FreeBSD.org>

Change euid while reading the user's .login_cap file in case the homedir
is on a NFS partion without root read access. Also, flip euid again for
the duration of the chdir() to the homedir for the same reason.

PR: 5145
Submitted by: Joel.Faedi@esial.u-nancy.fr
Also tested by: A Joseph Koshy <koshy@india.hp.com>


# c8b701a4 13-Feb-1998 Andrey A. Chernov <ache@FreeBSD.org>

Fix very rare but dangerous bug:
for some DES passwords
crypt(real_password, salt)
is equal to
crypt("", salt);
It means that this user (and not only he) can login without
entering password at all, just pressing Return.
So if empty password entered and crypted password is not empty,
invalidate any crypt result by assigning ":"


# e28be891 05-Feb-1998 Guido van Rooij <guido@FreeBSD.org>

Reset SGINT and SIGQUIT handling to default when asking for passwords.
Otherwise, when pressing the INT ke at the password prompt, the password
will be displayed. Now login will be killed.

Probably the same will have to be done for the LOGIN_CAP_AUTH case.
I have not done that.
Reviewed by: Joerg Wunsch


# f87ea405 19-Oct-1997 Joerg Wunsch <joerg@FreeBSD.org>

Fix a fatal typo.

PR: bin/4801
Submitted by: mishania@demos.su (Mikhail A. Sokolov)


# 7f80a020 28-Sep-1997 Mark Murray <markm@FreeBSD.org>

Changes for KTH KerberosIV.
Also quieten -Wall a bit.


# 9c9cb2bf 22-Jul-1997 Philippe Charnier <charnier@FreeBSD.org>

= -> ==, strcpy -> strncpy from OpenBSD.
update man page. Add usage().
Obtained from: OpenBSD


# 4b2fab75 22-May-1997 Paul Traina <pst@FreeBSD.org>

Restore backwards compatible default behavior for requirehome


# a317d49b 10-May-1997 David Nugent <davidn@FreeBSD.org>

login_getclass() -> login_getpwclass().
auth_rmfiles() was being called in error without LOGIN_CAP_AUTH defined.


# 3169e0f1 13-Apr-1997 David Nugent <davidn@FreeBSD.org>

Use isdialuptty() rather than hard-coded heuristic.


# f72b1ff3 01-Apr-1997 David Nugent <davidn@FreeBSD.org>

Submitted by: Sergei Chechetkin <csl@whale.sunbay.crimea.ua>

Fix incorrect bracket nesting. Closes PR#3144.


# 1c8af878 28-Mar-1997 Warner Losh <imp@FreeBSD.org>

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


# 1f5367ca 27-Mar-1997 David Nugent <davidn@FreeBSD.org>

Fix for logic in no-password accounts.


# 4a028a88 24-Mar-1997 David Nugent <davidn@FreeBSD.org>

Don't bypass password prompt for root logins on insecure tty if
the root password is empty.


# d8a7b347 24-Mar-1997 David Nugent <davidn@FreeBSD.org>

strdup() value of term to correctly preserve contents.
Rearrange validation logic so that it works correctly when
compiled with kerberos support. Closes PR#3056.


# a52c1be6 18-Mar-1997 David Nugent <davidn@FreeBSD.org>

Submitted by: Paul Traina <root@shockwave.com> (partially)

Cleanup of #ifdef's for LOGIN_CAP.

Fixed bug in empty shell (closes PR#2550).

Refused root logins now displays standard "Login incorrect" and
exhibits identical backoff behaviour to a failed login.

Cleaned up logging of refused logins.

Use #defines for login retries and backoff. Also implemented
definable variables if LOGIN_CAP is defined, with
"login-retries" and "login-backoff" as capabilities
in the default class (closes PR#2805).

TERM from previous environment is no longer truncated.


# 67022bfc 01-Mar-1997 Wolfram Schneider <wosch@FreeBSD.org>

Include copyright message from <sys/copyright.h>


# 7adec208 26-Feb-1997 Andrey A. Chernov <ache@FreeBSD.org>

Back out "shell" / pw_shell change, I was confused by the same
variable name (with different functionality)


# 60797e87 26-Feb-1997 Andrey A. Chernov <ache@FreeBSD.org>

Fix few bogons with pw_shell / shell variables values mismatch
introduced by LOGIN_CAP


# d87e2a2c 22-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Don't dereference NULL pwd on non-existant username (I wonder how long
THAT has been in here!).


# 5217f56e 21-Jan-1997 David Nugent <davidn@FreeBSD.org>

Fix handling of empty shell field in passwd file (use /bin/sh); problem
was caused by introduction of login classes. Closes PR bin/2550.
Added references to login.conf to manpage, crossreference to login.conf(5).


# 6acc486b 11-Jan-1997 David Nugent <davidn@FreeBSD.org>

Makes login login_cap-savvy.

Note that LOGIN_CAP_AUTH code (login authentication) is not (yet) enabled
and requires /usr/libexec/login_<style> authentication program support to
be added at a later date. The Makefile contains a macro LC_AUTH to turn
it on and prevent unnecessarily linking against skey/krb libs and the
addition of klogin.c module.

All other aspects of login_cap support are fully functional.


# 16ac215c 16-Jun-1996 Andrey A. Chernov <ache@FreeBSD.org>

Write numerical address instead of hostname for hostnames > UT_HOSTSIZE
to keep valid information in utmp and lastlog


# 656dcd43 07-Aug-1995 Garrett Wollman <wollman@FreeBSD.org>

Delete bogus referneces to timezone code internal header file `tzfile.h',
which is no longer bogusly installed in /usr/include.


# 7799f52a 30-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.


# a164d484 16-Apr-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Fix spelling error that keeps this from compiling with KERBEROS & SKEY
defined.

Submitted by: Mark Murray <mark@grondar.za>


# ed8be72c 13-Apr-1995 Garrett Wollman <wollman@FreeBSD.org>

Disallow Kerberos when S/Key is required. Fixes PR #339.

Submitted by: Paul Traina <pst@Shockwave.com>


# 758f3a64 14-Jan-1995 Garrett Wollman <wollman@FreeBSD.org>

Modify klogin to:

1) Don't spit out an error message if Kerberos is installed but not yet
set up.

2) Don't attempt to verify the ticket you got back, as workstations
are not intended to have srvtab files of their own.

Both behaviors can be re-enabled with KLOGIN_PARANOID.


# 6dc49372 30-Nov-1994 Ugen J.S. Antsilevich <ugen@FreeBSD.org>

Patch of password expired bug.
Now password changed for right user and
no longer possible to skip password change.
I hope it will be ok....


# 2ddadf84 18-Oct-1994 Paul Traina <pst@FreeBSD.org>

Include most of the logdaemon v4.4 S/key changes


# c9bdc152 29-Sep-1994 Paul Traina <pst@FreeBSD.org>

Install support for skey and login.access


# 83274713 06-Sep-1994 Jordan K. Hubbard <jkh@FreeBSD.org>

Problem:
Accounts that have "pw_change" set, are supposed to change their passwords
by the date specified in "pw_change". If they have not changed their passwords
by that date, currently they get "LOCKED OUT" of the system. This is not the
correct behavior, the user should be prompt (forced?) to change their password
at this time. If the behavior of "pw_change" was meant to be a LOCKOUT,
then you should use "pw_expire".

Solution:
Instead of locking out the user, prompt them to change their password.

Reviewed by: jkh
Submitted by: rls


# f88fe867 22-Aug-1994 Guido van Rooij <guido@FreeBSD.org>

Implemnet fbtab ala SunOS (thanks to WZV, see login_fbtab.c)
Reviewed by:
Submitted by: guido


# 9b50d902 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Usr.bin Sources