Date: Wed, 6 Jan 2010 22:15:26 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r201682 - user/ed/utmpx/crypto/openssh Message-ID: <201001062215.o06MFQSL055606@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Wed Jan 6 22:15:26 2010 New Revision: 201682 URL: http://svn.freebsd.org/changeset/base/201682 Log: Improve hacks on OpenSSH: - Reduce the diff against config.h generated by openssh-portable. - Add some bits to make Last login: work. This should eventually be sent upstream. Modified: user/ed/utmpx/crypto/openssh/config.h user/ed/utmpx/crypto/openssh/loginrec.c Modified: user/ed/utmpx/crypto/openssh/config.h ============================================================================== --- user/ed/utmpx/crypto/openssh/config.h Wed Jan 6 22:14:05 2010 (r201681) +++ user/ed/utmpx/crypto/openssh/config.h Wed Jan 6 22:15:26 2010 (r201682) @@ -448,7 +448,7 @@ #define HAVE_GETUTXENT 1 /* Define to 1 if you have the `getutxid' function. */ -/* #undef HAVE_GETUTXID */ +#define HAVE_GETUTXID 1 /* Define to 1 if you have the `getutxline' function. */ #define HAVE_GETUTXLINE 1 @@ -484,7 +484,7 @@ #define HAVE_HEADER_AD 1 /* Define if you have ut_host in utmp.h */ -#define HAVE_HOST_IN_UTMP 1 +/* #undef HAVE_HOST_IN_UTMP */ /* Define if you have ut_host in utmpx.h */ #define HAVE_HOST_IN_UTMPX 1 @@ -586,10 +586,10 @@ /* #undef HAVE_LOGIN_H */ /* Define to 1 if you have the `logout' function. */ -#define HAVE_LOGOUT 1 +/* #undef HAVE_LOGOUT */ /* Define to 1 if you have the `logwtmp' function. */ -#define HAVE_LOGWTMP 1 +/* #undef HAVE_LOGWTMP */ /* Define to 1 if the system has the type `long double'. */ #define HAVE_LONG_DOUBLE 1 @@ -1025,7 +1025,7 @@ #define HAVE_TIME_H 1 /* Define if you have ut_time in utmp.h */ -#define HAVE_TIME_IN_UTMP 1 +/* #undef HAVE_TIME_IN_UTMP */ /* Define if you have ut_time in utmpx.h */ /* #undef HAVE_TIME_IN_UTMPX */ @@ -1049,7 +1049,7 @@ /* #undef HAVE_TYPE_IN_UTMP */ /* Define if you have ut_type in utmpx.h */ -/* #undef HAVE_TYPE_IN_UTMPX */ +#define HAVE_TYPE_IN_UTMPX 1 /* Define to 1 if you have the <ucred.h> header file. */ /* #undef HAVE_UCRED_H */ @@ -1175,7 +1175,7 @@ /* #undef KRB5 */ /* Define if pututxline updates lastlog too */ -#define LASTLOG_WRITE_PUTUTXLINE 1 +/* #undef LASTLOG_WRITE_PUTUTXLINE */ /* Define if you want TCP Wrappers support */ #define LIBWRAP 1 Modified: user/ed/utmpx/crypto/openssh/loginrec.c ============================================================================== --- user/ed/utmpx/crypto/openssh/loginrec.c Wed Jan 6 22:14:05 2010 (r201681) +++ user/ed/utmpx/crypto/openssh/loginrec.c Wed Jan 6 22:15:26 2010 (r201682) @@ -509,6 +509,10 @@ getlast_entry(struct logininfo *li) return(lastlog_get_entry(li)); #else /* !USE_LASTLOG */ +#if 1 + return (utmpx_get_entry(li)); +#endif + #if defined(DISABLE_LASTLOG) /* On some systems we shouldn't even try to obtain last login * time, e.g. AIX */ @@ -1608,6 +1612,30 @@ lastlog_get_entry(struct logininfo *li) #endif /* HAVE_GETLASTLOGXBYNAME */ #endif /* USE_LASTLOG */ +#if 1 +int +utmpx_get_entry(struct logininfo *li) +{ + struct utmpx *utx; + + if (setutxdb(UTXDB_LASTLOGIN, NULL) != 0) + return (0); + utx = getutxuser(li->username); + if (utx == NULL) { + endutxent(); + return (0); + } + + line_fullname(li->line, utx->ut_line, sizeof(utx->ut_line)); + strlcpy(li->hostname, utx->ut_host, + MIN_SIZEOF(li->hostname, utx->ut_host)); + li->tv_sec = utx->ut_tv.tv_sec; + li->tv_usec = utx->ut_tv.tv_usec; + endutxent(); + return (1); +} +#endif + #ifdef USE_BTMP /* * Logs failed login attempts in _PATH_BTMP if that exists.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001062215.o06MFQSL055606>