summaryrefslogtreecommitdiff
path: root/login.c
diff options
context:
space:
mode:
Diffstat (limited to 'login.c')
-rw-r--r--login.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/login.c b/login.c
index 660eb6705..0d874cc71 100644
--- a/login.c
+++ b/login.c
@@ -18,7 +18,7 @@
18 */ 18 */
19 19
20#include "includes.h" 20#include "includes.h"
21RCSID("$Id: login.c,v 1.25 2000/05/01 12:53:53 damien Exp $"); 21RCSID("$Id: login.c,v 1.26 2000/05/17 11:34:08 damien Exp $");
22 22
23#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX) 23#if defined(HAVE_UTMPX_H) && defined(USE_UTMPX)
24# include <utmpx.h> 24# include <utmpx.h>
@@ -87,6 +87,7 @@ get_last_login_time(uid_t uid, const char *logname,
87 return ll.ll_time; 87 return ll.ll_time;
88 88
89#else /* defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG) */ 89#else /* defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG) */
90# ifdef HAVE_TYPE_IN_UTMP
90 /* Look in wtmp for the last login */ 91 /* Look in wtmp for the last login */
91 struct utmp wt; 92 struct utmp wt;
92 char *wt_file = _PATH_WTMP; 93 char *wt_file = _PATH_WTMP;
@@ -111,14 +112,14 @@ get_last_login_time(uid_t uid, const char *logname,
111 if ( wt.ut_type == USER_PROCESS) { 112 if ( wt.ut_type == USER_PROCESS) {
112 if ( !strncmp(logname, wt.ut_user, 8) ) { 113 if ( !strncmp(logname, wt.ut_user, 8) ) {
113 t = (unsigned long) wt.ut_time; 114 t = (unsigned long) wt.ut_time;
114#ifdef HAVE_HOST_IN_UTMP 115# ifdef HAVE_HOST_IN_UTMP
115 if (bufsize > sizeof(wt.ut_host) + 1) 116 if (bufsize > sizeof(wt.ut_host) + 1)
116 bufsize = sizeof(wt.ut_host) + 1; 117 bufsize = sizeof(wt.ut_host) + 1;
117 strncpy(buf, wt.ut_host, bufsize - 1); 118 strncpy(buf, wt.ut_host, bufsize - 1);
118 buf[bufsize - 1] = 0; 119 buf[bufsize - 1] = 0;
119#else /* HAVE_HOST_IN_UTMP */ 120# else /* HAVE_HOST_IN_UTMP */
120 buf[0] = 0; 121 buf[0] = 0;
121#endif /* HAVE_HOST_IN_UTMP */ 122# endif /* HAVE_HOST_IN_UTMP */
122 } 123 }
123 } 124 }
124 125
@@ -127,6 +128,9 @@ get_last_login_time(uid_t uid, const char *logname,
127 } while (t == 0); 128 } while (t == 0);
128 129
129 return t; 130 return t;
131# else
132 return 0;
133# endif /* HAVE_TYPE_IN_UTMP */
130#endif /* defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG) */ 134#endif /* defined(_PATH_LASTLOG) && !defined(DISABLE_LASTLOG) */
131} 135}
132 136