You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2009/08/20 20:13:35 UTC

svn commit: r806283 - in /httpd/mod_ftp/trunk: CHANGES-FTP modules/ftp/ftp_commands.c

Author: wrowe
Date: Thu Aug 20 18:13:34 2009
New Revision: 806283

URL: http://svn.apache.org/viewvc?rev=806283&view=rev
Log:
Correct the distinctions between arg, rfile (worthless duplicity) and
r->uri, which is what we must invoked as the subreq to permit RETR dir/file


Modified:
    httpd/mod_ftp/trunk/CHANGES-FTP
    httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c

Modified: httpd/mod_ftp/trunk/CHANGES-FTP
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/CHANGES-FTP?rev=806283&r1=806282&r2=806283&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/CHANGES-FTP (original)
+++ httpd/mod_ftp/trunk/CHANGES-FTP Thu Aug 20 18:13:34 2009
@@ -1,5 +1,7 @@
 Changes in 0.9.5:
 
+  *) Correct RETR path handling to permit RETR path/foo [William Rowe]
+
   *) Escape output of user supplied text in control channel responses.
      Adds an ftp_escape_control_text() API for extention module authors.
      [William Rowe]

Modified: httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c
URL: http://svn.apache.org/viewvc/httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c?rev=806283&r1=806282&r2=806283&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c Thu Aug 20 18:13:34 2009
@@ -2120,12 +2120,9 @@
     request_rec *rr;
     conn_rec *c = r->connection;
     conn_rec *cdata;
-    const char *rfile;
     ap_filter_t *f, *rinput, *routput, *rinput_proto, *routput_proto;
     int res;
 
-    rfile = arg;
-
     /* Put a note in the env table for logging */
     /*
      * This envar determines whether or not the command being
@@ -2136,25 +2133,25 @@
      */
     apr_table_setn(r->subprocess_env, "do_transfer_log", "1");
 
-    if ((res = ftp_set_uri(r, rfile))) {
+    if ((res = ftp_set_uri(r, arg))) {
         return res;
     }
 
     /* If anything fails in the subrequest, simply return permission denied */
-    rr = ap_sub_req_method_uri(r->method, rfile, r, NULL);
+    rr = ap_sub_req_method_uri(r->method, r->uri, r, NULL);
     if (rr->status != HTTP_OK) {
         fc->response_notes = apr_psprintf(r->pool, FTP_MSG_PERM_DENIED,
-                                 ftp_escape_control_text(rfile, r->pool));
+                                 ftp_escape_control_text(arg, r->pool));
         ap_destroy_sub_req(rr);
         return FTP_REPLY_FILE_NOT_FOUND;
     }
     ap_destroy_sub_req(rr);
 
-    ftp_reply(fc, fc->connection->output_filters, r->pool,
-              FTP_REPLY_FILE_STATUS_OK, 0,
+    ftp_reply(fc, c->output_filters, r->pool, FTP_REPLY_FILE_STATUS_OK, 0,
               apr_pstrcat(r->pool, "Opening ",
                           (fc->type == TYPE_A) ? "ASCII" : "BINARY",
-                          " mode data connection for ", arg, NULL));
+                          " mode data connection for ", 
+                          ftp_escape_control_text(arg, r->pool), NULL));
 
     if (!(cdata = ftp_open_dataconn(r, 1))) {
         return FTP_REPLY_CANNOT_OPEN_DATACONN;
@@ -2189,14 +2186,14 @@
         fc->filter_mask += FTP_NEED_BYTERANGE;
     }
 
-    rr = ap_sub_req_method_uri("GET", rfile, r, NULL);
+    rr = ap_sub_req_method_uri("GET", r->uri, r, NULL);
     if (rr->status != HTTP_OK) {
         /*
          * Should never get here since we have already run this subrequest,
          * but better safe than sorry
          */
         fc->response_notes = apr_psprintf(r->pool, FTP_MSG_PERM_DENIED,
-                                 ftp_escape_control_text(rfile, r->pool));
+                                 ftp_escape_control_text(arg, r->pool));
         res = FTP_REPLY_FILE_NOT_FOUND;
         goto clean_up;
     }