# HG changeset patch # User masneyb # Date 1164934670 0 # Node ID 10e2ce91e26c966ac875239c199092870d789600 # Parent 5ba7622df35808b81383366b05530b99cc0c3d54 2006-11-30 Brian Masney * lib/rfc959.c lib/sshv2.c src/uicommon/gftpui.c - don't abort the entire file transfer if there is a permission denied at some point during the file transfer. Give the user an error at the very end if there were any errors. (closes #328550) diff -r 5ba7622df358 -r 10e2ce91e26c ChangeLog --- a/ChangeLog Sun Nov 26 18:31:17 2006 +0000 +++ b/ChangeLog Fri Dec 01 00:57:50 2006 +0000 @@ -1,3 +1,9 @@ +2006-11-30 Brian Masney + * lib/rfc959.c lib/sshv2.c src/uicommon/gftpui.c - don't abort the + entire file transfer if there is a permission denied at some point + during the file transfer. Give the user an error at the very end if + there were any errors. (closes #328550) + 2006-11-16 Brian Masney * lib/protocols.c (gftp_get_all_subdirs) - don't return if there was a problem running gftp_stat_filename(). Only return if there was a fatal @@ -3739,7 +3745,7 @@ * cvsclean - added this script - * *.[ch] - added $Id: ChangeLog,v 1.504 2006/11/17 03:04:50 masneyb Exp $ tags + * *.[ch] - added $Id: ChangeLog,v 1.505 2006/12/01 00:57:49 masneyb Exp $ tags * debian/* - updated files from Debian maintainer diff -r 5ba7622df358 -r 10e2ce91e26c lib/rfc959.c --- a/lib/rfc959.c Sun Nov 26 18:31:17 2006 +0000 +++ b/lib/rfc959.c Fri Dec 01 00:57:50 2006 +0000 @@ -1207,7 +1207,11 @@ else if (ret != '1') { rfc959_close_data_connection (request); - return (GFTP_ERETRYABLE); + + if (ret == '5') + return (GFTP_EFATAL); + else + return (GFTP_ERETRYABLE); } gftp_lookup_request_option (request, "passive_transfer", &passive_transfer); @@ -1276,7 +1280,11 @@ else if (ret != '1') { rfc959_close_data_connection (request); - return (GFTP_ERETRYABLE); + + if (ret == '5') + return (GFTP_EFATAL); + else + return (GFTP_ERETRYABLE); } gftp_lookup_request_option (request, "passive_transfer", &passive_transfer); diff -r 5ba7622df358 -r 10e2ce91e26c lib/sshv2.c --- a/lib/sshv2.c Sun Nov 26 18:31:17 2006 +0000 +++ b/lib/sshv2.c Fri Dec 01 00:57:50 2006 +0000 @@ -896,6 +896,7 @@ sshv2_read_status_response (gftp_request * request, sshv2_message * message, int fd, int fxp_is_retryable, int fxp_is_wrong) { + guint32 num; int ret; memset (message, 0, sizeof (*message)); @@ -904,8 +905,15 @@ return (ret); else if (fxp_is_retryable > 0 && ret == fxp_is_retryable) { + memcpy (&num, message->buffer + 4, 4); + num = ntohl (num); + sshv2_message_free (message); - return (GFTP_ERETRYABLE); + + if (num == SSH_FX_PERMISSION_DENIED) + return (GFTP_EFATAL); + else + return (GFTP_ERETRYABLE); } else if (fxp_is_wrong > 0 && ret != fxp_is_wrong) return (sshv2_wrong_response (request, message)); @@ -923,10 +931,11 @@ case SSH_FX_OK: case SSH_FX_EOF: case SSH_FX_NO_SUCH_FILE: - case SSH_FX_PERMISSION_DENIED: case SSH_FX_FAILURE: case SSH_FX_OP_UNSUPPORTED: return (GFTP_ERETRYABLE); + case SSH_FX_PERMISSION_DENIED: + return (GFTP_EFATAL); default: return (sshv2_wrong_response (request, message)); } diff -r 5ba7622df358 -r 10e2ce91e26c src/uicommon/gftpui.c --- a/src/uicommon/gftpui.c Sun Nov 26 18:31:17 2006 +0000 +++ b/src/uicommon/gftpui.c Fri Dec 01 00:57:50 2006 +0000 @@ -1462,9 +1462,8 @@ static int _gftpui_common_trans_file_or_dir (gftp_transfer * tdata) { + int tofd, fromfd, ret; gftp_file * curfle; - int tofd, fromfd; - int ret; if (g_thread_supported ()) g_static_mutex_lock (&tdata->structmutex); @@ -1552,12 +1551,13 @@ int gftpui_common_transfer_files (gftp_transfer * tdata) { - int ret; + int ret, skipped_files; tdata->curfle = tdata->files; gettimeofday (&tdata->starttime, NULL); memcpy (&tdata->lasttime, &tdata->starttime, sizeof (tdata->lasttime)); + skipped_files = 0; while (tdata->curfle != NULL) { ret = _gftpui_common_trans_file_or_dir (tdata); @@ -1569,6 +1569,8 @@ if (gftp_abort_transfer (tdata->fromreq) != 0) gftp_disconnect (tdata->fromreq); } + else if (ret == GFTP_EFATAL) + skipped_files++; else if (ret < 0) { if (gftp_get_transfer_status (tdata, ret) == GFTP_ERETRYABLE) @@ -1590,6 +1592,11 @@ } } + if (skipped_files) + tdata->fromreq->logging_function (gftp_logging_error, tdata->fromreq, + _("There were %d files or directories that could not be transferred. Check the log for which items were not properly transferred."), + skipped_files); + tdata->done = 1; return (1); }