Call for testing: OpenSSH-6.2

Dag-Erling Smørgrav des at des.no
Thu Mar 7 22:41:10 EST 2013


Damien Miller <djm at mindrot.org> writes:
> What version of FreeBSD deprecated these? What is you host system type
> as reported by configure? I'll at least be able to add these to
> configure.ac

We switched from utmp to utmpx in 9 on 2010-01-13.  FreeBSD 8 and older
still have utmp.  Any machine that at one point ran FreeBSD 8 or older,
or FreeBSD 9 prior to 2010-01-13, and has since then been upgraded to a
newer version of FreeBSD 9 or 10 is likely to have old log files lying
around even though the interfaces are no longer available.

The problem seems to be a combination of factors in configure.ac and
defines.h which cause OpenSSH to attempt to use utmp / wtmp / lastlog
based solely on the existence of log files, even if it knows the API
functions are not available.

Let's look at lastlog, for instance.

defines.h:
 743: /* I hope that the presence of LASTLOG_FILE is enough to detect this */
 744: #if defined(LASTLOG_FILE) && !defined(DISABLE_LASTLOG)
 745: #  define USE_LASTLOG
 746: #endif

LASTLOG_FILE comes from _PATH_LASTLOG in <paths.h> or, if _PATH_LASTLOG
is not defined, from CONF_LASTLOG_FILE, which is the location of the
lastlog file which configure found.

DISABLE_LASTLOG is defined by configure if and only if at least one of
the following is true:

a) --disable-lastlog was specified on the command line
b) --with-lastlog=no was specified on the command line
c) there is no lastlog file in the expected location(s).

configure never checks whether struct lastlog is defined.  The easiest
solution would probably be to add something like this in configure.ac,
around line 4300:

AC_CHECK_MEMBER([struct lastlog.ll_line], [], [
  AC_DEFINE([DISABLE_LASTLOG])
], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <utmp.h>
])

AC_CHECK_MEMBER([struct utmp.ut_line], [], [
  AC_DEFINE([DISABLE_UTMP])
  AC_DEFINE([DISABLE_WTMP])
], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <utmp.h>
])

On FreeBSD 10, this results in

% egrep "DISABLE_(LASTLOG|UTMP)" config.h
#define DISABLE_LASTLOG 1
#define DISABLE_UTMP 1
/* #undef DISABLE_UTMPX */

One last nit is that the conf_lastlog_file logic runs regardless of
whether DISABLE_LASTLOG is defined, which is a waste of time.

The attached patch combines the DISABLE_{LASTLOG,UTMP,WTMP} logic above
with additional code to disable the log file search.

All tests pass on 8 and 9.  The connect.sh test fails on 10 (both with
and without the patch), but that's likely to be a local issue.  I'll
have to re-run the tests in a clean environment.

DES
-- 
Dag-Erling Smørgrav - des at des.no

-------------- next part --------------
A non-text attachment was scrubbed...
Name: openssh-lastlog.diff
Type: text/x-patch
Size: 5499 bytes
Desc: not available
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20130307/b388d87c/attachment.bin>


More information about the openssh-unix-dev mailing list