[issue557704] netrc module can't handle all passwords

2016-11-10 Thread Cristian Măgherușan-Stanciu

Cristian Măgherușan-Stanciu added the comment:

Is there anything blocking this from being really fixed? It's still broken on 
3.5.

The patch added two years ago works well for quoted passwords, I think that's 
good enough, anyway having some support is much better than the current out of 
the box situation.

--
versions: +Python 3.5 -Python 2.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue557704] netrc module can't handle all passwords

2016-01-18 Thread R. David Murray

R. David Murray added the comment:

If it is a matter of following "the normal rules" about quoting in a place 
where we currently don't do that, I think it would be sensible to add it, but 
IMO it should be the full set of "normal rules".  Presumably shlex provides 
facilities to do that...I haven't looked at the netrc code in quite a while so 
I don't remember how it all fits together.

As for reopening the issue...there was something that was fixed here, so what 
we should do instead is open a new issue with your documentation about current 
reality, a quick summary of this discussion, and a mention of this issue as 
part of the backstory.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue557704] netrc module can't handle all passwords

2016-01-17 Thread Martin Dengler

Martin Dengler added the comment:

Bram's patch for "special" characters is in, mine is the one that allows spaces 
in .netrc by enabling the parsing of a password field's value that's surrounded 
by lexer.quotes ( https://hg.python.org/cpython/file/2.7/Lib/shlex.py#l45 ).

This is not the same as Perl's approach (parse the file in a 
quoted-character-aware way, so quoted spaces don't separate tokens), but was 
much simpler to implement.

So, in effect, there are no general support for quoting introduced by my patch, 
only a special case for supporting the entire contents of the password field to 
be surrounded by the shlex.quote characters.

Would you accept a different (longer, more involved) patch to implement the 
arbitrary quoting of characters, or an update to this patch to document how the 
password field is treated and which characters can surround it?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue557704] netrc module can't handle all passwords

2016-01-17 Thread Martin Dengler

Martin Dengler added the comment:

Anecdotal ( http://stackoverflow.com/a/12675195/2747741 ) evidence suggests 
other programs do indeed accept spaces, and a cursory browsing of the Perl 
source code ( 
http://perl5.git.perl.org/perl.git/blob/HEAD:/cpan/libnet/lib/Net/Netrc.pm#l120 
) indicates Perl at least supports (escaped) spaces in .netrc passwords.

Is there anything that I could do to make the patch I provided acceptable?

If not, could the bug be reopened as 1) the bug description mentions a valid 
use case that is not handled by the netrc module; and 2) there is precedent for 
this use case's implementation in other software.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue557704] netrc module can't handle all passwords

2016-01-17 Thread Guido van Rossum

Guido van Rossum added the comment:

(Hi Bram! :-)

So does your patch also accept escaped spaces? I wonder if one of the problems 
here may not be that the syntax required to escape special characters isn't 
specified? That might be acceptable in 2003, not so much in 2016.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue557704] netrc module can't handle all passwords

2015-12-18 Thread R. David Murray

R. David Murray added the comment:

To clarify: other FTP programs handling passwords with spaces *in the .netrc 
file*.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue557704] netrc module can't handle all passwords

2015-12-18 Thread R. David Murray

R. David Murray added the comment:

This issue was closed because other FTP programs also did not handle passwords 
with spaces.  If this has subsequently changed (passwords with spaces are now 
widely accepted by other FTP programs) then the issue could be reopened.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue557704] netrc module can't handle all passwords

2015-11-16 Thread Cristian Măgherușan-Stanciu

Cristian Măgherușan-Stanciu added the comment:

Why is this issue fixed? I still see this problem on 2.7 and 3.4.3.

Can someone please reopen it?

mdengler's patch seems to work fine on my machine on both 2.7 and 3.4.3.

--
nosy: +Cristian Măgherușan-Stanciu

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue557704] netrc module can't handle all passwords

2014-10-09 Thread Martin Dengler

Martin Dengler added the comment:

I know this is ancient, but the below patch handles spaces in passwords in 
2.7.8 and 3.4 for me.  If this is worth making into a new bug / proper patch 
I'm happy to do it.

$ diff -uw /c/Python278/Lib/netrc.py{-orig,}
--- /c/Python278/Lib/netrc.py-orig  2014-10-09 13:52:36.995286000 +0100
+++ /c/Python278/Lib/netrc.py   2014-10-09 13:53:05.041286000 +0100
@@ -111,7 +111,23 @@
~/.netrc access too permissive: access
 permissions must restrict access to only
 the owner, file, lexer.lineno)
+# handle passwords with quoted spaces
+quote_chars = lexer.quotes
+removed_chars = []
+for quote_char in quote_chars:
+if quote_char in lexer.wordchars:
+lexer.wordchars = 
lexer.wordchars.replace(quote_char, '')
+removed_chars.append(quote_char)
+try:
+
 password = lexer.get_token()
+
+for quote_char in quote_chars:
+if password.startswith(quote_char) and 
password.endswith(quote_char):
+password = password[1:-1]
+finally:
+for removed_char in removed_chars:
+lexer.wordchars += removed_char
 else:
 raise NetrcParseError(bad follower token %r % tt,
   file, lexer.lineno)

--
nosy: +mdengler

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue557704
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue557704] netrc module can't handle all passwords

2014-10-09 Thread Martin Dengler

Martin Dengler added the comment:

Sorry for the whitespace-unaware diff.  The attached patch is the real one, 
with the obvious extra level of indentation around the critical password = 
lexer.get_token() line.

--
keywords: +patch
Added file: 
http://bugs.python.org/file36851/python-netrc-password-spaces-bug-557704.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue557704
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com