View | Details | Raw Unified | Return to bug 1732
Collapse All | Expand All

(-)configure.ac (-30 / +2 lines)
Lines 1522-1529 Link Here
1522
AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1522
AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1523
AC_CHECK_FUNCS(utmpname)
1523
AC_CHECK_FUNCS(utmpname)
1524
dnl    Checks for utmpx functions
1524
dnl    Checks for utmpx functions
1525
AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1525
AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline getutxuser pututxline)
1526
AC_CHECK_FUNCS(setutxent utmpxname)
1526
AC_CHECK_FUNCS(setutxdb setutxent utmpxname)
1527
dnl    Checks for lastlog functions
1527
dnl    Checks for lastlog functions
1528
AC_CHECK_FUNCS(getlastlogxbyname)
1528
AC_CHECK_FUNCS(getlastlogxbyname)
1529
1529
Lines 4115-4148 Link Here
4115
		[Define if you want to specify the path to your wtmp file])
4115
		[Define if you want to specify the path to your wtmp file])
4116
fi
4116
fi
4117
4117
4118
4119
dnl utmpx detection - I don't know any system so perverse as to require
4120
dnl  utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
4121
dnl  there, though.
4122
AC_MSG_CHECKING([if your system defines UTMPX_FILE])
4123
AC_TRY_COMPILE([
4124
#include <sys/types.h>
4125
#include <utmp.h>
4126
#ifdef HAVE_UTMPX_H
4127
#include <utmpx.h>
4128
#endif
4129
#ifdef HAVE_PATHS_H
4130
#  include <paths.h>
4131
#endif
4132
	],
4133
	[ char *utmpx = UTMPX_FILE; ],
4134
	[ AC_MSG_RESULT(yes) ],
4135
	[ AC_MSG_RESULT(no)
4136
	  system_utmpx_path=no ]
4137
)
4138
if test -z "$conf_utmpx_location"; then
4139
	if test x"$system_utmpx_path" = x"no" ; then
4140
		AC_DEFINE(DISABLE_UTMPX)
4141
	fi
4142
else
4143
	AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
4144
		[Define if you want to specify the path to your utmpx file])
4145
fi
4146
4118
4147
dnl wtmpx detection
4119
dnl wtmpx detection
4148
AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4120
AC_MSG_CHECKING([if your system defines WTMPX_FILE])
(-)defines.h (-1 / +1 lines)
Lines 674-680 Link Here
674
#else
674
#else
675
/* Simply select your favourite login types. */
675
/* Simply select your favourite login types. */
676
/* Can't do if-else because some systems use several... <sigh> */
676
/* Can't do if-else because some systems use several... <sigh> */
677
#  if defined(UTMPX_FILE) && !defined(DISABLE_UTMPX)
677
#  if !defined(DISABLE_UTMPX)
678
#    define USE_UTMPX
678
#    define USE_UTMPX
679
#  endif
679
#  endif
680
#  if defined(UTMP_FILE) && !defined(DISABLE_UTMP)
680
#  if defined(UTMP_FILE) && !defined(DISABLE_UTMP)
(-)loginrec.c (+31 lines)
Lines 207-212 Link Here
207
207
208
int getlast_entry(struct logininfo *li);
208
int getlast_entry(struct logininfo *li);
209
int lastlog_get_entry(struct logininfo *li);
209
int lastlog_get_entry(struct logininfo *li);
210
int utmpx_get_entry(struct logininfo *li);
210
int wtmp_get_entry(struct logininfo *li);
211
int wtmp_get_entry(struct logininfo *li);
211
int wtmpx_get_entry(struct logininfo *li);
212
int wtmpx_get_entry(struct logininfo *li);
212
213
Lines 508-513 Link Here
508
#ifdef USE_LASTLOG
509
#ifdef USE_LASTLOG
509
	return(lastlog_get_entry(li));
510
	return(lastlog_get_entry(li));
510
#else /* !USE_LASTLOG */
511
#else /* !USE_LASTLOG */
512
#if defined(USE_UTMPX) && defined(HAVE_SETUTXDB) && \
513
    defined(UTXDB_LASTLOGIN) && defined(HAVE_GETUTXUSER)
514
	return (utmpx_get_entry(li));
515
#endif
511
516
512
#if defined(DISABLE_LASTLOG)
517
#if defined(DISABLE_LASTLOG)
513
	/* On some systems we shouldn't even try to obtain last login
518
	/* On some systems we shouldn't even try to obtain last login
Lines 1607-1612 Link Here
1607
}
1612
}
1608
#endif /* HAVE_GETLASTLOGXBYNAME */
1613
#endif /* HAVE_GETLASTLOGXBYNAME */
1609
#endif /* USE_LASTLOG */
1614
#endif /* USE_LASTLOG */
1615
1616
#if defined(USE_UTMPX) && defined(HAVE_SETUTXDB) && \
1617
    defined(UTXDB_LASTLOGIN) && defined(HAVE_GETUTXUSER)
1618
int
1619
utmpx_get_entry(struct logininfo *li)
1620
{
1621
	struct utmpx *utx;
1622
1623
	if (setutxdb(UTXDB_LASTLOGIN, NULL) != 0)
1624
		return (0);
1625
	utx = getutxuser(li->username);
1626
	if (utx == NULL) {
1627
		endutxent();
1628
		return (0);
1629
	}
1630
1631
	line_fullname(li->line, utx->ut_line,
1632
	    MIN_SIZEOF(li->line, utx->ut_line));
1633
	strlcpy(li->hostname, utx->ut_host,
1634
	    MIN_SIZEOF(li->hostname, utx->ut_host));
1635
	li->tv_sec = utx->ut_tv.tv_sec;
1636
	li->tv_usec = utx->ut_tv.tv_usec;
1637
	endutxent();
1638
	return (1);
1639
}
1640
#endif /* USE_UTMPX && HAVE_SETUTXDB && UTXDB_LASTLOGIN && HAVE_GETUTXUSER */
1610
1641
1611
#ifdef USE_BTMP
1642
#ifdef USE_BTMP
1612
  /*
1643
  /*
(-)logintest.c (-1 / +1 lines)
Lines 264-270 Link Here
264
	printf("\tUSE_UTMP (UTMP_FILE=%s)\n", UTMP_FILE);
264
	printf("\tUSE_UTMP (UTMP_FILE=%s)\n", UTMP_FILE);
265
#endif
265
#endif
266
#ifdef USE_UTMPX
266
#ifdef USE_UTMPX
267
	printf("\tUSE_UTMPX (UTMPX_FILE=%s)\n", UTMPX_FILE);
267
	printf("\tUSE_UTMPX\n");
268
#endif
268
#endif
269
#ifdef USE_WTMP
269
#ifdef USE_WTMP
270
	printf("\tUSE_WTMP (WTMP_FILE=%s)\n", WTMP_FILE);
270
	printf("\tUSE_WTMP (WTMP_FILE=%s)\n", WTMP_FILE);

Return to bug 1732