From nobody@FreeBSD.org  Sun Dec  7 16:34:27 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8BF8B1065673
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  7 Dec 2008 16:34:27 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 7B0C18FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Sun,  7 Dec 2008 16:34:27 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id mB7GYQUJ016160
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 7 Dec 2008 16:34:26 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id mB7GYQtp016159;
	Sun, 7 Dec 2008 16:34:26 GMT
	(envelope-from nobody)
Message-Id: <200812071634.mB7GYQtp016159@www.freebsd.org>
Date: Sun, 7 Dec 2008 16:34:26 GMT
From: James Smallacombe <up@3.am>
To: freebsd-gnats-submit@FreeBSD.org
Subject: the "w" has a "-n" switch that does not work.
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         129483
>Category:       misc
>Synopsis:       the "w" has a "-n" switch that does not work.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 07 16:40:01 UTC 2008
>Closed-Date:    Sun Dec 07 17:36:48 UTC 2008
>Last-Modified:  Sun Dec 07 17:36:48 UTC 2008
>Originator:     James Smallacombe
>Release:        6.3-STABLE
>Organization:
PlantageNet Internet, Ltd.
>Environment:
FreeBSD mx1.pil.net 6.3-STABLE FreeBSD 6.3-STABLE #0: Thu Apr 17 09:39:00 EDT 2008     root@mx1.pil.net:/usr/src/sys/i386/compile/MX1.SMP  i386
>Description:
the "w" utility does:

w -- display who is logged in and what they are doing

Unfortunately, the utility always resolves the logged in IP, which then gets truncated by the 16 character limit thusly:

USER             TTY      FROM              LOGIN@  IDLE WHAT
up               p0       pool-173-49-94-1 10:55AM     - w

This makes it impossible to distinguish the real IP the person is coming from, not to mention that it can easily be faked or useless info.  The man page for the utility shows this option:

     -n      Do not attempt to resolve network addresses (normally w inter-
             prets addresses and attempts to display them as names).

However, the output does not change at all.  I would think that this would be an easy fix and an important one, too.
>How-To-Repeat:
Type:

"w -n"
>Fix:
I am not a programmer, but simply stopping the utility from doing reverse lookups, at least when the "-n" switch is present should be pretty easy, I'd think.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: matteo 
State-Changed-When: Dom 7 Dic 2008 17:26:58 UTC 
State-Changed-Why:  
This is not a bug in w. The FROM field comes from the utmp record for the  
login. The '-n' flag of w does the following: 
1) if the utmp record contains a name, just print the name 
2) if the utmp record contains an IP address, just print the address. 

The rationale behind 1) is that: 
a) which address should it print if there is more than one address for the name? 
b) what family should be used if there is both one or more IPv4 addresses and  
one or more IPv6 addresses? 
c) What if the utmp record contains a name but the IP address of the host from  
where the user logged in has changed between the moment he logged in and the  
moment "w -n" is executed? We are going to show a non correct information  
if we try to resolve the name to an address. 

I may agree that the man page need a better explaination of what -n does, but 
"-n" does not mean:"show me the IP addresses". 

Best regards 

http://www.freebsd.org/cgi/query-pr.cgi?pr=129483 
>Unformatted:
