History log of /freebsd-current/lib/libpam/modules/pam_lastlog/pam_lastlog.c
Revision Date Author Comments
# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

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


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

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.


# 3cc381b0 26-Jul-2014 Dag-Erling Smørgrav <des@FreeBSD.org>

Remove useless getpwnam() call.

Submitted by: Arthur Mesh <amesh@juniper.net>
MFC after: 1 week


# f1b61fc8 07-Nov-2011 Ed Schouten <ed@FreeBSD.org>

Ensure pam_lastlog removes the /dev/ component of the TTY name.

Some consumers of PAM remove the /dev/ component (i.e. login), while
others don't (i.e. su). We must ensure that the /dev/ component is
removed to ensure that the utmpx entries properly work with tools such
as w(1).

Discussed with: des
MFC after: 1 week


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


# 838357d3 22-Jun-2010 Dag-Erling Smørgrav <des@FreeBSD.org>

merge r196650 from head (via stable/8): tty might be NULL

Approved by: re (kib@)


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


# d1b8647f 18-Jan-2010 Ed Schouten <ed@FreeBSD.org>

Let pam_lastlog use random ut_id's.

By using random values for ut_id, not based on the TTY name, it is
possible to run for example login(1) multiple times on the same TTY,
without overwriting any previous records.

The output of w(1) will then be as follows:

| 12:26PM up 2 days, 2:31, 5 users, load averages: 0.01, 0.03, 0.03
| USER TTY FROM LOGIN@ IDLE WHAT
| ed pts/2 mekker.80386.nl 12:26PM - w
| root pts/2 - 12:26PM - w
| root pts/2 - 12:26PM - w
| root pts/2 - 12:26PM - w

Approved by: des


# 29572408 13-Jan-2010 Ed Schouten <ed@FreeBSD.org>

Let pam_lastlog use utmpx instead of libulog's utmpx interface.

It will still use ulog_login(3) and ulog_logout(3), which will remain
present.


# 444999a3 26-Dec-2009 Ed Schouten <ed@FreeBSD.org>

Several refinements to libulog's API.

- Only set the fields in the ulog_utmpx structure that are valid for the
command in question. This means that strings like "shutdown" or "~"
are not visible to the user anymore.
- Rename UTXF_* to UTXI_*, indicating the indexation, instead of using
the `antique' filename. If we ever get rid of utmp, it makes little
sense calling it by its old name.


# 17c79ad0 11-Dec-2009 Ed Schouten <ed@FreeBSD.org>

Convert pam_lastlog(8) to libulog.

The information used by the "Last login:"-line is obtained by using
ulog_setutxfile(3) to switch to the lastlog database. Login and logout
are performed using the utility functions ulog_login(3) and
ulog_logout(3).

This also means we must build libulog during bootstrap.

Approved by: des


# 43b4dc36 29-Aug-2009 Jonathan Chen <jon@FreeBSD.org>

Prevents pam_lastlog from segfaulting on session close when tty is null.

MFC after: 1 month


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

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


# f0f1db2e 22-Jul-2007 Dag-Erling Smørgrav <des@FreeBSD.org>

Apply the same error checks to PAM_TTY in pam_sm_close_session() as in
pam_sm_open_session(), avoiding false negatives when no tty is present.

Submitted by: Todd C. Miller <millert@courtesan.com>
Approved by: re (rwatson)
MFC after: 2 weeks


# 1173d3bb 22-Jul-2007 Dag-Erling Smørgrav <des@FreeBSD.org>

Whitespace cleanup

Approved by: re (rwatson)


# f5e30bd1 11-Aug-2006 Dag-Erling Smørgrav <des@FreeBSD.org>

Additional debugging stuff I had in my tree.


# 3a59e89e 26-Jan-2004 Dag-Erling Smørgrav <des@FreeBSD.org>

Implement pam_sm_close_session().

PR: bin/61657
Submitted by: Joe R. Doupnik <jrd@cc.usu.edu>


# 91e93869 11-Dec-2003 Dag-Erling Smørgrav <des@FreeBSD.org>

Fix strict aliasing breakage in PAM modules (except pam_krb5, which needs
more work than the others). This should make most modules build with -O2.


# ccd703cf 29-Apr-2003 Dag-Erling Smørgrav <des@FreeBSD.org>

Treat an empty PAM_RHOST the same as a NULL one.

PR: bin/51508


# 6ceeb690 15-Nov-2002 Peter Wemm <peter@FreeBSD.org>

utmp.ut_time and lastlog.ll_time are explicitly int32_t rather than
time_t. Deal with the possibility that time_t != int32_t. This boils
down to this sort of thing:
- time(&ut.ut_time);
+ ut.ut_time = time(NULL);
and similar for ctime(3) etc. I've kept it minimal for the stuff
that may need to be portable (or 3rd party code), but used Matt's time32
stuff for cases where that isn't as much of a concern.

Approved by: re (jhb)


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

Missed one in previous commit.

Pointed out by: nectar


# 2569c273 22-May-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Hide a couple of unguarded error returns behind the no_fail test.


# 89136eab 07-May-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Add a no_fail option.

Sponsored by: DARPA, NAI Labs


# 750e6876 20-Apr-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Oops, fix an inverted if test.


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

Strip /dev/ from tty name, and clean up the "last login" printout.

Sponsored by: DARPA, NAI Labs


# 24fe7ba0 12-Apr-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Major cleanup:

- add __unused where appropriate
- PAM_RETURN -> return since OpenPAM already logs the return value.
- make PAM_LOG use openpam_log()
- make PAM_VERBOSE_ERROR use openpam_get_option() and check flags
for PAM_SILENT
- remove dummy functions since OpenPAM handles missing service
functions
- fix various warnings

Sponsored by: DARPA, NAI Labs


# f03a4b81 14-Mar-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

NAI DBA update.


# 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


# c80f5647 20-Feb-2002 Maxim Sobolev <sobomax@FreeBSD.org>

Create /var/log/lastlog if it doesn't exist.

Submitted by: des


# 8c66575d 04-Feb-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

#include cleanup.

Sponsored by: DARPA, NAI Labs


# ac569969 03-Feb-2002 Mark Murray <markm@FreeBSD.org>

WARNS=n fixes (and some stylistic issues).


# c2065008 24-Jan-2002 Mark Murray <markm@FreeBSD.org>

WARNS=4 fixes. Protect with NO_WERROR for the modules that have
warnings that are hard to fix or that I've been asked to leave alone.


# 9201dc40 24-Jan-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Change the order in which pam_sm_open_session() updates the logs. This
doesn't really make any difference, except it matches wtmp(5) better.

Don't do anything in pam_sm_close_session(); init(8) will take care of
utmp and wtmp when the tty is released. Clearing them here would make it
possible to create a ghost session by logging in, running 'login -f $USER'
and exiting the subshell.

Sponsored by: DARPA, NAI Labs (but the bugs are all mine)


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

Style nits.

Sponsored by: DARPA, NAI Labs


# 16e058b5 24-Jan-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Add a PAM module that records sessions in utmp/wtmp/lastlog.

Sponsored by: DARPA, NAI Labs