Subject: pkg/13344: kdelibs2 kio_ftp fixups
To: None <gnats-bugs@gnats.netbsd.org>
From: None <srp@zgi.com>
List: netbsd-bugs
Date: 06/29/2001 14:56:29
>Number:         13344
>Category:       pkg
>Synopsis:       kdelibs2 kio_ftp fixups
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 29 14:54:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Scott Presnell
>Release:        20010526
>Organization:
Self

>Environment:
System: NetBSD srp1 1.5V NetBSD 1.5V (PO) #1: Wed Jun 20 10:01:41 PDT 2001 root@srp4:/usr/syssrc/sys/arch/i386/compile/PO i386
Architecture: i386
Machine: i386
>Description:
	Two Problems:

	1) ftp reply to PASV command sscanf string too strict: I added
		a second common variant (combine into one?).

	2) ftp outgoing PORT command was in lower case.  NetBSD ip_ftp_proxy.c
	only recognizes uppercase PORT.  Changed to uppercase.

>How-To-Repeat:
	Discovered while debugging kweather kicker applet.

>Fix:


--- ftp.cc.orig	Sun Jan 28 15:44:29 2001
+++ ftp.cc	Fri Jun 29 14:45:07 2001
@@ -590,10 +590,13 @@
     return false;
   }
 
-  if (sscanf(rspbuf, "%*[^(](%d,%d,%d,%d,%d,%d)",&i[0], &i[1], &i[2], &i[3], &i[4], &i[5]) != 6)
+  if (sscanf(rspbuf, "%*d %*[^(](%d,%d,%d,%d,%d,%d)",&i[0], &i[1], &i[2], &i[3], &i[4], &i[5]) != 6)
   {
-    ::close( sDatal );
-    return false;
+    if (sscanf(rspbuf, "%*d %*[a-zA-Z ]%d,%d,%d,%d,%d,%d",&i[0], &i[1], &i[2], &i[3], &i[4], &i[5]) != 6)
+      {
+          ::close( sDatal );
+	      return false;
+      }
   }
 
   for (j=0; j<6; j++)
@@ -690,7 +693,7 @@
     // error ?
     return false;
 
-  sprintf(buf,"port %d,%d,%d,%d,%d,%d",
+  sprintf(buf,"PORT %d,%d,%d,%d,%d,%d",
           (unsigned char)sin.sa.sa_data[2],(unsigned char)sin.sa.sa_data[3],
           (unsigned char)sin.sa.sa_data[4],(unsigned char)sin.sa.sa_data[5],
           (unsigned char)sin.sa.sa_data[0],(unsigned char)sin.sa.sa_data[1]);
>Release-Note:
>Audit-Trail:
>Unformatted: