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_4-19-g891d8f


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-19-g891d8ff
Date: Sat, 23 Jan 2016 21:51:45 +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  891d8ff98e352f04fcd863a79e5d8ae00198db0f (commit)
      from  450b0a8ef4d0c4a36d278a8f5c7e1390276235e1 (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=891d8ff98e352f04fcd863a79e5d8ae00198db0f


commit 891d8ff98e352f04fcd863a79e5d8ae00198db0f
Author: Mats Erik Andersson <address@hidden>
Date:   Sat Jan 23 22:47:41 2016 +0100

    ftp: Allow remote user in command.
    
    Implement the extended host argument form address@hidden'
    for quick selection of the remote user name.

diff --git a/ChangeLog b/ChangeLog
index 99cd11e..43a0dcf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2016-01-23  Mats Erik Andersson  <address@hidden>
+
+       ftp: Allow remote user in command.
+
+       * ftp/ftp.c (hookup): Check for an embedded at-sign in the input
+       variable `host', keeping the rightmost part.  New variable P.
+       (login): Likewise, but also using the string part to the left of
+       the last at-sign as remote user name.
+
+       * doc/inetutils.texi (ftp invocation): Document this ability.
+       * NEWS: Likewise.
+
 2016-01-22  Mats Erik Andersson  <address@hidden>
 
        * bootstrap: Updated from gnulib.
diff --git a/NEWS b/NEWS
index db7fce1..418c4e0 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,11 @@ Free Software Foundation, Inc.
 See the end of this file for license conditions.
 
 Please send inetutils bug reports to <address@hidden>.
+
+* ftp
+
+Allow invocation, as well as command `open', to accept an explicit
+remote user name as extended host argument: address@hidden'.
 
 June 9, 2015
 Version 1.9.4:
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 88691cf..e34dc0d 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -1527,6 +1527,9 @@ Synopsis:
 @example
 ftp address@hidden@dots{}] address@hidden address@hidden
 pftp address@hidden@dots{}] address@hidden address@hidden
+
+ftp address@hidden@dots{}] @var{user@@host} address@hidden
+pftp address@hidden@dots{}] @var{user@@host} address@hidden
 @end example
 
 @noindent
@@ -1537,6 +1540,7 @@ The client host with which @command{ftp} is to 
communicate may be
 specified on the command line.
 If this is done, @command{ftp} will immediately attempt to establish
 a connection to the FTP server running on that host.
+Optionally, a remote user name can be specified at will.
 Otherwise, the program will start a command interpreter and will await
 further instructions from the user.
 Commands can either be entered interactively,
@@ -2004,6 +2008,7 @@ character's position in @var{inchars} is longer than the 
length of
 @var{outchars}, the character is deleted from the file name.
 
 @item open @var{host} address@hidden
address@hidden open @var{user@@host} address@hidden
 Establish a connection to the specified FTP server
 at @var{host}.  An optional port number may be supplied,
 in which case, @command{ftp} will attempt to contact the server
@@ -2011,6 +2016,10 @@ at that specific TCP port.  If the @code{autologin} 
option
 is on (is so by default), @command{ftp} will also attempt to
 automatically log the user in to the FTP server.
 
+The second form of invocation sets the remote user name to @var{user},
+which otherwise is taken as identical to the user identity owning the
+local session.
+
 @item passive
 Toggle passive mode.  If passive mode is turned on (default is off),
 the @command{ftp} client will send a @code{PASV} command for all data
diff --git a/ftp/ftp.c b/ftp/ftp.c
index 11d4adc..ff0b86c 100644
--- a/ftp/ftp.c
+++ b/ftp/ftp.c
@@ -133,7 +133,11 @@ hookup (char *host, int port)
   int s, tos;
   socklen_t len;
   static char hostnamebuf[80];
-  char *rhost;
+  char *rhost, *p;
+
+  p = strrchr (host, '@');
+  if (p && p != host && isprint (p[1]))
+    host = ++p;
 
 #ifdef HAVE_IDN
   status = idna_to_ascii_lz (host, &rhost, 0);
@@ -293,7 +297,7 @@ int
 login (char *host)
 {
   char tmp[80];
-  char *user, *pass, *acct;
+  char *user, *pass, *acct, *p;
   int n, aflag = 0;
 
   user = pass = acct = 0;
@@ -302,6 +306,15 @@ login (char *host)
       code = -1;
       return (0);
     }
+
+  p = strrchr (host, '@');
+  if (user == NULL && p && p != host && isprint (p[1]))
+    {
+      *p = 0;
+      user = host;
+      host = ++p;
+    }
+
   while (user == NULL)
     {
       char *myname = getlogin ();

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

Summary of changes:
 ChangeLog          |   12 ++++++++++++
 NEWS               |    5 +++++
 doc/inetutils.texi |    9 +++++++++
 ftp/ftp.c          |   17 +++++++++++++++--
 4 files changed, 41 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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