]> andersk Git - openssh.git/commitdiff
- NetBSD login.c compile fix from David Rankin
authordamien <damien>
Mon, 27 Dec 1999 23:41:12 +0000 (23:41 +0000)
committerdamien <damien>
Mon, 27 Dec 1999 23:41:12 +0000 (23:41 +0000)
  <drankin@bohemians.lexington.ky.us>
 - Fully set ut_tv if present in utmp or utmpx

ChangeLog
acconfig.h
configure.in
login.c

index 70e1c037a3298dc4fbbaf9221307574d8a20efa3..55051011f44feec922af57d5b8bddc7e41ccade7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 19991228
  - Replacement for getpagesize() for systems which lack it
+ - NetBSD login.c compile fix from David Rankin 
+  <drankin@bohemians.lexington.ky.us>
+ - Fully set ut_tv if present in utmp or utmpx
 
 19991227
  - Automatically correct paths in manpages and configuration files. Patch
index 15de34575a41e8c122b4b88369a0e9fecd4c42ff..f3a7225e2195bb94e7e19759580cf8acb85161bc 100644 (file)
 /* Define is utmpx.h has a syslen field */
 #undef HAVE_SYSLEN_IN_UTMPX
 
+/* Define is utmp.h has a ut_pid field */
+#undef HAVE_PID_IN_UTMP
+
+/* Define is utmp.h has a ut_type field */
+#undef HAVE_TYPE_IN_UTMP
+
+/* Define is utmp.h has a ut_tv field */
+#undef HAVE_TV_IN_UTMP
+
 /* Define if you want to use utmpx */
 #undef USE_UTMPX
 
index 57b08a42133aae5737eef850d8d6a48472cf53ef..6fb5d63c6616509c69b26669f7b5cd2b97bab96f 100644 (file)
@@ -264,6 +264,21 @@ AC_EGREP_HEADER(syslen, utmpx.h,
        [AC_DEFINE(HAVE_SYSLEN_IN_UTMPX) AC_MSG_RESULT(yes); ], 
        [AC_MSG_RESULT(no)]
 )
+AC_MSG_CHECKING([whether utmp.h has ut_pid field])
+AC_EGREP_HEADER(ut_pid, utmp.h, 
+       [AC_DEFINE(HAVE_PID_IN_UTMP) AC_MSG_RESULT(yes); ], 
+       [AC_MSG_RESULT(no)]
+)
+AC_MSG_CHECKING([whether utmp.h has ut_type field])
+AC_EGREP_HEADER(ut_type, utmp.h, 
+       [AC_DEFINE(HAVE_TYPE_IN_UTMP) AC_MSG_RESULT(yes); ], 
+       [AC_MSG_RESULT(no)]
+)
+AC_MSG_CHECKING([whether utmp.h has ut_tv field])
+AC_EGREP_HEADER(ut_tv, utmp.h, 
+       [AC_DEFINE(HAVE_TV_IN_UTMP) AC_MSG_RESULT(yes); ], 
+       [AC_MSG_RESULT(no)]
+)
 
 dnl Look for lastlog location
 AC_ARG_WITH(lastlog,
diff --git a/login.c b/login.c
index c49831c01d1667b0dd27cd8ce512a51ca9a8c2ed..d713155d74a085c89587b9fef265ca2f35e1dc19 100644 (file)
--- a/login.c
+++ b/login.c
@@ -142,10 +142,18 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
        memset(&u, 0, sizeof(u));
        strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line));
        strncpy(u.ut_id, ttyname + 8, sizeof(u.ut_id));
-       u.ut_pid = (pid_t)pid;
-       u.ut_time = time(NULL);
        strncpy(u.ut_name, user, sizeof(u.ut_name));
+#if defined(HAVE_TV_IN_UTMP)
+       (void)gettimeofday(&u.ut_tv, NULL);
+#else /* defined(HAVE_TV_IN_UTMP) */
+       u.ut_time = time(NULL);
+#endif /* defined(HAVE_TV_IN_UTMP) */
+#if defined(HAVE_PID_IN_UTMP)
+       u.ut_pid = (pid_t)pid;
+#endif /* HAVE_PID_IN_UTMP */
+#if defined(HAVE_TYPE_IN_UTMP)
        u.ut_type = (uid == -1)?DEAD_PROCESS:USER_PROCESS;
+#endif /* HAVE_TYPE_IN_UTMP */
 #if defined(HAVE_HOST_IN_UTMP)
        strncpy(u.ut_host, host, sizeof(u.ut_host));
 #endif
@@ -156,7 +164,7 @@ record_login(int pid, const char *ttyname, const char *user, uid_t uid,
        strncpy(utx.ut_line, ttyname + 5, sizeof(utx.ut_line));
        strncpy(utx.ut_id, ttyname + 8, sizeof(utx.ut_id));
        utx.ut_pid = (pid_t)pid;
-       utx.ut_tv.tv_sec = time(NULL);
+       (void)gettimeofday(&utx.ut_tv, NULL);
        utx.ut_type = (uid == -1)?DEAD_PROCESS:USER_PROCESS;
 # ifdef HAVE_HOST_IN_UTMPX
 #  ifdef HAVE_SYSLEN_IN_UTMPX
This page took 0.047304 seconds and 5 git commands to generate.