commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1_100-3-g58d


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1_100-3-g58da4a7
Date: Thu, 26 Sep 2013 00:11:55 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  58da4a716879b8ad602db4911d1d61312f108657 (commit)
      from  5f59063e2b5a9864250ab7473e5ba81ea4be817c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=58da4a716879b8ad602db4911d1d61312f108657


commit 58da4a716879b8ad602db4911d1d61312f108657
Author: Mats Erik Andersson <address@hidden>
Date:   Thu Sep 26 01:18:01 2013 +0200

    ftp: Abort transfer in ascii mode.

diff --git a/ChangeLog b/ChangeLog
index b40daf9..0d58f30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2013-09-26  Mats Erik Andersson  <address@hidden>
+
+       ftp: Abort transfer in ascii mode.
+       If the local ascii file causes a seek failure,
+       then tell the server to abort transmission.
+
+       * ftp/ftp.c (sendrequest) <restart_point && (STOR || APPE)>:
+       Change RC to off_t.  On seek failure, send ABOR command,
+       and get the reply.
+       (recvrequest) <TYPE_A && restart_point>: Reset `errno'.
+       <label done>: Send ABOR command, get reply.  Produce correct
+       error message if stepping through the local file gave EOF.
+
+
+       ftpd: Error message after seek failure.
+       The standard RFC 1123 introduced a better error code 554
+       to be used when a restart command is not successful.
+
+       * ftpd/ftpd.c (retrieve) <restart_point && TYPE_A>: Reply
+       with error code 554 if EOF was reach while seeking in file.
+       <restart_point && !TYPE_I>: Likewise when lseek() gave EINVAL.
+       (store) <restart_point>: Likewise for both modes.
+
 2013-09-23  Mats Erik Andersson  <address@hidden>
 
        ftpd: Setting of idle time.
diff --git a/ftp/ftp.c b/ftp/ftp.c
index 6fd0e19..d834c2c 100644
--- a/ftp/ftp.c
+++ b/ftp/ftp.c
@@ -676,7 +676,7 @@ sendrequest (char *cmd, char *local, char *remote, int 
printnames)
   if (restart_point &&
       (strcmp (cmd, "STOR") == 0 || strcmp (cmd, "APPE") == 0))
     {
-      int rc;
+      off_t rc;
 
       switch (curtype)
        {
@@ -690,6 +690,8 @@ sendrequest (char *cmd, char *local, char *remote, int 
printnames)
        }
       if (rc < 0)
        {
+         (void) command ("ABOR");
+         getreply (0);
          error (0, errno, "local: %s", local);
          restart_point = 0;
          if (closefunc != NULL)
@@ -1066,6 +1068,8 @@ recvrequest (char *cmd, char *local, char *remote, char 
*lmode, int printnames)
          off_t i, n;
          int ch;
 
+         errno = 0;
+
          if (fseeko (fout, 0L, SEEK_SET) < 0)
            goto done;
          n = restart_point;
@@ -1079,7 +1083,17 @@ recvrequest (char *cmd, char *local, char *remote, char 
*lmode, int printnames)
          if (fseeko (fout, 0L, SEEK_CUR) < 0)
            {
            done:
-             error (0, errno, "local: %s", local);
+             /* Cancel server's action quickly.  */
+             (void) command ("ABOR");
+             getreply (0);
+
+             /* Explain our failure.  */
+             if (ch == EOF)
+               printf ("Action not taken: offset %jd is outside of %s.\n",
+                      restart_point, local);
+             else
+               error (0, errno, "local: %s", local);
+
              if (closefunc != NULL)
                (*closefunc) (fout);
              return;
diff --git a/ftpd/ftpd.c b/ftpd/ftpd.c
index 1174dbc..8e35b3e 100644
--- a/ftpd/ftpd.c
+++ b/ftpd/ftpd.c
@@ -982,7 +982,10 @@ retrieve (const char *cmd, const char *name)
              c = getc (fin);
              if (c == EOF)
                {
-                 perror_reply (550, name);
+                 /* Error code 554 was introduced in RFC 1123.  */
+                 reply (554,
+                        "Action not taken: invalid REST value %jd for %s.",
+                        restart_point, name);
                  goto done;
                }
              if (c == '\n')
@@ -991,7 +994,11 @@ retrieve (const char *cmd, const char *name)
        }
       else if (lseek (fileno (fin), restart_point, SEEK_SET) < 0)
        {
-         perror_reply (550, name);
+         if (errno == EINVAL)
+           reply (554, "Action not taken: invalid REST value %jd for %s.",
+                  restart_point, name);
+         else
+           perror_reply (550, name);
          goto done;
        }
     }
@@ -1053,7 +1060,10 @@ store (const char *name, const char *mode, int unique)
              c = getc (fout);
              if (c == EOF)
                {
-                 perror_reply (550, name);
+                 /* Error code 554 was introduced in RFC 1123.  */
+                 reply (554,
+                        "Action not taken: invalid REST value %jd for %s.",
+                        restart_point, name);
                  goto done;
                }
              if (c == '\n')
@@ -1070,7 +1080,11 @@ store (const char *name, const char *mode, int unique)
        }
       else if (lseek (fileno (fout), restart_point, SEEK_SET) < 0)
        {
-         perror_reply (550, name);
+         if (errno == EINVAL)
+           reply (554, "Action not taken: invalid REST value %jd for %s.",
+                  restart_point, name);
+         else
+           perror_reply (550, name);
          goto done;
        }
     }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog   |   23 +++++++++++++++++++++++
 ftp/ftp.c   |   18 ++++++++++++++++--
 ftpd/ftpd.c |   22 ++++++++++++++++++----
 3 files changed, 57 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]