History log of /freebsd-10.3-release/lib/libpam/modules/pam_lastlog/pam_lastlog.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 296373 04-Mar-2016 marius

- Copy stable/10@296371 to releng/10.3 in preparation for 10.3-RC1
builds.
- Update newvers.sh to reflect RC1.
- Update __FreeBSD_version to reflect 10.3.
- Update default pkg(8) configuration to use the quarterly branch.

Approved by: re (implicit)

# 270398 23-Aug-2014 des

MFH (r269115): remove useless getpwnam() call


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

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


# 227314 07-Nov-2011 ed

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


# 202566 18-Jan-2010 ed

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


# 202211 13-Jan-2010 ed

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.


# 201033 26-Dec-2009 ed

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.


# 200413 11-Dec-2009 ed

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


# 196650 30-Aug-2009 jon

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

MFC after: 1 month


# 171544 22-Jul-2007 des

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


# 171543 22-Jul-2007 des

Whitespace cleanup

Approved by: re (rwatson)


# 161209 11-Aug-2006 des

Additional debugging stuff I had in my tree.


# 125046 26-Jan-2004 des

Implement pam_sm_close_session().

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


# 123448 11-Dec-2003 des

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.


# 114264 30-Apr-2003 des

Treat an empty PAM_RHOST the same as a NULL one.

PR: bin/51508


# 106966 15-Nov-2002 peter

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)


# 97625 30-May-2002 des

Missed one in previous commit.

Pointed out by: nectar


# 97148 23-May-2002 des

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


# 96192 08-May-2002 des

Add a no_fail option.

Sponsored by: DARPA, NAI Labs


# 95136 20-Apr-2002 des

Oops, fix an inverted if test.


# 95135 20-Apr-2002 des

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

Sponsored by: DARPA, NAI Labs


# 94564 12-Apr-2002 des

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


# 92297 14-Mar-2002 des

NAI DBA update.


# 91714 05-Mar-2002 des

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


# 90955 20-Feb-2002 sobomax

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

Submitted by: des


# 90229 05-Feb-2002 des

#include cleanup.

Sponsored by: DARPA, NAI Labs


# 90145 03-Feb-2002 markm

WARNS=n fixes (and some stylistic issues).


# 89760 24-Jan-2002 markm

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.


# 89748 24-Jan-2002 des

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)


# 89743 24-Jan-2002 des

Style nits.

Sponsored by: DARPA, NAI Labs


# 89728 24-Jan-2002 des

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

Sponsored by: DARPA, NAI Labs