summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-05-04 15:02:18 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-05-04 15:02:18 (GMT)
commit2db6bfcd1d08e6d596671db00fff7af98cae645e (patch)
treee33b077552c11fa1f5a2eac501b23b9b9584d644 /Lib
parent009e79bf027b61ab03a3d05aa85c6ec74f74fee6 (diff)
downloadcpython-2db6bfcd1d08e6d596671db00fff7af98cae645e.zip
cpython-2db6bfcd1d08e6d596671db00fff7af98cae645e.tar.gz
cpython-2db6bfcd1d08e6d596671db00fff7af98cae645e.tar.bz2
For anonymous ftp, make sure local hostname is fully qualified.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ftplib.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 7a414e6..a25d467 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']