New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix win_pageant for Python 3 #320

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
6 participants
@sherbang

sherbang commented Apr 29, 2014

Previously _get_pageant_window_object always returned 0, so pageant was silently ignored.

@sherbang

This comment has been minimized.

sherbang commented Apr 29, 2014

#56 might be related. Without this patch then pageant definitely doesn't work under Python 3, but #56 doesn't specify which python version.

@ThiefMaster

This comment has been minimized.

Contributor

ThiefMaster commented May 10, 2014

👍, works fine on Python 3.4

Fix win_pageant for Python 3
Previously _get_pageant_window_object always returned 0, so pageant was silently ignored.
@coveralls

This comment has been minimized.

coveralls commented May 30, 2014

Coverage Status

Coverage decreased (-0.12%) when pulling 7461738 on sherbang:patch-1 into e811e71 on paramiko:master.

@adamkerz

This comment has been minimized.

adamkerz commented Sep 27, 2014

+1 This is a fix for me too. Tested with 1.15.1

Not sure how this will affect a python2.6 install though.

@bitprophet

This comment has been minimized.

Member

bitprophet commented Sep 29, 2014

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!

@ThiefMaster

This comment has been minimized.

Contributor

ThiefMaster commented Sep 29, 2014

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?

@bitprophet

This comment has been minimized.

Member

bitprophet commented Sep 29, 2014

@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.

@adamkerz

This comment has been minimized.

adamkerz commented Oct 1, 2014

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)?

@lndbrg

This comment has been minimized.

Contributor

lndbrg commented Oct 1, 2014

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.

@adamkerz

This comment has been minimized.

adamkerz commented Oct 1, 2014

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 @@
 import platform
 import struct
 from paramiko.util import *
+from paramiko.py3compat import b

 try:
     import _thread as thread # Python 3.x
@@ -43,7 +44,7 @@


 def _get_pageant_window_object():
-    return ctypes.windll.user32.FindWindowA('Pageant', 'Pageant')
+    return ctypes.windll.user32.FindWindowA(b('Pageant'), b('Pageant'))


 def can_talk_to_agent():
@@ -90,7 +91,7 @@
     with pymap:
         pymap.write(msg)
         # 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!

@lndbrg

This comment has been minimized.

Contributor

lndbrg commented Oct 1, 2014

Created a real PR from the patch.

@bitprophet

This comment has been minimized.

Member

bitprophet commented Oct 1, 2014

Rolling into that PR, thanks as usual @lndbrg!

@bitprophet bitprophet closed this Oct 1, 2014

lndbrg added a commit that referenced this pull request Oct 1, 2014

bitprophet added a commit that referenced this pull request Oct 1, 2014

Changelog re #320
Closes #409

@sherbang sherbang deleted the sherbang:patch-1 branch Oct 2, 2014

dkhapun pushed a commit to cyberx-labs/paramiko that referenced this pull request Jun 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment