From sec@yoda.fwe.pi.musin.de  Wed Dec 13 09:23:34 2000
Return-Path: <sec@yoda.fwe.pi.musin.de>
Received: from yoda.fwe.pi.musin.de (yoda.fwe.pi.musin.de [194.246.250.18])
	by hub.freebsd.org (Postfix) with ESMTP id 2378B37B400
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 13 Dec 2000 09:23:33 -0800 (PST)
Received: (from root@localhost)
	by yoda.fwe.pi.musin.de (8.11.1/8.11.1) id eBDHNsH20581;
	Wed, 13 Dec 2000 18:23:55 +0100 (CET)
	(envelope-from sec)
Message-Id: <200012131723.eBDHNsH20581@yoda.fwe.pi.musin.de>
Date: Wed, 13 Dec 2000 18:23:55 +0100 (CET)
From: root@yoda.fwe.pi.musin.de
Sender: sec@yoda.fwe.pi.musin.de
Reply-To: root@yoda.fwe.pi.musin.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: Patch for bin/9529 (ftp completion cant handle spaces)
X-Send-Pr-Version: 3.2

>Number:         23526
>Category:       bin
>Synopsis:       Patch for bin/9529 (ftp completion cant handle spaces)
>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:   Wed Dec 13 09:30:00 PST 2000
>Closed-Date:    Sun Nov 18 09:49:21 PST 2001
>Last-Modified:  Sun Nov 18 09:50:00 PST 2001
>Originator:     Charlie &
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
>Environment:

	

>Description:

As described in bin/9529 /usr/bin/ftp doesn't handle spaces in
filenames.

This PR is quite old and nobody did anything. So i tried to improve the
situation by submitting a patch to fix this.

	

>How-To-Repeat:

	

>Fix:
cvs diff: Diffing .
Index: complete.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/ftp/complete.c,v
retrieving revision 1.5
diff -b -u -r1.5 complete.c
--- complete.c	1999/08/28 01:01:30	1.5
+++ complete.c	2000/12/13 17:21:11
@@ -82,7 +82,7 @@
 	int list;
 	StringList *words;
 {
-	char insertstr[MAXPATHLEN];
+	char insertstr[2*MAXPATHLEN];
 	char *lastmatch;
 	int i, j;
 	size_t matchlen, wordlen;
@@ -92,7 +92,12 @@
 		return (CC_ERROR);	/* no choices available */
 
 	if (words->sl_cur == 1) {	/* only once choice available */
-		(void)strcpy(insertstr, words->sl_str[0]);
+		for (i=0,j=0;i<strlen(words->sl_str[0]);i++,j++){
+			if (isspace(words->sl_str[0][i]))
+				insertstr[j++]='\\';
+			insertstr[j]=words->sl_str[0][i];
+		};
+		insertstr[j]=0;
 		if (el_insertstr(el, insertstr + wordlen) == -1)
 			return (CC_ERROR);
 		else

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: iedowse 
State-Changed-When: Sun Nov 18 09:49:21 PST 2001 
State-Changed-Why:  

Committed (with minor adjustments), thanks! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=23526 
>Unformatted:
