]> git.sesse.net Git - betaftpd/blobdiff - cmds.c
cmd_type(), cmd_stru(): Unknown arguments are now refused instead of being ignored...
[betaftpd] / cmds.c
diff --git a/cmds.c b/cmds.c
index a8453def6aacbc4f01c3076a0fae9611cb0382ea..ef471eea0ba9dafd8bf7ab101d6d46a0f437f640 100644 (file)
--- a/cmds.c
+++ b/cmds.c
@@ -1442,22 +1442,30 @@ int cmd_type(struct conn * const c)
 }
 
 /*
- * cmd_mode(): Handles the MODE command. We always use stream mode,
- *             so the argument is ignored.
+ * cmd_mode(): Handles the MODE command. Only stream mode is supported.
  */
 int cmd_mode(struct conn * const c)
 {
-       numeric(c, 200, "MODE ignored (always S)");
+       c->recv_buf[0] &= (255-32);     /* convert to upper case */
+       if (c->recv_buf[0] == 'S') {
+               numeric(c, 200, "Mode is STREAM.");
+       } else {
+               numeric(c, 504, "Unknown mode.");
+       }
        return 1;
 }
 
 /*
- * cmd_stru(): Handles the STRU command. We always use file mode,
- *             so the argument is ignored.
+ * cmd_stru(): Handles the STRU command. Only file mode is supported.
  */
 int cmd_stru(struct conn * const c)
 {
-       numeric(c, 200, "STRU ignored (always F)");
+       c->recv_buf[0] &= (255-32);     /* convert to upper case */
+       if (c->recv_buf[0] == 'F') {
+               numeric(c, 200, "Structure is FILE.");
+       } else {
+               numeric(c, 504, "Unknown structure.");
+       }
        return 1;
 }