"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/data.c" between
proftpd-1.3.6b.tar.gz and proftpd-1.3.6c.tar.gz

About: ProFTPD is a highly configurable FTP server software (with FTPS and SFTP support).

data.c  (proftpd-1.3.6b):data.c  (proftpd-1.3.6c)
/* /*
* ProFTPD - FTP server daemon * ProFTPD - FTP server daemon
* Copyright (c) 1997, 1998 Public Flood Software * Copyright (c) 1997, 1998 Public Flood Software
* Copyright (c) 1999, 2000 MacGyver aka Habeeb J. Dihu <macgyver@tos.net> * Copyright (c) 1999, 2000 MacGyver aka Habeeb J. Dihu <macgyver@tos.net>
* Copyright (c) 2001-2018 The ProFTPD Project team * Copyright (c) 2001-2020 The ProFTPD Project team
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
skipping to change at line 687 skipping to change at line 687
* some ftp clients close the data connection at the same time as they * some ftp clients close the data connection at the same time as they
* send the OOB byte (which results in a broken pipe on our * send the OOB byte (which results in a broken pipe on our
* end). Thus, it's a race between the OOB data and the tcp close * end). Thus, it's a race between the OOB data and the tcp close
* finishing. Either way, it's ok (client will see either "Broken pipe" * finishing. Either way, it's ok (client will see either "Broken pipe"
* error or "Aborted"). xfer_abor() in mod_xfer cleans up the session * error or "Aborted"). xfer_abor() in mod_xfer cleans up the session
* flags in any case. session flags will end up have SF_POST_ABORT * flags in any case. session flags will end up have SF_POST_ABORT
* set if the OOB byte won the race. * set if the OOB byte won the race.
*/ */
void pr_data_cleanup(void) { void pr_data_cleanup(void) {
/* sanity check */ /* sanity check */
if (session.d) { if (session.d != NULL) {
pr_inet_lingering_close(session.pool, session.d, timeout_linger); pr_inet_lingering_close(session.pool, session.d, timeout_linger);
session.d = NULL; session.d = NULL;
} }
pr_data_clear_xfer_pool(); pr_data_clear_xfer_pool();
/* Clear/restore the default data transfer type. Otherwise, things like /* Clear/restore the default data transfer type. Otherwise, things like
* APPEs or STOUs will be preserved for the next upload erroneously * APPEs or STOUs will be preserved for the next upload erroneously
* (see Bug#3612). * (see Bug#3612).
*/ */
skipping to change at line 714 skipping to change at line 714
*/ */
void pr_data_abort(int err, int quiet) { void pr_data_abort(int err, int quiet) {
int true_abort = XFER_ABORTED; int true_abort = XFER_ABORTED;
nstrm = NULL; nstrm = NULL;
pr_trace_msg(trace_channel, 9, pr_trace_msg(trace_channel, 9,
"aborting data transfer (errno = %s (%d), quiet = %s, true abort = %s)", "aborting data transfer (errno = %s (%d), quiet = %s, true abort = %s)",
strerror(err), err, quiet ? "true" : "false", strerror(err), err, quiet ? "true" : "false",
true_abort ? "true" : "false"); true_abort ? "true" : "false");
if (session.d) { if (session.d != NULL) {
if (true_abort == FALSE) { if (true_abort == FALSE) {
pr_inet_lingering_close(session.pool, session.d, timeout_linger); pr_inet_lingering_close(session.pool, session.d, timeout_linger);
} else { } else {
pr_inet_lingering_abort(session.pool, session.d, timeout_linger); pr_inet_lingering_abort(session.pool, session.d, timeout_linger);
} }
session.d = NULL; session.d = NULL;
} }
skipping to change at line 896 skipping to change at line 896
pr_log_pri(PR_LOG_NOTICE, "notice: user %s: aborting transfer: %s", pr_log_pri(PR_LOG_NOTICE, "notice: user %s: aborting transfer: %s",
session.user ? session.user : "(unknown)", msg); session.user ? session.user : "(unknown)", msg);
/* If we are aborting, then a 426 response has already been sent, /* If we are aborting, then a 426 response has already been sent,
* and we don't want to add another to the error queue. * and we don't want to add another to the error queue.
*/ */
if (true_abort == FALSE) { if (true_abort == FALSE) {
pr_response_add_err(respcode, _("Transfer aborted. %s"), msg ? msg : ""); pr_response_add_err(respcode, _("Transfer aborted. %s"), msg ? msg : "");
} }
/* Forcibly clear the data-transfer instigating command pool from the
* Response API.
*/
pr_response_set_pool(NULL);
} }
if (true_abort) { if (true_abort) {
session.sf_flags |= SF_POST_ABORT; session.sf_flags |= SF_POST_ABORT;
} }
} }
/* From response.c. XXX Need to provide these symbols another way. */ /* From response.c. XXX Need to provide these symbols another way. */
extern pr_response_t *resp_list, *resp_err_list; extern pr_response_t *resp_list, *resp_err_list;
skipping to change at line 928 skipping to change at line 933
if (res == 0 && if (res == 0 &&
!(session.sf_flags & SF_ABORT)) { !(session.sf_flags & SF_ABORT)) {
cmd_rec *cmd = NULL; cmd_rec *cmd = NULL;
pr_trace_msg(trace_channel, 1, pr_trace_msg(trace_channel, 1,
"data available for reading on control channel during data transfer, " "data available for reading on control channel during data transfer, "
"reading control data"); "reading control data");
res = pr_cmd_read(&cmd); res = pr_cmd_read(&cmd);
if (res < 0) { if (res < 0) {
int xerrno; int xerrno;
#if defined(ECONNABORTED) #if defined(ECONNABORTED)
xerrno = ECONNABORTED; xerrno = ECONNABORTED;
#elif defined(ENOTCONN) #elif defined(ENOTCONN)
xerrno = ENOTCONN; xerrno = ENOTCONN;
#else #else
xerrno = EIO; xerrno = EIO;
#endif #endif
pr_trace_msg(trace_channel, 1, pr_trace_msg(trace_channel, 1,
"unable to read control command during data transfer: %s", "unable to read control command during data transfer: %s",
skipping to change at line 996 skipping to change at line 1002
resp_list = resp_err_list = NULL; resp_list = resp_err_list = NULL;
resp_pool = pr_response_get_pool(); resp_pool = pr_response_get_pool();
pr_response_set_pool(cmd->pool); pr_response_set_pool(cmd->pool);
pr_response_add_err(R_450, _("%s: data transfer in progress"), pr_response_add_err(R_450, _("%s: data transfer in progress"),
(char *) cmd->argv[0]); (char *) cmd->argv[0]);
pr_response_flush(&resp_err_list); pr_response_flush(&resp_err_list);
destroy_pool(cmd->pool);
pr_response_set_pool(resp_pool); pr_response_set_pool(resp_pool);
destroy_pool(cmd->pool);
/* We don't want to actually dispatch the NOOP command, since that /* We don't want to actually dispatch the NOOP command, since that
* would overwrite the scoreboard with the NOOP state; admins probably * would overwrite the scoreboard with the NOOP state; admins probably
* want to see the command that caused the data transfer. And since * want to see the command that caused the data transfer. And since
* NOOP doesn't take a 450 response (as per RFC959), we will simply * NOOP doesn't take a 450 response (as per RFC959), we will simply
* return 200. * return 200.
*/ */
} else if (pr_cmd_cmp(cmd, PR_CMD_NOOP_ID) == 0) { } else if (pr_cmd_cmp(cmd, PR_CMD_NOOP_ID) == 0) {
pool *resp_pool; pool *resp_pool;
skipping to change at line 1022 skipping to change at line 1028
resp_list = resp_err_list = NULL; resp_list = resp_err_list = NULL;
resp_pool = pr_response_get_pool(); resp_pool = pr_response_get_pool();
pr_response_set_pool(cmd->pool); pr_response_set_pool(cmd->pool);
pr_response_add(R_200, _("%s: data transfer in progress"), pr_response_add(R_200, _("%s: data transfer in progress"),
(char *) cmd->argv[0]); (char *) cmd->argv[0]);
pr_response_flush(&resp_list); pr_response_flush(&resp_list);
destroy_pool(cmd->pool);
pr_response_set_pool(resp_pool); pr_response_set_pool(resp_pool);
destroy_pool(cmd->pool);
} else { } else {
char *title_buf = NULL; char *title_buf = NULL;
int title_len = -1; int curr_cmd_id = 0, title_len = -1;
const char *sce_cmd = NULL, *sce_cmd_arg = NULL; const char *curr_cmd = NULL, *sce_cmd = NULL, *sce_cmd_arg = NULL;
cmd_rec *curr_cmd_rec = NULL;
pr_trace_msg(trace_channel, 5, pr_trace_msg(trace_channel, 5,
"client sent '%s' command during data transfer, dispatching", "client sent '%s' command during data transfer, dispatching",
(char *) cmd->argv[0]); (char *) cmd->argv[0]);
title_len = pr_proctitle_get(NULL, 0); title_len = pr_proctitle_get(NULL, 0);
if (title_len > 0) { if (title_len > 0) {
title_buf = pcalloc(cmd->pool, title_len + 1); title_buf = pcalloc(cmd->pool, title_len + 1);
pr_proctitle_get(title_buf, title_len + 1); pr_proctitle_get(title_buf, title_len + 1);
} }
curr_cmd = session.curr_cmd;
curr_cmd_id = session.curr_cmd_id;
curr_cmd_rec = session.curr_cmd_rec;
sce_cmd = pr_scoreboard_entry_get(PR_SCORE_CMD); sce_cmd = pr_scoreboard_entry_get(PR_SCORE_CMD);
sce_cmd_arg = pr_scoreboard_entry_get(PR_SCORE_CMD_ARG); sce_cmd_arg = pr_scoreboard_entry_get(PR_SCORE_CMD_ARG);
pr_cmd_dispatch(cmd); pr_cmd_dispatch(cmd);
pr_scoreboard_entry_update(session.pid, pr_scoreboard_entry_update(session.pid,
PR_SCORE_CMD, "%s", sce_cmd, NULL, NULL); PR_SCORE_CMD, "%s", sce_cmd, NULL, NULL);
pr_scoreboard_entry_update(session.pid, pr_scoreboard_entry_update(session.pid,
PR_SCORE_CMD_ARG, "%s", sce_cmd_arg, NULL, NULL); PR_SCORE_CMD_ARG, "%s", sce_cmd_arg, NULL, NULL);
if (title_len > 0) { if (title_len > 0) {
pr_proctitle_set_str(title_buf); pr_proctitle_set_str(title_buf);
} }
destroy_pool(cmd->pool); destroy_pool(cmd->pool);
session.curr_cmd = curr_cmd;
session.curr_cmd_id = curr_cmd_id;
session.curr_cmd_rec = curr_cmd_rec;
} }
} else { } else {
pr_trace_msg(trace_channel, 3, pr_trace_msg(trace_channel, 3,
"invalid command sent, sending error response"); "invalid command sent, sending error response");
pr_response_send(R_500, _("Invalid command: try being more creative")); pr_response_send(R_500, _("Invalid command: try being more creative"));
} }
} }
} }
 End of changes. 12 change blocks. 
7 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)