summaryrefslogtreecommitdiff
path: root/Lib/ftplib.py
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-05-04 15:02:18 +0000
committerJack Jansen <jack.jansen@cwi.nl>1995-05-04 15:02:18 +0000
commitd0e38b479afc30974f1d13a982169c797fec9ac3 (patch)
tree246b6f48c591bdb8aab28013738c76a982951aea /Lib/ftplib.py
parent134e892aa4eb16cd69a09e8b97e68faa62b6dbc5 (diff)
downloadcpython-d0e38b479afc30974f1d13a982169c797fec9ac3.tar.gz
For anonymous ftp, make sure local hostname is fully qualified.
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r--Lib/ftplib.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 7a414e6882..a25d467cb1 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']