From 495beb89dac593371c004c57c65c4efd290ecd51 Mon Sep 17 00:00:00 2001 From: Mats Erik Andersson Date: Mon, 16 Mar 2015 23:22:12 +0100 Subject: [PATCH] ftp: Honour host aliases. Take care to preserve the desired peer's name. Do not replace it with its canonical name. Bug was reported to the list as `2015-02/msg00000.html' by John Sullivan. --- ChangeLog | 11 +++++++++++ ftp/cmds.c | 10 ++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0310c615..70c741cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2015-03-16 Mats Erik Andersson + + ftp: Honour host aliases. + While establishing the connection, do not replace the desired + peer name with its canonical name. This prevents correct use + of the netrc file. Bug reported by John Sullivan in + http://lists.gnu.org/archive/html/bug-inetutils/2015-02/msg00000.html + + * ftp/cmds.c (setpeer): Do not assign value from hookup() + to HOST. Instead, only test if it is non-null. + 2015-03-15 Mats Erik Andersson telnetd: Suppress PTY packet data. diff --git a/ftp/cmds.c b/ftp/cmds.c index 16ba5fcc..422d365b 100644 --- a/ftp/cmds.c +++ b/ftp/cmds.c @@ -279,8 +279,14 @@ setpeer (int argc, char **argv) port = (sp) ? ntohs (sp->s_port) : DEFPORT; } - host = hookup (host, port); - if (host) + /* After hookup(), the global variable `hostname' contains + * the canonical host name corresponding to the alias name + * contained in HOST. The return value of hookup() is not + * NULL only if the server has answered our call. The value + * of HOST should be preserved for reporting inside login(), + * which also detects a correct stanza of the netrc file. + */ + if (hookup (host, port)) { int overbose;