For anonymous ftp, make sure local hostname is fully qualified.

This commit is contained in:
Jack Jansen 1995-05-04 15:02:18 +00:00
parent 009e79bf02
commit 2db6bfcd1d
1 changed files with 4 additions and 0 deletions

View 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']