mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-29 00:34:33 +02:00
Fixed getlast_entry() so that it doesn't try to use utmp(x) if
DISABLE_LASTLOG is defined. Bug reported by Tom Bertelson <tbert@abac.com> for AIX.
This commit is contained in:
parent
c29de955f4
commit
ecaabf1b6a
21
loginrec.c
21
loginrec.c
@ -170,7 +170,7 @@
|
|||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
#include "loginrec.h"
|
#include "loginrec.h"
|
||||||
|
|
||||||
RCSID("$Id: loginrec.c,v 1.4 2000/06/07 11:32:13 djm Exp $");
|
RCSID("$Id: loginrec.c,v 1.5 2000/06/12 22:21:44 andre Exp $");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** prototypes for helper functions in this file
|
** prototypes for helper functions in this file
|
||||||
@ -372,29 +372,40 @@ getlast_entry(struct logininfo *li)
|
|||||||
#else
|
#else
|
||||||
/* !USE_LASTLOG */
|
/* !USE_LASTLOG */
|
||||||
|
|
||||||
|
# ifdef DISABLE_LASTLOG
|
||||||
|
/* On some systems we shouldn't even try to obtain last login
|
||||||
|
* time, e.g. AIX */
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
# else
|
||||||
/* Try to retrieve the last login time from wtmp */
|
/* Try to retrieve the last login time from wtmp */
|
||||||
# if defined(USE_WTMP) && (defined(HAVE_TIME_IN_UTMP) || defined(HAVE_TV_IN_UTMP))
|
# if defined(USE_WTMP) && (defined(HAVE_TIME_IN_UTMP) || defined(HAVE_TV_IN_UTMP))
|
||||||
/* retrieve last login time from utmp */
|
/* retrieve last login time from utmp */
|
||||||
if (wtmp_get_entry(li))
|
if (wtmp_get_entry(li))
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
# else
|
# else
|
||||||
|
|
||||||
/* If wtmp isn't available, try wtmpx */
|
/* If wtmp isn't available, try wtmpx */
|
||||||
|
|
||||||
# if defined(USE_WTMPX) && (defined(HAVE_TIME_IN_UTMPX) || defined(HAVE_TV_IN_UTMPX))
|
# if defined(USE_WTMPX) && (defined(HAVE_TIME_IN_UTMPX) || defined(HAVE_TV_IN_UTMPX))
|
||||||
/* retrieve last login time from utmpx */
|
/* retrieve last login time from utmpx */
|
||||||
if (wtmpx_get_entry(li))
|
if (wtmpx_get_entry(li))
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
# else
|
# else
|
||||||
|
|
||||||
/* Give up: No means of retrieving last login time */
|
/* Give up: No means of retrieving last login time */
|
||||||
return 0;
|
return 0;
|
||||||
|
# endif
|
||||||
|
/* USE_WTMPX && (HAVE_TIME_IN_UTMPX || HAVE_TV_IN_UTMPX) */
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
/* USE_WTMP && (HAVE_TIME_IN_UTMP || HAVE_TV_IN_UTMP) */
|
||||||
# endif
|
# endif
|
||||||
|
/* DISABLE_LASTLOG */
|
||||||
#endif
|
#endif
|
||||||
/* USE_LASTLOG */
|
/* USE_LASTLOG */
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user