]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
For anonymous ftp, make sure local hostname is fully qualified.
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 4 May 1995 15:02:18 +0000 (15:02 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 4 May 1995 15:02:18 +0000 (15:02 +0000)
Lib/ftplib.py

index 7a414e6882a98a0f4604d273cac5ce21be750a6b..a25d467cb156589c0af7d36a402faeaf79389b12 100644 (file)
@@ -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']