Commit b34ef94d authored by Raymond Hettinger's avatar Raymond Hettinger

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.
parent bfcbfa7c
...@@ -56,13 +56,14 @@ class netrc: ...@@ -56,13 +56,14 @@ class netrc:
"bad toplevel token %r" % tt, file, lexer.lineno) "bad toplevel token %r" % tt, file, lexer.lineno)
# We're looking at start of an entry for a named machine or default. # 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] = {} self.hosts[entryname] = {}
while 1: while 1:
tt = lexer.get_token() tt = lexer.get_token()
if (tt=='' or tt == 'machine' or if (tt=='' or tt == 'machine' or
tt == 'default' or tt =='macdef'): tt == 'default' or tt =='macdef'):
if login and password: if password:
self.hosts[entryname] = (login, account, password) self.hosts[entryname] = (login, account, password)
lexer.push_token(tt) lexer.push_token(tt)
break break
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment