Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Mar 2003 13:46:55 +0100 (CET)
From:      Volker Stolz <stolz@i2.informatik.rwth-aachen.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/49983: [patch] Fix bug & improve telnet status ouput on unix domain sockets
Message-ID:  <200303131246.h2DCktHb086268@menelaos.informatik.rwth-aachen.de>

next in thread | raw e-mail | index | archive | help

>Number:         49983
>Category:       bin
>Synopsis:       [patch] Fix bug & improve telnet status ouput on unix domain sockets
>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:   Thu Mar 13 04:50:14 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Volker Stolz
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
Lehrstuhl für Informatik II
>Environment:
System: FreeBSD menelaos.informatik.rwth-aachen.de 4.7-STABLE FreeBSD 4.7-STABLE #2: Fri Feb 7 12:48:00 CET 2003 root@menelaos.informatik.rwth-aachen.de:/usr/src/sys/compile/MENELAOS i386


>Description:
Telnet prints incorrect status output for unix domain socket and 
leaves command mode after the first command because the connection
counter isn't increased correctly.

menelaos [13:33:03]> telnet -u /tmp/hws 
Trying /tmp/hws...
No connection.
Escape character is '^]'.
^]
telnet> status
No connection.
Escape character is '^]'.
menelaos [13:41:27]>

The attached patch correctly counts the connection and improves
telnet status output:

Trying /tmp/hws...
Connected to /tmp/hws.
Escape character is '^]'.
^]
telnet> status
Connected to /tmp/hws.
Operating in obsolete linemode
Local character echo
Escape character is '^]'.
 (still connected)

>How-To-Repeat:
Cf. description, connect to unix domain socket, query
connection status.
>Fix:
- set 'hostname' to unix domain socket path
- increase connection counter

--- telnet begins here ---
diff -urN telnet.orig/commands.c telnet/commands.c
--- telnet.orig/commands.c	Sat Nov 30 06:35:13 2002
+++ telnet/commands.c	Thu Mar 13 13:17:31 2003
@@ -2005,6 +2005,7 @@
 		    hostp);
 		goto fail;
 	}
+	hostname = hostp;
 	memset(&su, 0, sizeof su);
 	su.sun_family = AF_UNIX;
 	strncpy(su.sun_path, hostp, sizeof su.sun_path);
@@ -2207,6 +2208,7 @@
         freeaddrinfo(src_res0);
     cmdrc(hostp, hostname);
  af_unix:    
+    connected++;
     if (autologin && user == NULL) {
 	struct passwd *pw;
 
--- telnet ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303131246.h2DCktHb086268>