PrintLastLog fails on systems without lastlog but with utmpx
Ed Maste
emaste at freebsd.org
Wed May 3 06:15:57 AEST 2023
On Wed, 18 May 2022 at 14:13, Ed Maste <emaste at freebsd.org> wrote:
>
> From FreeBSD PR 209441. configure sets DISABLE_LASTLOG if we do not
> have lastlog.ll_line:
>
> AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
> if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
> AC_DEFINE([DISABLE_LASTLOG])
> fi
> ], [
>
> However DISABLE_LASTLOG disables support for PrintLastLog altogether
> -- from servconf.c:
>
> #ifdef DISABLE_LASTLOG
> { "printlastlog", sUnsupported, SSHCFG_GLOBAL },
> #else
> { "printlastlog", sPrintLastLog, SSHCFG_GLOBAL },
> #endif
>
> In getlast_entry() DISABLE_LASTLOG disables use of wtmp and wtmpx, but
> not utmpx. DISABLE_LASTLOG seems to be intended to mean disable last
> login functionality altogether, and disable use of specifically
> utmp/lastlog, in different locations.
This is still the case -- DISABLE_LASTLOG can be set if we do not want
lastlog functionality, but it is automatically set by configure if we
don't have lastlog.ll_line:
AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
if test x$SKIP_DISABLE_LASTLOG_DEFINE != "xyes" ; then
AC_DEFINE([DISABLE_LASTLOG])
fi
elsewhere we explicitly do not set DISABLE_LASTLOG if a lastlog file
cannot be found, with a comment that wtmp/wtmpx would not be tested:
if test -z "$conf_lastlog_location"; then
AC_MSG_WARN([** Cannot find lastlog **])
dnl Don't define DISABLE_LASTLOG - that means
we don't try wtmp/wtmpx
fi
and there's a special case SCO OpenServer 5.x:
SKIP_DISABLE_LASTLOG_DEFINE=yes
to avoid the lastlog.ll_line test.
As a workaround to fix this for FreeBSD I just added SKIP_DISABLE_LASTLOG_DEFINE
https://cgit.freebsd.org/src/commit/?id=170511589e4d15a27ee92979691cfc1b26929bb7
but this needs a proper fix, presumably by splitting DISABLE_LASTLOG in two.
More information about the openssh-unix-dev
mailing list