From nobody@FreeBSD.org  Thu Mar 16 11:04:39 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 60C4D16A401
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Mar 2006 11:04:39 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4B12243D90
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Mar 2006 11:04:33 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k2GB4XE6036699
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 16 Mar 2006 11:04:33 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k2GB4Xqg036698;
	Thu, 16 Mar 2006 11:04:33 GMT
	(envelope-from nobody)
Message-Id: <200603161104.k2GB4Xqg036698@www.freebsd.org>
Date: Thu, 16 Mar 2006 11:04:33 GMT
From: Volker Stolz <vs@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [PATH] Make telnet accept host:port on the command line
X-Send-Pr-Version: www-2.3

>Number:         94548
>Category:       bin
>Synopsis:       [PATH] Make telnet accept host:port on the command line
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 16 15:09:41 GMT 2006
>Closed-Date:    Thu Mar 16 15:21:49 GMT 2006
>Last-Modified:  Thu Mar 16 15:21:49 GMT 2006
>Originator:     Volker Stolz
>Release:        6.1
>Organization:
FreeBSD.org
>Environment:
FreeBSD menelaos.informatik.rwth-aachen.de 6.1-BETA3 FreeBSD 6.1-BETA3 #1: Mon Mar 13 10:45:03 CET 2006     root@menelaos.informatik.rwth-aachen.de:/usr/obj/usr/src/sys/MENELAOS  i386
>Description:
This patch makes telnet accept 'host:port' from the command line and handles error cases gracefully.

In case the formatting of the patch gets eaten, it is also available from
http://i2.foldr.org/~stolz/FreeBSD/telnet.patch
>How-To-Repeat:

>Fix:
--- /usr/src/contrib/telnet/telnet/commands.c   Mon Feb 28 13:46:52 2005
+++ src/telnet/telnet/commands.c        Thu Mar 16 10:52:06 2006
@@ -2291,8 +2291,26 @@
            hostname++;
            srcroute = 1;
        }
-    } else
-        hostname = hostp;
+    } else {
+      char *colon;
+      /* Did we get host:port? */
+      colon = strrchr(hostp,':');
+      /* Maybe, make sure it's not an IPv6 address */
+      if ((colon != NULL) && (colon == strchr(hostp,':'))) {
+       if (portp) {
+         fprintf(stderr, "Destination port already set.\n");
+         goto fail;
+       } else { /* Patch \0 into argument */
+         *colon = '\0';
+         /* Check if colon was last char in argument: */
+         colon++;
+         if ((*colon) != '\0')
+           portp = colon;
+       }
+      }
+      hostname = hostp;
+
+    }
     if (!portp) {
       telnetport = 1;
       portp = strdup("telnet");

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: vs 
State-Changed-When: Thu Mar 16 15:21:27 UTC 2006 
State-Changed-Why:  
Duplicate because of mailer trouble 

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