Bug 46798 - mod_proxy_ftp can't retrieve files with wildcards in their names
Summary: mod_proxy_ftp can't retrieve files with wildcards in their names
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy (show other bugs)
Version: 2.2.11
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2009-03-04 05:56 UTC by Dan Poirier
Modified: 2009-03-26 06:32 UTC (History)
0 users



Attachments
Patch to implement the proposed change (11.91 KB, patch)
2009-03-04 05:56 UTC, Dan Poirier
Details | Diff
Updated patch for trunk (11.31 KB, patch)
2009-03-24 12:32 UTC, Dan Poirier
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Poirier 2009-03-04 05:56:21 UTC
Created attachment 23328 [details]
Patch to implement the proposed change

We need to be able to serve files whose names contain wildcards using
mod_proxy_ftp.  Right now, mod_proxy_ftp provides a file listing when
it sees wildcards in the filename requested, which is reasonable for
interactive browsing of an FTP site.  In this case, though, we need to
actually get files with those names, and we don't need the browsing
function (we already know the filenames).  Unfortunately, we don't
control the filenames, or we'd just use filenames without wildcards
and avoid all this.

The solution I'm thinking about is to add a directive to allow
selectively disabling the behavior of doing file listings when
wildcards are seen in the requested filename.  E.g.:

  The ProxyFtpListOnWildcard directive controls whether wildcard
  characters ("*?[{~") in requested filenames cause mod_proxy_ftp to
  return a listing of files instead of downloading a file.  By default
  (value on), they do.  Set to "off" to allow downloading files even
  if they have wildcard characters in their names.  (directory
  context)

I'd appreciate comments on this approach, and my proposed
implementation (patch against trunk is attached).  

Also, in testing that change, I found that mod_proxy_ftp escapes
wildcards in filenames using backslashes when sending them to the FTP
server, which none of the FTP servers I was testing with understood.
As I recall, I tried vsftpd, proftpd, and Apache FTP server.
To continue with my testing, I added another directive to turn that
behavior off, but I'd like to better understand why that behavior is
there, since it appears to assume a behavior that my FTP servers don't
have, and doesn't seem to be mentioned in RFC 959.  

From what I know so far, I think this escaping should just be removed.
I don't think this escaping could ever have been used
before, since any paths with globbing characters in them would have
triggered a file listing, which doesn't do the escaping.  So until now,
Apache would never have tried to retrieve any file with globbing
characters in its name. 

But for now, the attached patch has a directive to control this and
leaves the current behavior as the default.
Comment 1 Dan Poirier 2009-03-24 12:32:01 UTC
Created attachment 23412 [details]
Updated patch for trunk

Here's an updated patch, that adds support for files with
wildcards in their names while limiting the changes to
mod_proxy_ftp.c and mod_proxy_ftp.xml.

Applies to trunk, builds without warnings, passes my tests
for the new function.
Comment 2 Eric Covener 2009-03-26 06:32:06 UTC
committed in 758626 with tiny change to add default=on info to ProxyFtpListOnWildcard