From: Jack Jansen Date: Thu, 4 May 1995 15:02:18 +0000 (+0000) Subject: For anonymous ftp, make sure local hostname is fully qualified. X-Git-Tag: v1.3b1~313 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2db6bfcd1d08e6d596671db00fff7af98cae645e;p=thirdparty%2FPython%2Fcpython.git For anonymous ftp, make sure local hostname is fully qualified. --- diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 7a414e6882a9..a25d467cb156 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']