118
122
vsf_cmdio_get_cmd_and_arg(p_sess, &p_sess->ftp_cmd_str,
119
123
&p_sess->ftp_arg_str, 1);
120
if (str_equal_text(&p_sess->ftp_cmd_str, "USER"))
122
handle_user_command(p_sess);
124
else if (str_equal_text(&p_sess->ftp_cmd_str, "PASS"))
126
handle_pass_command(p_sess);
128
else if (str_equal_text(&p_sess->ftp_cmd_str, "QUIT"))
130
vsf_cmdio_write_exit(p_sess, FTP_GOODBYE, "Goodbye.");
132
else if (str_equal_text(&p_sess->ftp_cmd_str, "FEAT"))
136
else if (str_equal_text(&p_sess->ftp_cmd_str, "OPTS"))
140
else if (tunable_ssl_enable &&
141
str_equal_text(&p_sess->ftp_cmd_str, "AUTH") &&
142
!p_sess->control_use_ssl)
146
else if (tunable_ssl_enable && str_equal_text(&p_sess->ftp_cmd_str, "PBSZ"))
150
else if (tunable_ssl_enable && str_equal_text(&p_sess->ftp_cmd_str, "PROT"))
154
else if (str_isempty(&p_sess->ftp_cmd_str) &&
155
str_isempty(&p_sess->ftp_arg_str))
157
/* Deliberately ignore to avoid NAT device bugs. ProFTPd does the same. */
161
vsf_cmdio_write(p_sess, FTP_LOGINERR,
162
"Please login with USER and PASS.");
124
if (tunable_ftp_enable)
126
if (str_equal_text(&p_sess->ftp_cmd_str, "USER"))
128
handle_user_command(p_sess);
130
else if (str_equal_text(&p_sess->ftp_cmd_str, "PASS"))
132
handle_pass_command(p_sess);
134
else if (str_equal_text(&p_sess->ftp_cmd_str, "QUIT"))
136
vsf_cmdio_write_exit(p_sess, FTP_GOODBYE, "Goodbye.");
138
else if (str_equal_text(&p_sess->ftp_cmd_str, "FEAT"))
142
else if (str_equal_text(&p_sess->ftp_cmd_str, "OPTS"))
146
else if (tunable_ssl_enable &&
147
str_equal_text(&p_sess->ftp_cmd_str, "AUTH") &&
148
!p_sess->control_use_ssl)
152
else if (tunable_ssl_enable &&
153
str_equal_text(&p_sess->ftp_cmd_str, "PBSZ"))
157
else if (tunable_ssl_enable &&
158
str_equal_text(&p_sess->ftp_cmd_str, "PROT"))
162
else if (str_isempty(&p_sess->ftp_cmd_str) &&
163
str_isempty(&p_sess->ftp_arg_str))
165
/* Deliberately ignore to avoid NAT device bugs, as per ProFTPd. */
169
vsf_cmdio_write(p_sess, FTP_LOGINERR,
170
"Please login with USER and PASS.");
173
else if (tunable_http_enable)
175
if (str_equal_text(&p_sess->ftp_cmd_str, "GET"))
181
vsf_cmdio_write(p_sess, FTP_LOGINERR, "Bad HTTP verb.");
189
handle_get(struct vsf_session* p_sess)
192
str_copy(&p_sess->http_get_arg, &p_sess->ftp_arg_str);
193
str_alloc_text(&p_sess->user_str, "FTP");
194
str_alloc_text(&p_sess->ftp_arg_str, "<http>");
195
handle_pass_command(p_sess);
168
199
handle_user_command(struct vsf_session* p_sess)
170
201
/* SECURITY: If we're in anonymous only-mode, immediately reject