Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 5442 invoked from network); 20 Dec 2007 21:37:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Dec 2007 21:37:46 -0000 Received: (qmail 91236 invoked by uid 500); 20 Dec 2007 21:37:35 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 91028 invoked by uid 500); 20 Dec 2007 21:37:35 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Delivered-To: moderator for cvs@httpd.apache.org Received: (qmail 65272 invoked by uid 99); 20 Dec 2007 21:21:58 -0000 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r606030 - in /httpd/mod_ftp/trunk: CHANGES-FTP modules/ftp/ftp_commands.c Date: Thu, 20 Dec 2007 21:21:47 -0000 To: cvs@httpd.apache.org From: nikke@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071220212148.A824B1A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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);