summaryrefslogtreecommitdiffstats
path: root/Lib/ftplib.py
diff options
context:
space:
mode:
authorPeter Schneider-Kamp <nowonder@nowonder.de>2000-08-16 20:30:21 (GMT)
committerPeter Schneider-Kamp <nowonder@nowonder.de>2000-08-16 20:30:21 (GMT)
commit2d2785aad1ad7e7ea565a58187b2d1a0efa0ea54 (patch)
tree780c831d42641790e801131d8d0ac706836487c6 /Lib/ftplib.py
parent77c9f50422833829fe1c001831f778e4fcd512df (diff)
downloadcpython-2d2785aad1ad7e7ea565a58187b2d1a0efa0ea54.zip
cpython-2d2785aad1ad7e7ea565a58187b2d1a0efa0ea54.tar.gz
cpython-2d2785aad1ad7e7ea565a58187b2d1a0efa0ea54.tar.bz2
updated occurences of fqdn algorithm (closes patch #101197)
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r--Lib/ftplib.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index fd9127b..41c3b33 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -41,7 +41,8 @@ import string
# Import SOCKS module if it exists, else standard socket module socket
try:
- import SOCKS; socket = SOCKS
+ import SOCKS; socket = SOCKS; del SOCKS # import SOCKS as socket
+ from socket import getfqdn; socket.getfqdn = getfqdn; del getfqdn
except ImportError:
import socket
@@ -291,17 +292,8 @@ class FTP:
if not passwd: passwd = ''
if not acct: acct = ''
if user == 'anonymous' and passwd in ('', '-'):
- thishost = socket.gethostname()
- # Make sure it is fully qualified
- if not '.' in thishost:
- thisaddr = socket.gethostbyname(thishost)
- firstname, names, unused = \
- socket.gethostbyaddr(thisaddr)
- names.insert(0, firstname)
- for name in names:
- if '.' in name:
- thishost = name
- break
+ # get fully qualified domain name of local host
+ thishost = socket.getfqdn()
try:
if os.environ.has_key('LOGNAME'):
realuser = os.environ['LOGNAME']