From owner-freebsd-bugs@FreeBSD.ORG Mon Sep 22 08:00:31 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9FC8D16A4B3 for ; Mon, 22 Sep 2003 08:00:31 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E106143FFB for ; Mon, 22 Sep 2003 08:00:29 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h8MF0TFY052262 for ; Mon, 22 Sep 2003 08:00:29 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h8MF0TPe052261; Mon, 22 Sep 2003 08:00:29 -0700 (PDT) (envelope-from gnats) Resent-Date: Mon, 22 Sep 2003 08:00:29 -0700 (PDT) Resent-Message-Id: <200309221500.h8MF0TPe052261@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Kirk Strauser Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E9BCE16A4B3 for ; Mon, 22 Sep 2003 07:50:13 -0700 (PDT) Received: from kanga.honeypot.net (kanga.honeypot.net [208.162.254.122]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7D7B344001 for ; Mon, 22 Sep 2003 07:50:09 -0700 (PDT) (envelope-from kirk@kanga.honeypot.net) Received: from kanga.honeypot.net (localhost [127.0.0.1]) by kanga.honeypot.net (8.12.9/8.12.9) with ESMTP id h8MEo1NS056130 for ; Mon, 22 Sep 2003 09:50:05 -0500 (CDT) (envelope-from kirk@kanga.honeypot.net) Received: (from root@localhost) by kanga.honeypot.net (8.12.9/8.12.9/Submit) id h8MEo197056129; Mon, 22 Sep 2003 09:50:01 -0500 (CDT) (envelope-from kirk) Message-Id: <200309221450.h8MEo197056129@kanga.honeypot.net> Date: Mon, 22 Sep 2003 09:50:01 -0500 (CDT) From: Kirk Strauser To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/57089: "w" does not honor the -n option X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Kirk Strauser List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Sep 2003 15:00:31 -0000 >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 >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: