summaryrefslogtreecommitdiffstats
path: root/Lib/ftplib.py
diff options
context:
space:
mode:
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 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']