summaryrefslogtreecommitdiffstats
path: root/Lib/ftplib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r--Lib/ftplib.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index a176a87..cf1f32f 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -351,19 +351,14 @@ class FTP:
if not passwd: passwd = ''
if not acct: acct = ''
if user == 'anonymous' and passwd in ('', '-'):
- # get fully qualified domain name of local host
- thishost = socket.getfqdn()
- try:
- if os.environ.has_key('LOGNAME'):
- realuser = os.environ['LOGNAME']
- elif os.environ.has_key('USER'):
- realuser = os.environ['USER']
- else:
- realuser = 'anonymous'
- except AttributeError:
- # Not all systems have os.environ....
- realuser = 'anonymous'
- passwd = passwd + realuser + '@' + thishost
+ # If there is no anonymous ftp password specified
+ # then we'll just use anonymous@
+ # We don't send any other thing because:
+ # - We want to remain anonymous
+ # - We want to stop SPAM
+ # - We don't want to let ftp sites to discriminate by the user,
+ # host or country.
+ passwd = passwd + 'anonymous@'
resp = self.sendcmd('USER ' + user)
if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd)
if resp[0] == '3': resp = self.sendcmd('ACCT ' + acct)