httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r794466 - in /httpd/mod_ftp/trunk: CHANGES-FTP modules/ftp/ftp_commands.c
Date Wed, 15 Jul 2009 23:55:31 GMT
Author: wrowe
Date: Wed Jul 15 23:55:31 2009
New Revision: 794466

URL: http://svn.apache.org/viewvc?rev=794466&view=rev
Log:
Add missing STRU F, MODE S and TYPE L 8 command handling, accepting 
lower case arguments.

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=794466&r1=794465&r2=794466&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/CHANGES-FTP (original)
+++ httpd/mod_ftp/trunk/CHANGES-FTP Wed Jul 15 23:55:31 2009
@@ -1,5 +1,9 @@
 Changes in 0.9.5:
 
+  *) Accept lowercase TYPE arguments.  [William Rowe]
+
+  *) Implement MODE S, STRU F and TYPE L 8 (treated as I).  [William Rowe]
+
   *) Introduce FTPOptions NoUTF8Feature; without this configured in the
      global context, mod_ftp will report UTF8 in response to FEAT, to
      indicate that non-ASCII filenames, including UTF8, are ok per RFC2640.

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=794466&r1=794465&r2=794466&view=diff
==============================================================================
--- httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c (original)
+++ httpd/mod_ftp/trunk/modules/ftp/ftp_commands.c Wed Jul 15 23:55:31 2009
@@ -929,6 +929,21 @@
     }
 }
 
+static int ftp_cmd_mode(request_rec *r, const char *arg)
+{
+    ftp_connection *fc = ftp_get_module_config(r->connection->conn_config);
+
+    if (*arg && !arg[1]) {
+        switch (toupper(*arg)) {
+        case 'S':
+            fc->response_notes = apr_pstrdup(r->pool, "Mode set to S");
+            return FTP_REPLY_COMMAND_OK;
+        }
+    }
+    fc->response_notes = apr_pstrcat(r->pool, "Mode ", arg, " not implemented", NULL);
+    return FTP_REPLY_COMMAND_NOT_IMPL_PARAM;
+}
+
 static int ftp_cmd_nlst(request_rec *r, const char *arg)
 {
     ftp_connection *fc = ftp_get_module_config(r->connection->conn_config);
@@ -2722,6 +2737,21 @@
     return status;
 }
 
+static int ftp_cmd_stru(request_rec *r, const char *arg)
+{
+    ftp_connection *fc = ftp_get_module_config(r->connection->conn_config);
+
+    if (*arg && !arg[1]) {
+        switch (toupper(*arg)) {
+        case 'F':
+            fc->response_notes = apr_pstrdup(r->pool, "Structure set to F");
+            return FTP_REPLY_COMMAND_OK;
+        }
+    }
+    fc->response_notes = apr_pstrcat(r->pool, "Structure ", arg, " not implemented",
NULL);
+    return FTP_REPLY_COMMAND_NOT_IMPL_PARAM;
+}
+
 static int ftp_cmd_syst(request_rec *r, const char *arg)
 {
     return FTP_REPLY_SYSTEM_TYPE;
@@ -2732,7 +2762,7 @@
     ftp_connection *fc = ftp_get_module_config(r->connection->conn_config);
 
     if (*arg && !arg[1]) {
-        switch (*arg) {
+        switch (toupper(*arg)) {
         case 'A':
             fc->type = TYPE_A;
             fc->response_notes = apr_pstrdup(r->pool, "Type set to A");
@@ -2741,14 +2771,17 @@
             fc->type = TYPE_I;
             fc->response_notes = apr_pstrdup(r->pool, "Type set to I.");
             return FTP_REPLY_COMMAND_OK;
-        case 'E':
-        case 'L':
-            fc->response_notes =
-                apr_pstrcat(r->pool, "Type ", arg, " not implemented", NULL);
-            return FTP_REPLY_COMMAND_NOT_IMPL_PARAM;
         }
+    } else if (!strcasecmp(arg, "L 8")) {
+        /*
+         * Treat Local 8 as indistinguishible from Image for httpd platforms
+         */
+        fc->type = TYPE_I;
+        fc->response_notes = apr_pstrdup(r->pool, "Type set to L 8.");
+        return FTP_REPLY_COMMAND_OK;
     }
-    fc->response_notes = apr_psprintf(r->pool, "Unrecognized TYPE %s", arg);
+
+    fc->response_notes = apr_pstrcat(r->pool, "Type ", arg, " not implemented", NULL);
     return FTP_REPLY_COMMAND_NOT_IMPL_PARAM;
 }
 
@@ -2930,9 +2963,9 @@
                  FTP_NEED_LOGIN | FTP_TAKE1,
                  "<sp> path-name");
 
-    ftp_hook_cmd("MODE", NULL, FTP_HOOK_LAST,
-                 FTP_NEED_LOGIN | FTP_TAKE0,
-                 "(specify transfer mode)");
+    ftp_hook_cmd("MODE", ftp_cmd_mode, FTP_HOOK_LAST,
+                 FTP_NEED_LOGIN | FTP_TAKE1,
+                 "<sp> [ S | B | C ] (specify transfer mode)");
 
     ftp_hook_cmd("NLST", ftp_cmd_nlst, FTP_HOOK_LAST,
                  FTP_NEED_LOGIN | FTP_TAKE0 | FTP_TAKE1,
@@ -3026,9 +3059,9 @@
                  FTP_NEED_LOGIN | FTP_TAKE1,
                  "<sp> file-name");
 
-    ftp_hook_cmd("STRU", NULL, FTP_HOOK_LAST,
+    ftp_hook_cmd("STRU", ftp_cmd_stru, FTP_HOOK_LAST,
                  FTP_NEED_LOGIN | FTP_TAKE1,
-                 "(specify file structure)");
+                 "<sp> [ F | R | P ] (specify file structure)");
 
     ftp_hook_cmd("SYST", ftp_cmd_syst, FTP_HOOK_LAST,
                  FTP_NEED_LOGIN | FTP_TAKE0,



Mime
View raw message