Date: Mon, 22 Sep 2003 13:51:42 +0200 From: Jilles Tjoelker <jilles@stack.nl> To: freebsd-stable@freebsd.org Subject: Re: IPv6 and logon information Message-ID: <20030922115142.GD73519@stack.nl> In-Reply-To: <20030922100855.GH79498@e-Gitt.NET> References: <20030922100855.GH79498@e-Gitt.NET>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Sep 22, 2003 at 12:08:56PM +0200, Oliver Brandmueller wrote: > I have a question regarding the login information. > There are several ways to see this like w, who, finger and last. With > 'last' you usually see the hostname, if it fits, or the IP address, > which obviously always fits with IPv4. > That way you can check logins from different places by viewing > last, which is one piece of assuring you're the only one using your > account. > The problem: With IPv6 I don't have a way to view this information > (well, except for a running connection by viewing the sockets...). > Any ideas, hints? You can increase UT_HOSTSIZE in utmp.h. At Stack we use 64 instead of 16. However, after changing it, you must rebuild world and all ports that use utmp or wtmp, like screen, konsole, and gnome-terminal. After installworld you have to reboot to ensure the new init is used (otherwise your wtmp will be corrupted). Then truncate /var/log/wtmp. /var/run/utmp is truncated at each boot. /var/log/lastlog should be truncated as well, but it is not as sensitive as /var/log/wtmp. (wtmp is totally unusable if there is one entry of wrong size in the middle) This is quite a lot of work and you may forget some program and get utmp/wtmp corruption. If you don't want the output of w to wrap, use the following patch, a backport of a 5.x feature. You won't be able to see full IPv6 addresses in w then, but you can see them in who. You can also see full IPv6 addresses in last and lastlogin and their output will likely be wrapped. finger works as well. --- /usr/src/usr.bin/w/w.c Fri Aug 15 23:58:14 2003 +++ /usr/src/usr.bin/w/w.c Fri Sep 19 17:29:15 2003 @@ -120,6 +120,9 @@ #define debugproc(p) *((struct kinfo_proc **)&(p)->kp_eproc.e_spare[0]) +/* W_DISPHOSTSIZE should not be greater than UT_HOSTSIZE */ +#define W_DISPHOSTSIZE 16 + static void pr_header __P((time_t *, int)); static struct stat *ttystat __P((char *, int)); static void usage __P((int)); @@ -275,12 +278,12 @@ #define HEADER_FROM "FROM" #define HEADER_LOGIN_IDLE "LOGIN@ IDLE " #define HEADER_WHAT "WHAT\n" -#define WUSED (UT_NAMESIZE + UT_LINESIZE + UT_HOSTSIZE + \ +#define WUSED (UT_NAMESIZE + UT_LINESIZE + W_DISPHOSTSIZE + \ sizeof(HEADER_LOGIN_IDLE) + 3) /* header width incl. spaces */ (void)printf("%-*.*s %-*.*s %-*.*s %s", UT_NAMESIZE, UT_NAMESIZE, HEADER_USER, UT_LINESIZE, UT_LINESIZE, HEADER_TTY, - UT_HOSTSIZE, UT_HOSTSIZE, HEADER_FROM, + W_DISPHOSTSIZE, W_DISPHOSTSIZE, HEADER_FROM, HEADER_LOGIN_IDLE HEADER_WHAT); } @@ -417,10 +420,12 @@ strncmp(ep->utmp.ut_line, "tty", 3) && strncmp(ep->utmp.ut_line, "cua", 3) ? ep->utmp.ut_line : ep->utmp.ut_line + 3, - UT_HOSTSIZE, UT_HOSTSIZE, *p ? p : "-"); + W_DISPHOSTSIZE, W_DISPHOSTSIZE, *p ? p : "-"); pr_attime(&ep->utmp.ut_time, &now); longidle = pr_idle(ep->idle); (void)printf("%.*s\n", argwidth - longidle, ep->args); -- Jilles Tjoelker
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030922115142.GD73519>