Re: Problem with ftp proxying

From: Mike Wohlgemuth <mjw@dont-contact.us>
Date: Fri, 23 Jan 1998 11:26:04 -0500

>We have users who want to retrieve software via non-anonymous FTP.
>He can login FTP server with a password, but cannot retrieve any
>files expect under his home directroy.
>
> ...
>
>I mean that ftpget program recognizes user's home directory as own
>root everytime.
>
>E.g., If I try by way of a test, to acccess
>
> <A HREF=ftp://username:password@ftpserver/somewhere/foo.tar.gz>
>
>I get
> The following FTP error was encountered:
>
> somewhere/foo.tar.gz: Not a directory.
>
> This means that:
>
> The given URL does not exist, or is not readable.

I have just run into this problem myself.

What follows is a diff for ftpget 1.1.20. It fixes this problem, as
well as one where Squid drops the password from the BASE tag it returns
to the browser. Dropping the password doesn't cause problems for
Netscape, but it confuses Internet Explorer.

There may well be a better way of fixing this second problem. I just
started looking at the source yesterday, so I might have missed a
glaringly obvious fix.

Mike

383a384,385
> const char *const null_string = "";
>
1657c1659
< sprintf(cbuf, "RETR %s", r->path);

---
>     sprintf(cbuf, "RETR /%s", r->path);
2133a2136,2137
>     static char tmpbuf[BIGBUFSIZ];
> 
2143a2148
> 
2145c2150,2166
<       fprintf(wfp, "<BASE HREF=\"%s\">\n", r->url_escaped);
---
> 
> /*
>  *        fprintf(wfp, "<BASE HREF=\"%s\">\n", r->url_escaped);
>  */
> 
>     sprintf(tmpbuf, "%i", r->port);
> 
>     fprintf(wfp, "<BASE HREF=\"ftp://%s%s%s%s%s%s%s/%s/\">\n",
>             r->user,
>             *r->pass ? ":" : null_string,
>             r->pass,
>             *r->user ? "@" : null_string,
>             r->host,
>             r->port != 21 ? ":" : null_string,
>             r->port != 21 ? tmpbuf : null_string,
>             r->path);
>
Received on Fri Jan 23 1998 - 08:34:33 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:38:29 MST