Previously _get_pageant_window_object always returned 0, so pageant was silently ignored.
#56 might be related. Without this patch then pageant definitely doesn't work under Python 3, but #56 doesn't specify which python version.
👍, works fine on Python 3.4
Fix win_pageant for Python 3
Coverage decreased (-0.12%) when pulling 7461738 on sherbang:patch-1 into e811e71 on paramiko:master.
+1 This is a fix for me too. Tested with 1.15.1
Not sure how this will affect a python2.6 install though.
I don't Python on Windows but yea, we still need to support Python 2.6 (@adamkerz). Should hopefully be as simple as importing the relevant bits from paramiko.py3compat (mostly b() and whatever array operation is most appropriate).
I'll merge this once somebody can +1 a version of the patch that works on 2.6 through 3.4. Thanks!
Ugh, why do people still use and/or care about 2.6? Especially on windows where there are no "enterprisey" distributions forcing you to use ancient versions?
@ThiefMaster There are still plenty of people downloading Python packages on 2.6 according to stats I've seen from PyPI, and a number of stable Linux distributions still in heavy use like CentOS 5/6 also still use them. It's also very little extra work re: 2+3 support, over 2.7.
OK, tested with Python 2.6.6, 2.7.6 and 3.4.1. Patch against Paramiko 1.15.1.
Hmm, am I able to upload a patch here? Or do I need to do the GIT push/pull thing (I'm not a GIT user yet)?
It would be preferable to do a pull request. But if you just have the diff of your changes you can add them as a comment.
OK, in the interest of getting this in, I'll comment the diff. I have a feature to add to fabric (user/group for the put operation) that I will use as a task to get my self "git" sorted.
--- win_pageant.py.old Wed Oct 01 13:45:59 2014
+++ win_pageant.py Wed Oct 01 13:12:50 2014
@@ -26,6 +26,7 @@
from paramiko.util import *
+from paramiko.py3compat import b
import _thread as thread # Python 3.x
@@ -43,7 +44,7 @@
- return ctypes.windll.user32.FindWindowA('Pageant', 'Pageant')
+ return ctypes.windll.user32.FindWindowA(b('Pageant'), b('Pageant'))
@@ -90,7 +91,7 @@
# Create an array buffer containing the mapped filename
- char_buffer = array.array("c", b(map_name) + zero_byte)
+ char_buffer = array.array("b", b(map_name) + zero_byte)
char_buffer_address, char_buffer_size = char_buffer.buffer_info()
# Create a string to use for the SendMessage function call
cds = COPYDATASTRUCT(_AGENT_COPYDATA_ID, char_buffer_size,
Thanks for accepting it in a less desirable way!
Created a real PR from the patch.
Rolling into that PR, thanks as usual @lndbrg!
Make sure we pass parameters as binary on windows.
This fixes #320 (thanks @adamkerz).
Changelog re #320