summaryrefslogtreecommitdiff
path: root/loginrec.c
diff options
context:
space:
mode:
authorandre <andre>2000-06-12 22:21:44 +0000
committerandre <andre>2000-06-12 22:21:44 +0000
commitecaabf1b6abe51487a1ac593ac229236fc07b914 (patch)
tree3c65e364bec1aaf42c42ae481b7f972fde914f8f /loginrec.c
parentc29de955f4934441b3db9e31535d5e12c33e3d7d (diff)
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.
Diffstat (limited to 'loginrec.c')
-rw-r--r--loginrec.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/loginrec.c b/loginrec.c
index 5951e0271..00136a952 100644
--- a/loginrec.c
+++ b/loginrec.c
@@ -170,7 +170,7 @@
170#include "xmalloc.h" 170#include "xmalloc.h"
171#include "loginrec.h" 171#include "loginrec.h"
172 172
173RCSID("$Id: loginrec.c,v 1.4 2000/06/07 11:32:13 djm Exp $"); 173RCSID("$Id: loginrec.c,v 1.5 2000/06/12 22:21:44 andre Exp $");
174 174
175/** 175/**
176 ** prototypes for helper functions in this file 176 ** prototypes for helper functions in this file
@@ -372,29 +372,40 @@ getlast_entry(struct logininfo *li)
372#else 372#else
373 /* !USE_LASTLOG */ 373 /* !USE_LASTLOG */
374 374
375# ifdef DISABLE_LASTLOG
376 /* On some systems we shouldn't even try to obtain last login
377 * time, e.g. AIX */
378 return 0;
379
380# else
375 /* Try to retrieve the last login time from wtmp */ 381 /* Try to retrieve the last login time from wtmp */
376# if defined(USE_WTMP) && (defined(HAVE_TIME_IN_UTMP) || defined(HAVE_TV_IN_UTMP)) 382# if defined(USE_WTMP) && (defined(HAVE_TIME_IN_UTMP) || defined(HAVE_TV_IN_UTMP))
377 /* retrieve last login time from utmp */ 383 /* retrieve last login time from utmp */
378 if (wtmp_get_entry(li)) 384 if (wtmp_get_entry(li))
379 return 1; 385 return 1;
380 else 386 else
381 return 0; 387 return 0;
382# else 388# else
383 389
384 /* If wtmp isn't available, try wtmpx */ 390 /* If wtmp isn't available, try wtmpx */
385 391
386# if defined(USE_WTMPX) && (defined(HAVE_TIME_IN_UTMPX) || defined(HAVE_TV_IN_UTMPX)) 392# if defined(USE_WTMPX) && (defined(HAVE_TIME_IN_UTMPX) || defined(HAVE_TV_IN_UTMPX))
387 /* retrieve last login time from utmpx */ 393 /* retrieve last login time from utmpx */
388 if (wtmpx_get_entry(li)) 394 if (wtmpx_get_entry(li))
389 return 1; 395 return 1;
390 else 396 else
391 return 0; 397 return 0;
392# else 398# else
393 399
394 /* Give up: No means of retrieving last login time */ 400 /* Give up: No means of retrieving last login time */
395 return 0; 401 return 0;
402# endif
403 /* USE_WTMPX && (HAVE_TIME_IN_UTMPX || HAVE_TV_IN_UTMPX) */
404
396# endif 405# endif
406 /* USE_WTMP && (HAVE_TIME_IN_UTMP || HAVE_TV_IN_UTMP) */
397# endif 407# endif
408 /* DISABLE_LASTLOG */
398#endif 409#endif
399/* USE_LASTLOG */ 410/* USE_LASTLOG */
400} 411}