Ed Maste
2022-May-18 18:13 UTC
PrintLastLog fails on systems without lastlog but with utmpx
>From FreeBSD PR 209441. configure sets DISABLE_LASTLOG if we do nothave 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. It seems like (for consistency with --disable-utmp, --disable-utmpx, --disable-wtmp, --disable-wtmpx) DISABLE_LASTLOG should refer only to lastlog specifically, not last login functionality in general. Thus, servconf should probably be: #if defined(DISABLE_LASTLOG) && defined(DISABLE_UTMP) && defined(DISABLE_UTMPX) &&... { "printlastlog", sUnsupported, SSHCFG_GLOBAL }, #else { "printlastlog", sPrintLastLog, SSHCFG_GLOBAL }, #endif and getlast_entry() should move the wtmp/wtmpx cases out of !defined(DISABLE_LASTLOG).
Ed Maste
2023-May-02 20:15 UTC
PrintLastLog fails on systems without lastlog but with utmpx
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.