httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject svn commit: r606030 - in /httpd/mod_ftp/trunk: CHANGES-FTP modules/ftp/ftp_commands.c
Date Thu, 20 Dec 2007 21:21:47 GMT
Author: nikke
Date: Thu Dec 20 13:21:46 2007
New Revision: 606030

URL: http://svn.apache.org/viewvc?rev=606030&view=rev
Log:
Fix the REST command to accept large file sizes allowing restart of transfers
larger than 2GB on largefile enabled systems.

NOTE: Only tested with httpd 2.2.6.


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=606030&r1=606029&r2=606030&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/CHANGES-FTP (original)
+++ httpd/mod_ftp/trunk/CHANGES-FTP Thu Dec 20 13:21:46 2007
@@ -1,5 +1,9 @@
 Changes in 0.9.0:  [post submission, prior to first release]
 
+  *) Fix the REST command to accept large file sizes allowing
+     restart of transfers larger than 2GB on largefile enabled systems.
+     [Niklas Edmundsson]
+
   *) configure.apxs; using Makefile.apxs/modules.mk.apxs, now rely
      entirely on apxs plus the httpd/build schema for much simplified
      out-of-tree builds, with fewer make-related side effects.

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=606030&r1=606029&r2=606030&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c Thu Dec 20 13:21:46 2007
@@ -2022,33 +2022,18 @@
 static int ftp_cmd_rest(request_rec *r, const char *arg)
 {
     ftp_connection *fc = ftp_get_module_config(r->request_config);
-    conn_rec *c = r->connection;
     char *endp;
+    apr_status_t rv;
 
-    /* XXX: shortcoming, cannot restart > ~2GB.  Must be solved in 
-     * APR, or we need to use 
-     *  int len;
-     *  res = sscanf(arg,"%"APR_OFF_T_FMT"%n", &fc->restart_point, &len);
-     *  end = arg + len;
-     * and test that res == 2. Dunno how portable or safe this gross
-     * hack would be in real life.
-     */
-    fc->restart_point = strtol(arg, &endp, 10);
-    if (((*arg == '\0') || (*endp != '\0')) || fc->restart_point < 0) {
-        fc->response_notes = apr_pstrdup(r->pool, "REST requires a an "
-                                         "integer value greater than zero");
+    rv = apr_strtoff(&(fc->restart_point), arg, &endp, 10);
+    if (rv != APR_SUCCESS || ((*arg == '\0') || (*endp != '\0')) || 
+            fc->restart_point < 0) 
+    {
+        fc->response_notes = apr_pstrdup(r->pool, "REST requires a "
+                                         "non-negative integer value");
         return FTP_REPLY_SYNTAX_ERROR;
     }
 
-    /* Check overflow condition */
-    if (fc->restart_point == LONG_MAX) {
-        ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, 
-                     c->base_server,
-                     "Client attempted an invalid restart point");
-        /* XXX: possible overflow, continue gracefully?  Many other FTP
-         * client do not check overflow conditions in the REST command.
-         */
-    }
     fc->response_notes = apr_psprintf(r->pool, "Restarting at %" APR_OFF_T_FMT
                                       ". Send STORE or RETRIEVE to initiate "
                                       "transfer.", fc->restart_point);



Mime
View raw message