aboutsummaryrefslogtreecommitdiff
path: root/networking/ftpd.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-03-18 16:02:54 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-03-18 16:02:54 +0000
commitfce4a9454c5399c2ce8ca8e87048331c6e3d98fa (patch)
tree318d88277bc0e4f9b4bc26b78d9f87566375d98f /networking/ftpd.c
parente3b840ce98a34aa998d48c3291c12af8aee9e256 (diff)
downloadbusybox-w32-fce4a9454c5399c2ce8ca8e87048331c6e3d98fa.tar.gz
busybox-w32-fce4a9454c5399c2ce8ca8e87048331c6e3d98fa.tar.bz2
busybox-w32-fce4a9454c5399c2ce8ca8e87048331c6e3d98fa.zip
ftpd: add some comments
Diffstat (limited to 'networking/ftpd.c')
-rw-r--r--networking/ftpd.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/networking/ftpd.c b/networking/ftpd.c
index eb3a3bd89..6630db710 100644
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -702,7 +702,10 @@ handle_dir_common(int opts)
702 line = xmalloc_fgetline(ls_fp); 702 line = xmalloc_fgetline(ls_fp);
703 if (!line) 703 if (!line)
704 break; 704 break;
705 cmdio_write(0, line); /* hack: 0 results in no status at all */ 705 /* Hack: 0 results in no status at all */
706 /* Note: it's ok that we don't prepend space,
707 * ftp.kernel.org doesn't do that too */
708 cmdio_write(0, line);
706 free(line); 709 free(line);
707 } 710 }
708 WRITE_OK(FTP_STATFILE_OK); 711 WRITE_OK(FTP_STATFILE_OK);
@@ -973,6 +976,15 @@ cmdio_get_cmd_and_arg(void)
973 if (!cmd) 976 if (!cmd)
974 exit(0); 977 exit(0);
975 978
979/* TODO: de-escape telnet here: 0xff,0xff => 0xff */
980/* RFC959 says that ABOR, STAT, QUIT may be sent even during
981 * data transfer, and may be preceded by telnet's "Interrupt Process"
982 * code (two-byte sequence 255,244) and then by telnet "Synch" code
983 * 255,242 (byte 242 is sent with TCP URG bit using send(MSG_OOB)
984 * and may generate SIGURG on our side. See RFC854).
985 * So far we don't support that (may install SIGURG handler if we'd want to),
986 * but we need to at least remove 255,xxx pairs. lftp sends those. */
987
976 /* Trailing '\n' is already stripped, strip '\r' */ 988 /* Trailing '\n' is already stripped, strip '\r' */
977 len = strlen(cmd) - 1; 989 len = strlen(cmd) - 1;
978 if ((ssize_t)len >= 0 && cmd[len] == '\r') 990 if ((ssize_t)len >= 0 && cmd[len] == '\r')
@@ -1115,6 +1127,8 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv)
1115 /* Set up options on the command socket (do we need these all? why?) */ 1127 /* Set up options on the command socket (do we need these all? why?) */
1116 setsockopt(STDIN_FILENO, IPPROTO_TCP, TCP_NODELAY, &const_int_1, sizeof(const_int_1)); 1128 setsockopt(STDIN_FILENO, IPPROTO_TCP, TCP_NODELAY, &const_int_1, sizeof(const_int_1));
1117 setsockopt(STDIN_FILENO, SOL_SOCKET, SO_KEEPALIVE, &const_int_1, sizeof(const_int_1)); 1129 setsockopt(STDIN_FILENO, SOL_SOCKET, SO_KEEPALIVE, &const_int_1, sizeof(const_int_1));
1130 /* Telnet protocol over command link may send "urgent" data,
1131 * we prefer it to be received in the "normal" data stream: */
1118 setsockopt(STDIN_FILENO, SOL_SOCKET, SO_OOBINLINE, &const_int_1, sizeof(const_int_1)); 1132 setsockopt(STDIN_FILENO, SOL_SOCKET, SO_OOBINLINE, &const_int_1, sizeof(const_int_1));
1119 1133
1120 WRITE_OK(FTP_GREET); 1134 WRITE_OK(FTP_GREET);