mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-19 20:04:44 +02:00
- (dtucker) [configure.ac defines.h loginrec.c logintest.c] Bug #1732: enable
utmpx support on FreeBSD where possible. Patch from Ed Schouten, ok djm@
This commit is contained in:
parent
c4ccb12ee4
commit
261d93a5cf
@ -4,6 +4,8 @@
|
|||||||
- (dtucker) [configure.ac] Bug #1744: use pkg-config for libedit flags if we
|
- (dtucker) [configure.ac] Bug #1744: use pkg-config for libedit flags if we
|
||||||
have it and the path is not provided to --with-libedit. Based on a patch
|
have it and the path is not provided to --with-libedit. Based on a patch
|
||||||
from Iain Morgan.
|
from Iain Morgan.
|
||||||
|
- (dtucker) [configure.ac defines.h loginrec.c logintest.c] Bug #1732: enable
|
||||||
|
utmpx support on FreeBSD where possible. Patch from Ed Schouten, ok djm@
|
||||||
|
|
||||||
20100326
|
20100326
|
||||||
- (djm) [openbsd-compat/bsd-arc4random.c] Fix preprocessor detection
|
- (djm) [openbsd-compat/bsd-arc4random.c] Fix preprocessor detection
|
||||||
|
36
configure.ac
36
configure.ac
@ -1,4 +1,4 @@
|
|||||||
# $Id: configure.ac,v 1.447 2010/04/09 04:04:36 dtucker Exp $
|
# $Id: configure.ac,v 1.448 2010/04/09 08:13:27 dtucker Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 1999-2004 Damien Miller
|
# Copyright (c) 1999-2004 Damien Miller
|
||||||
#
|
#
|
||||||
@ -15,7 +15,7 @@
|
|||||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
|
AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
|
||||||
AC_REVISION($Revision: 1.447 $)
|
AC_REVISION($Revision: 1.448 $)
|
||||||
AC_CONFIG_SRCDIR([ssh.c])
|
AC_CONFIG_SRCDIR([ssh.c])
|
||||||
|
|
||||||
AC_CONFIG_HEADER(config.h)
|
AC_CONFIG_HEADER(config.h)
|
||||||
@ -1557,8 +1557,8 @@ dnl Checks for utmp functions
|
|||||||
AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
|
AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
|
||||||
AC_CHECK_FUNCS(utmpname)
|
AC_CHECK_FUNCS(utmpname)
|
||||||
dnl Checks for utmpx functions
|
dnl Checks for utmpx functions
|
||||||
AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
|
AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline getutxuser pututxline)
|
||||||
AC_CHECK_FUNCS(setutxent utmpxname)
|
AC_CHECK_FUNCS(setutxdb setutxent utmpxname)
|
||||||
dnl Checks for lastlog functions
|
dnl Checks for lastlog functions
|
||||||
AC_CHECK_FUNCS(getlastlogxbyname)
|
AC_CHECK_FUNCS(getlastlogxbyname)
|
||||||
|
|
||||||
@ -4087,34 +4087,6 @@ if test -n "$conf_wtmp_location"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
dnl utmpx detection - I don't know any system so perverse as to require
|
|
||||||
dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
|
|
||||||
dnl there, though.
|
|
||||||
AC_MSG_CHECKING([if your system defines UTMPX_FILE])
|
|
||||||
AC_TRY_COMPILE([
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <utmp.h>
|
|
||||||
#ifdef HAVE_UTMPX_H
|
|
||||||
#include <utmpx.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_PATHS_H
|
|
||||||
# include <paths.h>
|
|
||||||
#endif
|
|
||||||
],
|
|
||||||
[ char *utmpx = UTMPX_FILE; ],
|
|
||||||
[ AC_MSG_RESULT(yes) ],
|
|
||||||
[ AC_MSG_RESULT(no)
|
|
||||||
system_utmpx_path=no ]
|
|
||||||
)
|
|
||||||
if test -z "$conf_utmpx_location"; then
|
|
||||||
if test x"$system_utmpx_path" = x"no" ; then
|
|
||||||
AC_DEFINE(DISABLE_UTMPX)
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
|
|
||||||
[Define if you want to specify the path to your utmpx file])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl wtmpx detection
|
dnl wtmpx detection
|
||||||
AC_MSG_CHECKING([if your system defines WTMPX_FILE])
|
AC_MSG_CHECKING([if your system defines WTMPX_FILE])
|
||||||
AC_TRY_COMPILE([
|
AC_TRY_COMPILE([
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#ifndef _DEFINES_H
|
#ifndef _DEFINES_H
|
||||||
#define _DEFINES_H
|
#define _DEFINES_H
|
||||||
|
|
||||||
/* $Id: defines.h,v 1.159 2010/01/13 23:44:34 tim Exp $ */
|
/* $Id: defines.h,v 1.160 2010/04/09 08:13:27 dtucker Exp $ */
|
||||||
|
|
||||||
|
|
||||||
/* Constants */
|
/* Constants */
|
||||||
@ -674,7 +674,7 @@ struct winsize {
|
|||||||
#else
|
#else
|
||||||
/* Simply select your favourite login types. */
|
/* Simply select your favourite login types. */
|
||||||
/* Can't do if-else because some systems use several... <sigh> */
|
/* Can't do if-else because some systems use several... <sigh> */
|
||||||
# if defined(UTMPX_FILE) && !defined(DISABLE_UTMPX)
|
# if !defined(DISABLE_UTMPX)
|
||||||
# define USE_UTMPX
|
# define USE_UTMPX
|
||||||
# endif
|
# endif
|
||||||
# if defined(UTMP_FILE) && !defined(DISABLE_UTMP)
|
# if defined(UTMP_FILE) && !defined(DISABLE_UTMP)
|
||||||
|
31
loginrec.c
31
loginrec.c
@ -207,6 +207,7 @@ int syslogin_write_entry(struct logininfo *li);
|
|||||||
|
|
||||||
int getlast_entry(struct logininfo *li);
|
int getlast_entry(struct logininfo *li);
|
||||||
int lastlog_get_entry(struct logininfo *li);
|
int lastlog_get_entry(struct logininfo *li);
|
||||||
|
int utmpx_get_entry(struct logininfo *li);
|
||||||
int wtmp_get_entry(struct logininfo *li);
|
int wtmp_get_entry(struct logininfo *li);
|
||||||
int wtmpx_get_entry(struct logininfo *li);
|
int wtmpx_get_entry(struct logininfo *li);
|
||||||
|
|
||||||
@ -508,6 +509,10 @@ getlast_entry(struct logininfo *li)
|
|||||||
#ifdef USE_LASTLOG
|
#ifdef USE_LASTLOG
|
||||||
return(lastlog_get_entry(li));
|
return(lastlog_get_entry(li));
|
||||||
#else /* !USE_LASTLOG */
|
#else /* !USE_LASTLOG */
|
||||||
|
#if defined(USE_UTMPX) && defined(HAVE_SETUTXDB) && \
|
||||||
|
defined(UTXDB_LASTLOGIN) && defined(HAVE_GETUTXUSER)
|
||||||
|
return (utmpx_get_entry(li));
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(DISABLE_LASTLOG)
|
#if defined(DISABLE_LASTLOG)
|
||||||
/* On some systems we shouldn't even try to obtain last login
|
/* On some systems we shouldn't even try to obtain last login
|
||||||
@ -1608,6 +1613,32 @@ lastlog_get_entry(struct logininfo *li)
|
|||||||
#endif /* HAVE_GETLASTLOGXBYNAME */
|
#endif /* HAVE_GETLASTLOGXBYNAME */
|
||||||
#endif /* USE_LASTLOG */
|
#endif /* USE_LASTLOG */
|
||||||
|
|
||||||
|
#if defined(USE_UTMPX) && defined(HAVE_SETUTXDB) && \
|
||||||
|
defined(UTXDB_LASTLOGIN) && defined(HAVE_GETUTXUSER)
|
||||||
|
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,
|
||||||
|
MIN_SIZEOF(li->line, 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 /* USE_UTMPX && HAVE_SETUTXDB && UTXDB_LASTLOGIN && HAVE_GETUTXUSER */
|
||||||
|
|
||||||
#ifdef USE_BTMP
|
#ifdef USE_BTMP
|
||||||
/*
|
/*
|
||||||
* Logs failed login attempts in _PATH_BTMP if that exists.
|
* Logs failed login attempts in _PATH_BTMP if that exists.
|
||||||
|
@ -264,7 +264,7 @@ showOptions(void)
|
|||||||
printf("\tUSE_UTMP (UTMP_FILE=%s)\n", UTMP_FILE);
|
printf("\tUSE_UTMP (UTMP_FILE=%s)\n", UTMP_FILE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_UTMPX
|
#ifdef USE_UTMPX
|
||||||
printf("\tUSE_UTMPX (UTMPX_FILE=%s)\n", UTMPX_FILE);
|
printf("\tUSE_UTMPX\n");
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_WTMP
|
#ifdef USE_WTMP
|
||||||
printf("\tUSE_WTMP (WTMP_FILE=%s)\n", WTMP_FILE);
|
printf("\tUSE_WTMP (WTMP_FILE=%s)\n", WTMP_FILE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user