1997-01-06 14:09:34 +00:00
|
|
|
--- lib/os.c.orig Mon Jan 6 22:09:06 1997
|
|
|
|
+++ lib/os.c Mon Jan 6 22:08:34 1997
|
1997-01-06 08:51:05 +00:00
|
|
|
@@ -26,6 +26,8 @@
|
|
|
|
#include <sys/acct.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <packet.h>
|
|
|
|
+#include <sys/socket.h>
|
|
|
|
+#include <netdb.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_UTMPX_H
|
|
|
|
#include <utmpx.h>
|
|
|
|
@@ -70,8 +72,12 @@
|
1996-07-10 22:33:14 +00:00
|
|
|
|
|
|
|
/* Where the utmp file is located. */
|
|
|
|
#ifndef HAVE_GETUTENT
|
|
|
|
+#ifdef __FreeBSD__
|
1997-01-06 14:09:34 +00:00
|
|
|
+#define UTMP_FILE _PATH_UTMP
|
1996-07-10 22:33:14 +00:00
|
|
|
+#else
|
|
|
|
#define UTMP_FILE "/etc/utmp"
|
|
|
|
#endif
|
1997-01-06 08:51:05 +00:00
|
|
|
+#endif
|
1996-07-10 22:33:14 +00:00
|
|
|
|
|
|
|
/* A non-null value is the address of the utmp entry which contains the
|
1997-01-06 08:51:05 +00:00
|
|
|
information for the user using the console. */
|
1997-01-06 14:09:34 +00:00
|
|
|
@@ -288,6 +294,21 @@
|
|
|
|
{
|
|
|
|
idle = current_time - get_last_access (utmplist[i]->ut_line);
|
|
|
|
|
|
|
|
+#ifdef __FreeBSD__
|
|
|
|
+ /*
|
|
|
|
+ * GNU finger lists two information of one user for one machine,
|
|
|
|
+ * (1. about login console, 2. tty which has smallest idling time.)
|
|
|
|
+ * In listing algorithm, GNU finger server program [fingerd] uses
|
|
|
|
+ * `console' string in tty.
|
|
|
|
+ *
|
|
|
|
+ * But FreeBSD uses `ttyv[0-3]' as console name.
|
|
|
|
+ *
|
|
|
|
+ * So this patch is to translate `ttyv?' string to `console'
|
|
|
|
+ */
|
|
|
|
+ if (strstr (utmplist[i]->ut_line, "ttyv") != NULL) {
|
|
|
|
+ strcpy (utmplist[i]->ut_line, "console");
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
if (idle < 0)
|
|
|
|
idle = 0;
|
|
|
|
|
|
|
|
@@ -485,6 +506,7 @@
|
1997-01-06 08:51:05 +00:00
|
|
|
|
|
|
|
UTMP **result;
|
|
|
|
int result_size = 0;
|
|
|
|
+ struct hostent *hp; u_long l;
|
|
|
|
|
|
|
|
#ifndef HAVE_GETUTENT
|
|
|
|
file = open (UTMP_FILE, O_RDONLY);
|
1997-01-06 14:09:34 +00:00
|
|
|
@@ -528,6 +550,26 @@
|
|
|
|
if (!UT (entry, ut_name)[0])
|
1997-01-06 08:51:05 +00:00
|
|
|
continue;
|
|
|
|
#endif /* sun */
|
1997-01-06 14:09:34 +00:00
|
|
|
+
|
1997-01-06 08:51:05 +00:00
|
|
|
+#ifdef __FreeBSD__
|
1997-01-06 14:09:34 +00:00
|
|
|
+ /*
|
|
|
|
+ * From src/usr.bin/login/login.c CVS log, after 2.2 source tree,
|
|
|
|
+ * login.c write numerical address to ut_host.
|
|
|
|
+ * (1.12 comment of login.c)
|
|
|
|
+ *
|
|
|
|
+ * So this patch is to translate numerical address to hostname.
|
|
|
|
+ */
|
1997-01-06 08:51:05 +00:00
|
|
|
+ if (UT(entry, ut_host)[0]) {
|
|
|
|
+ if (isdigit(UT(entry, ut_host)[0]) &&
|
|
|
|
+ (long)(l = inet_addr(UT(entry, ut_host))) != -1 &&
|
|
|
|
+ (hp = gethostbyaddr((char *)&l, sizeof(l), AF_INET))) {
|
|
|
|
+ if (hp->h_name) {
|
|
|
|
+ strncpy(UT(entry, ut_host), hp->h_name, UT_HOSTSIZE);
|
|
|
|
+ UT(entry, ut_host)[UT_HOSTSIZE - 1] = '\0';
|
|
|
|
+ } /* valid hostname */
|
|
|
|
+ } /* IP addr */
|
|
|
|
+ } /* UTMP */
|
|
|
|
+#endif
|
1997-01-06 14:09:34 +00:00
|
|
|
|
1997-01-06 08:51:05 +00:00
|
|
|
for (i = 0; result[i]; i++)
|
|
|
|
{
|