summaryrefslogtreecommitdiffstats
path: root/Lib/netrc.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-04-24 20:11:20 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-04-24 20:11:20 (GMT)
commitb34ef94d460ec0dcf8bdd12da8834bf097f826f6 (patch)
tree51242a208c53f582ac0beb68fe45eade7fb702a6 /Lib/netrc.py
parentbfcbfa7c46fce54616b8b71ab27472da16759bf0 (diff)
downloadcpython-b34ef94d460ec0dcf8bdd12da8834bf097f826f6.zip
cpython-b34ef94d460ec0dcf8bdd12da8834bf097f826f6.tar.gz
cpython-b34ef94d460ec0dcf8bdd12da8834bf097f826f6.tar.bz2
SF bug 557704: netrc module can't handle all passwords
Let netrc handle entries with login fields (mail servers for instance) by having login default to ''. Backport candidate.
Diffstat (limited to 'Lib/netrc.py')
-rw-r--r--Lib/netrc.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/netrc.py b/Lib/netrc.py
index 1d65dbe..5493d77 100644
--- a/Lib/netrc.py
+++ b/Lib/netrc.py
@@ -56,13 +56,14 @@ class netrc:
"bad toplevel token %r" % tt, file, lexer.lineno)
# We're looking at start of an entry for a named machine or default.
- login = account = password = None
+ login = ''
+ account = password = None
self.hosts[entryname] = {}
while 1:
tt = lexer.get_token()
if (tt=='' or tt == 'machine' or
tt == 'default' or tt =='macdef'):
- if login and password:
+ if password:
self.hosts[entryname] = (login, account, password)
lexer.push_token(tt)
break