]> granicus.if.org Git - python/commitdiff
SF bug 557704: netrc module can't handle all passwords
authorRaymond Hettinger <python@rcn.com>
Thu, 24 Apr 2003 20:11:20 +0000 (20:11 +0000)
committerRaymond Hettinger <python@rcn.com>
Thu, 24 Apr 2003 20:11:20 +0000 (20:11 +0000)
Let netrc handle entries with login fields (mail servers for instance)
by having login default to ''.

Backport candidate.

Lib/netrc.py

index 1d65dbeb895bf43091e86b50958c279458f237e1..5493d77d3e805da491b365dc8f1b246fe8d3eefe 100644 (file)
@@ -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