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-107-g3370c


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-107-g3370c78
Date: Fri, 01 Jun 2012 22:31:35 +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  3370c78d40133eae964a669342a3a2be4cf229ef (commit)
       via  3d90d83248d0a632c8080cf2970eda50f835e665 (commit)
      from  890be117d428028e4e77608303416598c163c158 (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=3370c78d40133eae964a669342a3a2be4cf229ef


commit 3370c78d40133eae964a669342a3a2be4cf229ef
Author: Mats Erik Andersson <address@hidden>
Date:   Sat Jun 2 00:21:19 2012 +0200

    ftpd: Long passive transfer request.
    
    Add the command request `LPSV'.

diff --git a/ChangeLog b/ChangeLog
index 58a1836..5504e7a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2012-06-02  Mats Erik Andersson  <address@hidden>
+
+       ftpd: Long passive transfer request.
+
+       * ftpd/extern.h (PASSIVE_PASV, PASSIVE_EPSV, PASSIVE_LPSV):
+       New macros.
+       * ftpd/ftpcmd.y (LPSV): New token.
+       (cmd) <PASV>: Call passive() with PASSIVE_PASV.
+       <EPSV>: Call passive() with PASSIVE_EPSV; both variants.
+       <LPSV>: New subcommand.
+       (cmdtab): New entry `LPSV'.
+       * ftpd/ftpd.c (passive): Use macros PASSIVE_* to distinguish
+       subcases.  Add two subcases for `LPSV', with pointer math
+       shared with `PASV'.
+       * doc/inetutils.texi: Updated.
+
 2012-05-31  Mats Erik Andersson  <address@hidden>
 
        ftp: Adaptive block size in image mode.
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 6de8d94..d048397 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -2897,10 +2897,11 @@ case of the requests is ignored.
 @item CDUP         @tab  change to parent of current working directory
 @item CWD          @tab  change working directory
 @item DELE         @tab  delete a file
address@hidden EPSV         @tab  prepare for server-to-server transfer
address@hidden EPSV         @tab  extended passive transfer request
 @item EPRT         @tab  specify data connection port
 @item HELP         @tab  give help information
 @item LIST         @tab  give list files in a directory (``ls -lgA'')
address@hidden LPSV         @tab  long passive transfer request
 @item MKD          @tab  make a directory
 @item MDTM         @tab  show last modification time of file
 @item MODE         @tab  specify data transfer mode
@@ -2946,7 +2947,7 @@ the @code{SITE} request.
 The remaining FTP requests specified in RFC 959 are recognized, but
 not implemented.  The extensions @code{MDTM}, @code{REST},
 and @code{SIZE} are specified in RFC 3659, while @code{EPRT}
-and @code{EPSV} appear in RFC 2428.
+and @code{EPSV} appear in RFC 2428, and @code{LPSV} in RFC 1639.
 
 The ftp server will abort an active file transfer only when the
 @code{ABOR} command is preceded by a Telnet @samp{Interrupt Process}
diff --git a/ftpd/extern.h b/ftpd/extern.h
index acf673f..ed53cce 100644
--- a/ftpd/extern.h
+++ b/ftpd/extern.h
@@ -113,6 +113,11 @@ extern char tmpline[];
 /* Exported from ftpcmd.y.  */
 extern off_t restart_point;
 
+/* Distinguish passive address modes.  */
+#define PASSIVE_PASV 0
+#define PASSIVE_EPSV 1
+#define PASSIVE_LPSV 2
+
 /* Exported from server_mode.c.  */
 extern int usefamily;
 extern int server_mode (const char *pidfile, struct sockaddr *phis_addr,
diff --git a/ftpd/ftpcmd.y b/ftpd/ftpcmd.y
index f8099bd..1fd0ac6 100644
--- a/ftpd/ftpcmd.y
+++ b/ftpd/ftpcmd.y
@@ -50,11 +50,12 @@
 /*
  * Grammar for FTP commands:
  *
- *   See RFC 959, RFC 2428, and RFC 3659 (MDTM, REST, SIZE).
+ *   See RFC 959, RFC 1636 (LPSV), RFC 2428,
+ *   and RFC 3659 (MDTM, REST, SIZE).
  *
  * TODO: Update with RFC 3659 (MLST, MLSD).
  *
- * TODO: RFC 1639 (LPRT, LPSV).
+ * TODO: RFC 1639 (LPRT).
  *
  * TODO: RFC 2389 (FEAT, OPTS).
  *
@@ -150,7 +151,7 @@ static void yyerror       (const char *s);
        STAT    HELP    NOOP    MKD     RMD     PWD
        CDUP    STOU    SMNT    SYST    SIZE    MDTM
 
-       EPRT    EPSV
+       EPRT    EPSV    LPSV
 
        UMASK   IDLE    CHMOD
 
@@ -230,7 +231,7 @@ cmd
        | PASV check_login CRLF
                {
                        if ($2)
-                               passive(0, AF_INET);
+                               passive(PASSIVE_PASV, AF_INET);
                }
        | TYPE SP type_code CRLF
                {
@@ -709,17 +710,26 @@ cmd
        | EPSV check_login CRLF
                {
                        if ($2)
-                               passive(1, AF_UNSPEC);
+                               passive(PASSIVE_EPSV, AF_UNSPEC);
                }
        | EPSV check_login SP net_proto CRLF
                {
                        if ($2) {
                                if ($4 > 0)
-                                       passive(1, $4);
+                                       passive(PASSIVE_EPSV, $4);
                                else
                                        reply (522, "Network protocol not 
supported, use (1,2)");
                        }
                }
+
+               /*
+                * LPSV is in RFC 1639.
+                */
+       | LPSV check_login CRLF
+               {
+                       if ($2)
+                               passive(PASSIVE_LPSV, 0 /* not used */);
+               }
        | QUIT CRLF
                {
                        reply(221, "Goodbye.");
@@ -1067,6 +1077,7 @@ struct tab cmdtab[] = {           /* In order defined in 
RFC 765 */
        { "MDTM", MDTM, OSTR, 1,        "<sp> path-name" },
        { "EPRT", EPRT, DLIST, 1,       "<sp> <d> proto <d> addr <d> port <d>" 
},
        { "EPSV", EPSV, ARGS, 1,        "[ <sp> af ]" },
+       { "LPSV", LPSV, ARGS, 1,        "(set server in long passive mode)" },
        { NULL,   0,    0,    0,        0 }
 };
 
diff --git a/ftpd/ftpd.c b/ftpd/ftpd.c
index 4c1711f..9014a1e 100644
--- a/ftpd/ftpd.c
+++ b/ftpd/ftpd.c
@@ -1819,7 +1819,7 @@ passive (int epsv, int af)
   int try_af;
 
   /* EPSV might ask for a particular address family.  */
-  if (epsv && af > 0)
+  if (epsv == PASSIVE_EPSV && af > 0)
     try_af = af;
   else
     try_af = ctrl_addr.ss_family;
@@ -1852,7 +1852,7 @@ passive (int epsv, int af)
   if (listen (pdata, 1) < 0)
     goto pasv_error;
 
-  if (epsv)
+  if (epsv == PASSIVE_EPSV)
     {
       /* EPSV for IPv4 and IPv6.  */
       reply (229, "Entering Extended Passive Mode (|||%u|)",
@@ -1861,13 +1861,16 @@ passive (int epsv, int af)
                    : ((struct sockaddr_in6 *) &pasv_addr)->sin6_port));
       return;
     }
-  else /* !epsv */
+  else /* !EPSV */
     {
-      /* PASV for IPv4.
+      /* PASV for IPv4, or LPSV for IPv4 or IPv6.
        *
        * Some systems, like OpenSolaris, prefer to return
        * an IPv4-mapped-IPv6 address, which must be processed
        * for printout.  */
+
+#define UC(b) (((int) b) & 0xff)
+
       if (pasv_addr.ss_family == AF_INET6
          && IN6_IS_ADDR_V4MAPPED (&((struct sockaddr_in6 *) 
&pasv_addr)->sin6_addr))
        {
@@ -1875,16 +1878,38 @@ passive (int epsv, int af)
          a += 3 * sizeof (struct in_addr);     /* Skip padding up to IPv4 
content.  */
          p = (char *) &((struct sockaddr_in6 *) &pasv_addr)->sin6_port;
        }
+      else if (pasv_addr.ss_family == AF_INET6)
+       {
+         /* LPSV for IPv6, not mapped. */
+         a = (char *) &((struct sockaddr_in6 *) &pasv_addr)->sin6_addr;
+         p = (char *) &((struct sockaddr_in6 *) &pasv_addr)->sin6_port;
+
+         reply (228, "Entering Long Passive Mode "
+                "(6,16,%d,%d,%d,%d,%d,%d,%d,%d"        /* a[0..7] */
+                ",%d,%d,%d,%d,%d,%d,%d,%d"     /* a[8..15] */
+                ",2,%d,%d)",   /* p0, p1 */
+                UC (a[0]), UC (a[1]), UC (a[2]), UC (a[3]),
+                UC (a[4]), UC (a[5]), UC (a[6]), UC (a[7]),
+                UC (a[8]), UC (a[9]), UC (a[10]), UC (a[11]),
+                UC (a[12]), UC (a[13]), UC (a[14]), UC (a[15]),
+                UC (p[0]), UC (p[1]));
+         return;
+       }
       else
        {
          a = (char *) &((struct sockaddr_in *) &pasv_addr)->sin_addr;
          p = (char *) &((struct sockaddr_in *) &pasv_addr)->sin_port;
        }
 
-#define UC(b) (((int) b) & 0xff)
-
-      reply (227, "Entering Passive Mode (%d,%d,%d,%d,%d,%d)", UC (a[0]),
-            UC (a[1]), UC (a[2]), UC (a[3]), UC (p[0]), UC (p[1]));
+      if (epsv == PASSIVE_LPSV)
+       reply (228, "Entering Long Passive Mode "
+              "(4,4,%d,%d,%d,%d,2,%d,%d)",
+              UC (a[0]), UC (a[1]), UC (a[2]), UC (a[3]),
+              UC (p[0]), UC (p[1]));
+      else
+       reply (227, "Entering Passive Mode (%d,%d,%d,%d,%d,%d)",
+              UC (a[0]), UC (a[1]), UC (a[2]), UC (a[3]),
+              UC (p[0]), UC (p[1]));
       return;
     }
 

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=3d90d83248d0a632c8080cf2970eda50f835e665


commit 3d90d83248d0a632c8080cf2970eda50f835e665
Author: Mats Erik Andersson <address@hidden>
Date:   Fri Jun 1 18:47:39 2012 +0200

    Documentation (silent change).

diff --git a/ChangeLog b/ChangeLog
index 9f72a57..58a1836 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
- 2012-05-31  Mats Erik Andersson  <address@hidden>
+2012-05-31  Mats Erik Andersson  <address@hidden>
 
        ftp: Adaptive block size in image mode.
 
@@ -11,7 +11,7 @@
        and set BLKSIZE to `st_blksize'.
        (abort_remote): Replace macro BUFSIZ by `sizeof(buf)'.
 
- 2012-05-31  Mats Erik Andersson  <address@hidden>
+2012-05-31  Mats Erik Andersson  <address@hidden>
 
        ftpd: Use adaptive block sizes in image mode.
 
@@ -24,7 +24,7 @@
        If `cmd == 0', use `st_blksize' for setting BUFFER_SIZE.
        (store): Call fstat() on successful stream `fout'.
 
- 2012-05-30  Mats Erik Andersson  <address@hidden>
+2012-05-30  Mats Erik Andersson  <address@hidden>
 
        Incomplete coding of variadic printing.  Each such command
        consumes the pointer, leaving it in an undefined state.
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 2d81a83..6de8d94 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -2879,10 +2879,10 @@ is 15 minutes).
 Set default umask(base 8).
 @end table
 
-The file @file{/etc/nologin} can be used to disable ftp access.  If
-the file exists,@command{ ftpd} displays it and exits.  If the file
+The file @file{/etc/nologin} can be used to disable FTP access.  If
+the file exists, @command{ftpd} displays it and exits.  If the file
 @file{/etc/ftpwelcome} exists, @command{ftpd} prints it before issuing
-the @samp{ready} message.  If the file @command{/etc/motd} exists,
+the @samp{ready} message.  If the file @file{/etc/motd} exists,
 @command{ftpd} prints it after a successful login.
 
 The FTP server currently supports the following FTP requests.  The
@@ -2897,6 +2897,8 @@ case of the requests is ignored.
 @item CDUP         @tab  change to parent of current working directory
 @item CWD          @tab  change working directory
 @item DELE         @tab  delete a file
address@hidden EPSV         @tab  prepare for server-to-server transfer
address@hidden EPRT         @tab  specify data connection port
 @item HELP         @tab  give help information
 @item LIST         @tab  give list files in a directory (``ls -lgA'')
 @item MKD          @tab  make a directory
@@ -2930,20 +2932,21 @@ case of the requests is ignored.
 @item XRMD         @tab  remove a directory (deprecated)
 @end multitable
 
-The following non-standard or UNIX specific commands are supported by
+The following non-standard, or UNIX specific, commands are supported by
 the @code{SITE} request.
 
 @multitable @columnfractions 0.3 0.7
 @item Request      @tab  Description
address@hidden UMASK        @tab  change umask, e.g.  @code{SITE UMASK 002}
address@hidden IDLE         @tab  set idle-timer, e.g.  @code{SITE IDLE 60}
address@hidden CHMOD        @tab  change mode of a file, e.g.  @code{SITE 
CHMOD0 0CHMOD1 1CHMOD2}
address@hidden UMASK        @tab  change umask, e.g. @code{SITE UMASK 002}
address@hidden IDLE         @tab  set idle-timer, e.g. @code{SITE IDLE 60}
address@hidden CHMOD        @tab  change mode of a file, e.g. @code{SITE CHMOD0 
0CHMOD1 1CHMOD2}
 @item HELP         @tab  give help information.
 @end multitable
 
 The remaining FTP requests specified in RFC 959 are recognized, but
-not implemented.  @code{MDTM} and @code{SIZE} are not specified in RFC
-959, but will appear in the next updated FTP RFC.
+not implemented.  The extensions @code{MDTM}, @code{REST},
+and @code{SIZE} are specified in RFC 3659, while @code{EPRT}
+and @code{EPSV} appear in RFC 2428.
 
 The ftp server will abort an active file transfer only when the
 @code{ABOR} command is preceded by a Telnet @samp{Interrupt Process}
diff --git a/ftpd/ftpcmd.y b/ftpd/ftpcmd.y
index 533a827..f8099bd 100644
--- a/ftpd/ftpcmd.y
+++ b/ftpd/ftpcmd.y
@@ -48,14 +48,15 @@
  */
 
 /*
- * Grammar for FTP commands.
- * See RFC 959.
+ * Grammar for FTP commands:
  *
- * TODO Update to RFC 3659
+ *   See RFC 959, RFC 2428, and RFC 3659 (MDTM, REST, SIZE).
  *
- * RFC 2428
+ * TODO: Update with RFC 3659 (MLST, MLSD).
  *
- * TODO RFC 1639
+ * TODO: RFC 1639 (LPRT, LPSV).
+ *
+ * TODO: RFC 2389 (FEAT, OPTS).
  *
  * FIXME: Rewrite with GNU standard formatting.  Legacy code is changed!
  */
@@ -542,8 +543,7 @@ cmd
                }
 
                /*
-                * SIZE is not in RFC959, but Postel has blessed it and
-                * it will be in the updated RFC.
+                * SIZE is in RFC 3659.
                 *
                 * Return size of file in a format suitable for
                 * using with RESTART (we just count bytes).
@@ -556,8 +556,7 @@ cmd
                }
 
                /*
-                * MDTM is not in RFC959, but Postel has blessed it and
-                * it will be in the updated RFC.
+                * MDTM is in RFC 3659.
                 *
                 * Return modification time of file as an ISO 3307
                 * style time. E.g. YYYYMMDDHHMMSS or YYYYMMDDHHMMSS.xxx
@@ -585,6 +584,10 @@ cmd
                        }
                        free($4);
                }
+
+               /*
+                * EPRT is in RFC 2428.
+                */
        | EPRT check_login SP CHAR net_proto CHAR net_addr CHAR tcp_port CHAR 
CRLF
                {
                        usedefault = 0;
@@ -699,6 +702,10 @@ cmd
                                reply (500, "Illegal EPRT Command");
                        }
                }
+
+               /*
+                * EPSV is in RFC 2428.
+                */
        | EPSV check_login CRLF
                {
                        if ($2)
@@ -734,6 +741,10 @@ rcmd
                        if (fromname == (char *) 0 && $4)
                            free($4);
                }
+
+               /*
+                * REST is in RFC 3659.
+                */
        | REST SP byte_size CRLF
                {
                        free (fromname);

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

Summary of changes:
 ChangeLog          |   22 +++++++++++++++++++---
 doc/inetutils.texi |   22 +++++++++++++---------
 ftpd/extern.h      |    5 +++++
 ftpd/ftpcmd.y      |   48 +++++++++++++++++++++++++++++++++++-------------
 ftpd/ftpd.c        |   41 +++++++++++++++++++++++++++++++++--------
 5 files changed, 105 insertions(+), 33 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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