summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--acconfig.h9
-rw-r--r--configure.in15
-rw-r--r--login.c16
4 files changed, 39 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 70e1c037a..55051011f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
119991228 119991228
2 - Replacement for getpagesize() for systems which lack it 2 - Replacement for getpagesize() for systems which lack it
3 - NetBSD login.c compile fix from David Rankin
4 <drankin@bohemians.lexington.ky.us>
5 - Fully set ut_tv if present in utmp or utmpx
3 6
419991227 719991227
5 - Automatically correct paths in manpages and configuration files. Patch 8 - Automatically correct paths in manpages and configuration files. Patch
diff --git a/acconfig.h b/acconfig.h
index 15de34575..f3a7225e2 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -36,6 +36,15 @@
36/* Define is utmpx.h has a syslen field */ 36/* Define is utmpx.h has a syslen field */
37#undef HAVE_SYSLEN_IN_UTMPX 37#undef HAVE_SYSLEN_IN_UTMPX
38 38
39/* Define is utmp.h has a ut_pid field */
40#undef HAVE_PID_IN_UTMP
41
42/* Define is utmp.h has a ut_type field */
43#undef HAVE_TYPE_IN_UTMP
44
45/* Define is utmp.h has a ut_tv field */
46#undef HAVE_TV_IN_UTMP
47
39/* Define if you want to use utmpx */ 48/* Define if you want to use utmpx */
40#undef USE_UTMPX 49#undef USE_UTMPX
41 50
diff --git a/configure.in b/configure.in
index 57b08a421..6fb5d63c6 100644
--- a/configure.in
+++ b/configure.in
@@ -264,6 +264,21 @@ AC_EGREP_HEADER(syslen, utmpx.h,
264 [AC_DEFINE(HAVE_SYSLEN_IN_UTMPX) AC_MSG_RESULT(yes); ], 264 [AC_DEFINE(HAVE_SYSLEN_IN_UTMPX) AC_MSG_RESULT(yes); ],
265 [AC_MSG_RESULT(no)] 265 [AC_MSG_RESULT(no)]
266) 266)
267AC_MSG_CHECKING([whether utmp.h has ut_pid field])
268AC_EGREP_HEADER(ut_pid, utmp.h,
269 [AC_DEFINE(HAVE_PID_IN_UTMP) AC_MSG_RESULT(yes); ],
270 [AC_MSG_RESULT(no)]
271)
272AC_MSG_CHECKING([whether utmp.h has ut_type field])
273AC_EGREP_HEADER(ut_type, utmp.h,
274 [AC_DEFINE(HAVE_TYPE_IN_UTMP) AC_MSG_RESULT(yes); ],
275 [AC_MSG_RESULT(no)]
276)
277AC_MSG_CHECKING([whether utmp.h has ut_tv field])
278AC_EGREP_HEADER(ut_tv, utmp.h,
279 [AC_DEFINE(HAVE_TV_IN_UTMP) AC_MSG_RESULT(yes); ],
280 [AC_MSG_RESULT(no)]
281)
267 282
268dnl Look for lastlog location 283dnl Look for lastlog location
269AC_ARG_WITH(lastlog, 284AC_ARG_WITH(lastlog,
diff --git a/login.c b/login.c
index f03db0532..80a63f3d7 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.13 1999/12/27 00:33:56 damien Exp $"); 21RCSID("$Id: login.c,v 1.14 1999/12/27 23:41:12 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>
@@ -142,10 +142,18 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
142 memset(&u, 0, sizeof(u)); 142 memset(&u, 0, sizeof(u));
143 strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line)); 143 strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line));
144 strncpy(u.ut_id, ttyname + 8, sizeof(u.ut_id)); 144 strncpy(u.ut_id, ttyname + 8, sizeof(u.ut_id));
145 u.ut_pid = (pid_t)pid;
146 u.ut_time = time(NULL);
147 strncpy(u.ut_name, user, sizeof(u.ut_name)); 145 strncpy(u.ut_name, user, sizeof(u.ut_name));
146#if defined(HAVE_TV_IN_UTMP)
147 (void)gettimeofday(&u.ut_tv, NULL);
148#else /* defined(HAVE_TV_IN_UTMP) */
149 u.ut_time = time(NULL);
150#endif /* defined(HAVE_TV_IN_UTMP) */
151#if defined(HAVE_PID_IN_UTMP)
152 u.ut_pid = (pid_t)pid;
153#endif /* HAVE_PID_IN_UTMP */
154#if defined(HAVE_TYPE_IN_UTMP)
148 u.ut_type = (uid == -1)?DEAD_PROCESS:USER_PROCESS; 155 u.ut_type = (uid == -1)?DEAD_PROCESS:USER_PROCESS;
156#endif /* HAVE_TYPE_IN_UTMP */
149#if defined(HAVE_HOST_IN_UTMP) 157#if defined(HAVE_HOST_IN_UTMP)
150 strncpy(u.ut_host, host, sizeof(u.ut_host)); 158 strncpy(u.ut_host, host, sizeof(u.ut_host));
151#endif 159#endif
@@ -156,7 +164,7 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
156 strncpy(utx.ut_line, ttyname + 5, sizeof(utx.ut_line)); 164 strncpy(utx.ut_line, ttyname + 5, sizeof(utx.ut_line));
157 strncpy(utx.ut_id, ttyname + 8, sizeof(utx.ut_id)); 165 strncpy(utx.ut_id, ttyname + 8, sizeof(utx.ut_id));
158 utx.ut_pid = (pid_t)pid; 166 utx.ut_pid = (pid_t)pid;
159 utx.ut_tv.tv_sec = time(NULL); 167 (void)gettimeofday(&utx.ut_tv, NULL);
160 utx.ut_type = (uid == -1)?DEAD_PROCESS:USER_PROCESS; 168 utx.ut_type = (uid == -1)?DEAD_PROCESS:USER_PROCESS;
161# ifdef HAVE_HOST_IN_UTMPX 169# ifdef HAVE_HOST_IN_UTMPX
162# ifdef HAVE_SYSLEN_IN_UTMPX 170# ifdef HAVE_SYSLEN_IN_UTMPX