NetBSD Problem Report #51043

From www@NetBSD.org  Mon Apr  4 20:09:37 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 18F667A3D5
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  4 Apr 2016 20:09:37 +0000 (UTC)
Message-Id: <20160404200635.9FA837AA98@mollari.NetBSD.org>
Date: Mon,  4 Apr 2016 20:06:35 +0000 (UTC)
From: yorickhardy@gmail.com
Reply-To: yorickhardy@gmail.com
To: gnats-bugs@NetBSD.org
Subject: ftp(1) should use the port number for CONNECT
X-Send-Pr-Version: www-1.0

>Number:         51043
>Category:       bin
>Synopsis:       ftp(1) should use the port number for CONNECT
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 04 20:10:00 +0000 2016
>Closed-Date:    Tue Apr 05 06:08:17 +0000 2016
>Last-Modified:  Sat Jul 04 09:50:01 +0000 2020
>Originator:     Yorick Hardy
>Release:        NetBSD-7
>Organization:
>Environment:
NetBSD HOME 7.0_STABLE NetBSD 7.0_STABLE (YORICK.amd64) #1: Fri Mar  4 14:03:27 SAST 2016  root@HOME:/root/build.amd64.local7/obj/sys/arch/amd64/compile/YORICK.amd64 amd64
>Description:
RFC 2817 section 5.3:

5.2 Requesting a Tunnel with CONNECT

   A CONNECT method requests that a proxy establish a tunnel connection
   on its behalf. The Request-URI portion of the Request-Line is always
   an 'authority' as defined by URI Generic Syntax [2], which is to say
   the host name and port number destination of the requested connection
   separated by a colon:

      CONNECT server.example.com:80 HTTP/1.1
      Host: server.example.com:80

Using the port name does not seem to work with, for example, privoxy.
>How-To-Repeat:

>Fix:
Index: usr.bin/ftp/fetch.c
==================================================================
--- usr.bin/ftp/fetch.c
+++ usr.bin/ftp/fetch.c
@@ -845,12 +845,12 @@
 			    (int)(p - ui->host), ui->host);
 		h = hname;
 	} else
 		h = ui->host;

-	fetch_printf(fin, "CONNECT %s:%s HTTP/1.1\r\n", h, ui->port);
-	fetch_printf(fin, "Host: %s:%s\r\n", h, ui->port);
+	fetch_printf(fin, "CONNECT %s:%d HTTP/1.1\r\n", h, ui->portnum);
+	fetch_printf(fin, "Host: %s:%d\r\n", h, ui->portnum);
 }
 #endif

 #define C_OK 0
 #define C_CLEANUP 1

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51043 CVS commit: src/usr.bin/ftp
Date: Mon, 4 Apr 2016 19:59:41 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Mon Apr  4 23:59:41 UTC 2016

 Modified Files:
 	src/usr.bin/ftp: fetch.c

 Log Message:
 PR/51043: Yorick Hardy: ftp(1) should use the port number for CONNECT


 To generate a diff of this commit:
 cvs rdiff -u -r1.222 -r1.223 src/usr.bin/ftp/fetch.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Tue, 05 Apr 2016 06:08:17 +0000
State-Changed-Why:
christos fixed it, thanks!


From: "Soren Jacobsen" <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51043 CVS commit: [netbsd-7] src/usr.bin/ftp
Date: Fri, 29 Apr 2016 19:03:44 +0000

 Module Name:	src
 Committed By:	snj
 Date:		Fri Apr 29 19:03:44 UTC 2016

 Modified Files:
 	src/usr.bin/ftp [netbsd-7]: fetch.c

 Log Message:
 Pull up following revision(s) (requested by nonaka in ticket #1153):
 	usr.bin/ftp/fetch.c: revision 1.223
 PR/51043: Yorick Hardy: ftp(1) should use the port number for CONNECT


 To generate a diff of this commit:
 cvs rdiff -u -r1.205.4.3 -r1.205.4.4 src/usr.bin/ftp/fetch.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Luke Mewburn" <lukem@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/51043 CVS commit: othersrc/usr.bin/tnftp/src
Date: Sat, 4 Jul 2020 09:48:28 +0000

 Module Name:	othersrc
 Committed By:	lukem
 Date:		Sat Jul  4 09:48:28 UTC 2020

 Update of /cvsroot/othersrc/usr.bin/tnftp/src
 In directory ivanova.netbsd.org:/tmp/cvs-serv25717

 Log Message:
 Import NetBSD-ftp 20200608

 Notable changes since NetBSD-ftp 20151003:
 * Avoid crashies by exit if lostpeer due to a signal
   (e.g., remote server disconnection).
 * Issue PWD commands to the server only when we actually
   need the results, not speculatively, just in case we might.
   Works around broken servers, and is quicker too.
 * Fix error reporting when handling TLS connections.
 * Use "anonymous" instead of the local username for anonymous ftp.
   Avoids unnecesary information leak.
 * Correct format of IPv6 endpoint reporting.
 * Refactoring and build fixes.
 * Support using CONNECT for https:// via proxy. PR/50438, PR/51043.
 * Fix downloads of local files using file:// URLs
 * Use the first name we requested the http/https URL for, not any name
   we ended up with after random redirects.

 Status:

 Vendor Tag:	NetBSD
 Release Tags:	NetBSD-20200608

 U othersrc/usr.bin/tnftp/src/ruserpass.c
 C othersrc/usr.bin/tnftp/src/ftp.1
 C othersrc/usr.bin/tnftp/src/fetch.c
 C othersrc/usr.bin/tnftp/src/util.c
 C othersrc/usr.bin/tnftp/src/ftp.c
 U othersrc/usr.bin/tnftp/src/cmdtab.c
 C othersrc/usr.bin/tnftp/src/ssl.h
 C othersrc/usr.bin/tnftp/src/main.c
 C othersrc/usr.bin/tnftp/src/ssl.c
 C othersrc/usr.bin/tnftp/src/extern.h
 U othersrc/usr.bin/tnftp/src/progressbar.h
 C othersrc/usr.bin/tnftp/src/ftp_var.h
 C othersrc/usr.bin/tnftp/src/version.h
 C othersrc/usr.bin/tnftp/src/progressbar.c
 C othersrc/usr.bin/tnftp/src/Makefile
 C othersrc/usr.bin/tnftp/src/complete.c
 C othersrc/usr.bin/tnftp/src/domacro.c
 C othersrc/usr.bin/tnftp/src/cmds.c

 15 conflicts created by this import.
 Use the following command to help the merge:

 	cvs checkout -jNetBSD:yesterday -jNetBSD othersrc/usr.bin/tnftp/src

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.