Date: Mon, 22 Sep 2003 09:50:01 -0500 (CDT) From: Kirk Strauser <kirk@strauser.com> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/57089: "w" does not honor the -n option Message-ID: <200309221450.h8MEo197056129@kanga.honeypot.net> Resent-Message-ID: <200309221500.h8MF0TPe052261@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 57089 >Category: bin >Synopsis: "w" does not honor the -n option >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Sep 22 08:00:28 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Kirk Strauser <kirk@strauser.com> >Release: FreeBSD 5.1-CURRENT i386 >Organization: The Strauser Group >Environment: System: FreeBSD kanga.honeypot.net 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Fri Sep 19 14:51:41 CDT 2003 root@kanga.honeypot.net:/usr/obj/usr/src/sys/KANGA i386 >Description: w's -n option is supposed to prevent resolution of the network addresses that users are connecting from. On my 5.1-CURRENT system, built on 2003-09-19, this is not the case. w's normal output: kirk@kanga:~$ w 9:29AM up 2 days, 17:04, 2 users, load averages: 0.42, 0.61, 0.68 USER TTY FROM LOGIN@ IDLE WHAT kirk p0 pooh 9:22AM - w kirk p1 pooh 9:23AM - vim /tmp/pf.eAAIb48f With the -n option to prevent address resolution: kirk@kanga:~$ w -n 9:29AM up 2 days, 17:04, 2 users, load averages: 0.42, 0.61, 0.68 USER TTY FROM LOGIN@ IDLE WHAT kirk p0 pooh 9:22AM - w -n kirk p1 pooh 9:23AM - vim /tmp/pf.eAAIb48f >How-To-Repeat: The problem is trivially repeatable; just re-run "w -n". >Fix: I don't have a lot of experience with wtmp, but it looks like the default value for the host field is set by these lines: strncpy(host_buf, ep->utmp.ut_host, UT_HOSTSIZE); p = *host_buf ? host_buf : "-"; If the "nflag" variable (set if "-n" is specified at the command line) is true, then "p" is reset to the value of the resolved address. However, it seems that the "ep->utmp.ut_host" field is also a string containing the resolved hostname; "p" is never assigned anything that looks like a numeric IP. >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309221450.h8MEo197056129>