From owner-freebsd-bugs Wed Jan 16 17:20:22 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 26FD237B41A for ; Wed, 16 Jan 2002 17:20:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0H1K1S79431; Wed, 16 Jan 2002 17:20:01 -0800 (PST) (envelope-from gnats) Received: from raven.robbins.dropbear.id.au (088.a.010.mel.iprimus.net.au [210.50.200.88]) by hub.freebsd.org (Postfix) with ESMTP id C84CF37B400 for ; Wed, 16 Jan 2002 17:14:07 -0800 (PST) Received: (from tim@localhost) by raven.robbins.dropbear.id.au (8.11.6/8.11.6) id g0H17So50756; Thu, 17 Jan 2002 12:07:28 +1100 (EST) (envelope-from tim) Message-Id: <200201170107.g0H17So50756@raven.robbins.dropbear.id.au> Date: Thu, 17 Jan 2002 12:07:28 +1100 (EST) From: "Tim J. Robbins" Reply-To: "Tim J. Robbins" To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/33971: finger could check if T/TCP is disabled and imply -T Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 33971 >Category: bin >Synopsis: finger could check if T/TCP is disabled and imply -T >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Jan 16 17:20:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Tim J. Robbins >Release: FreeBSD 4.5-RC i386 >Organization: >Environment: System: FreeBSD raven.robbins.dropbear.id.au 4.5-RC FreeBSD 4.5-RC #3: Sat Jan 12 17:11:56 EST 2002 tim@raven.robbins.dropbear.id.au:/usr/obj/usr/src/sys/RAVEN i386 >Description: /usr/bin/finger supports T/TCP, and this support may be disabled with the -T option. The way the T/TCP support is implemented in `finger' causes strange error messages ("read: Connection refused") and makes it take longer than usual to give these errors on what the source code terms "broken hosts". >How-To-Repeat: >Fix: Use net.inet.tcp.rfc1644 sysctl to determine whether T/TCP has been enabled. Imply the -T option if it has. --- net.c.old Thu Jan 17 11:50:17 2002 +++ net.c Thu Jan 17 11:57:23 2002 @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -88,6 +89,8 @@ char *alist[1], *host; struct iovec iov[3]; struct msghdr msg; + int ttcp; + size_t ttcp_len; if (!(host = rindex(name, '@'))) return; @@ -140,8 +143,16 @@ iov[msg.msg_iovlen].iov_base = "\r\n"; iov[msg.msg_iovlen++].iov_len = 2; + /* Determine whether we can use T/TCP (RFC 1644) */ + ttcp_len = sizeof (ttcp); + if (sysctlbyname("net.inet.tcp.rfc1644", &ttcp, &ttcp_len, NULL, 0)) + ttcp = 0; + /* -T disables T/TCP: compatibility option to finger broken hosts */ - if (Tflag && connect(s, (struct sockaddr *)&sin, sizeof (sin))) { + if (Tflag) + ttcp = 0; + + if (!ttcp && connect(s, (struct sockaddr *)&sin, sizeof (sin))) { perror("finger: connect"); return; } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message