From 2db6bfcd1d08e6d596671db00fff7af98cae645e Mon Sep 17 00:00:00 2001 From: Jack Jansen Date: Thu, 4 May 1995 15:02:18 +0000 Subject: [PATCH] For anonymous ftp, make sure local hostname is fully qualified. --- Lib/ftplib.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 7a414e6882a..a25d467cb15 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -221,6 +221,10 @@ class FTP: if not user: user = 'anonymous' if user == 'anonymous' and passwd in ('', '-'): thishost = socket.gethostname() + # Make sure it is fully qualified + if not '.' in thishost: + thisaddr = socket.gethostbyname(thishost) + thishost = socket.gethostbyaddr(thisaddr)[0] try: if os.environ.has_key('LOGNAME'): realuser = os.environ['LOGNAME']