Skip to content
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

paramiko 1.16 error in _winapi.py #613

Closed
hobbsd opened this issue Nov 6, 2015 · 16 comments
Closed

paramiko 1.16 error in _winapi.py #613

hobbsd opened this issue Nov 6, 2015 · 16 comments

Comments

@hobbsd
Copy link

hobbsd commented Nov 6, 2015

Here's the end of the traceback:

...\paramiko\_winapi.py", line 162, in write
ctypes.windll.kernel32.RtlMoveMemory(dest, msg, length)
ValueError: Procedure probably called with too many arguments (4 bytes in excess)

Using Python 2.7 on Windows 7.

@bitprophet
Copy link
Member

Paging Dr @jaraco, Dr @jaraco to aisle 613. Hoping I just made some stupid merge error in that module or something?

@jaraco
Copy link
Contributor

jaraco commented Nov 9, 2015

The error message strikes me as something I've seen before, but I don't recall exactly what the issue is. That call in particular is tested in test_mmap and passes on Python 2.7 on Windows 10. I'll keep looking.

@jaraco
Copy link
Contributor

jaraco commented Nov 9, 2015

I just tested with Paramiko 1.16.0 and I was able to establish a connection using Python 2.7.10 64-bit and Pageant 0.65 64-bit on Windows 10 64-bit.

@hobbsd Can you tell me more about your environment - what versions (and bit size) of Windows, Putty, and Python are you using?

@hobbsd
Copy link
Author

hobbsd commented Nov 9, 2015

I'm using Python 2.7.9 32-bit on Windows 7 64-bit with Putty 0.65.

@jaraco
Copy link
Contributor

jaraco commented Nov 10, 2015

The error seems to be unique to 32-bit Python. I'll devise a fix. In the meantime, I suspect you'll have success with 64-bit Python.

@dkmstr
Copy link

dkmstr commented Nov 12, 2015

Changing the MemoryMap class, the read & write methods as you refer in the reference, it works fine!!
I had the same issue on a machine, an after changing
length = ctypes.wintypes.SIZE(n)
by
length = ctypes.c_size_t(n)
in both read & write method, now paramiko works perfectly :-)

Thanks for the references and your good work!!

dkmstr added a commit to VirtualCable/openuds that referenced this issue Nov 12, 2015
@rockwelln
Copy link

I had the same issue with Python 3.4 32bits on Windows7.
I applied the same fix on "length = ctypes.wintypes.SIZE(n)" in read and right method.
It works great now. Thank you @dkmstr

@StdioA
Copy link

StdioA commented Dec 9, 2015

Had the same issue with Python 2.7 32bits on Windows 10 Build 10576.
Maybe the api changes after the Windows upgrades from 10240 to 10576, so that the function RtlMoveMemory failed.
Here's the traceback:

File "C:\Python27\lib\site-packages\paramiko_winapi.py", line 162, in write
ctypes.windll.kernel32.RtlMoveMemory(dest, msg, length)
ValueError: Procedure probably called with too many arguments (4 bytes in excess)

@bitprophet
Copy link
Member

Not sure why I didn't close this to merge w/ the PR, doing that now. Please follow #619. It's part of the next bugfix milestone!

@jameshume
Copy link

Phew... that fixed it for me running on windows XP. A big thank you to you!!

@DrayChou
Copy link

I'm using Python 2.7.11 32-bit on Windows 7 64-bit.
and I applied the same fix on "length = ctypes.wintypes.SIZE(n)" in read and right method.
It works great now. Thank you @dkmstr

Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 801, in *bootstrap_inner
self.run()
File "C:\Python27\lib\threading.py", line 754, in run
self.__target(_self.__args, _self.__kwargs)
File "main.py", line 15, in ssh2
ssh.connect(ip,22,username,passwd,timeout=5)
File "C:\Python27\lib\site-packages\paramiko\client.py", line 367, in connect
look_for_keys, gss_auth, gss_kex, gss_deleg_creds, gss_host)
File "C:\Python27\lib\site-packages\paramiko\client.py", line 517, in _auth
self._agent = Agent()
File "C:\Python27\lib\site-packages\paramiko\agent.py", line 363, in __init

self._connect(conn)
File "C:\Python27\lib\site-packages\paramiko\agent.py", line 66, in _connect
ptype, result = self._send_message(cSSH2_AGENTC_REQUEST_IDENTITIES)
File "C:\Python27\lib\site-packages\paramiko\agent.py", line 83, in _send_message
self._conn.send(struct.pack('>I', len(msg)) + msg)
File "C:\Python27\lib\site-packages\paramiko\win_pageant.py", line 123, in send
self._response = _query_pageant(data)
File "C:\Python27\lib\site-packages\paramiko\win_pageant.py", line 92, in _query_pageant
pymap.write(msg)
File "C:\Python27\lib\site-packages\paramiko_winapi.py", line 162, in write
ctypes.windll.kernel32.RtlMoveMemory(dest, msg, length)
ValueError: Procedure probably called with too many arguments (4 bytes in excess)

@zapu
Copy link

zapu commented Mar 4, 2016

Same issue, the fix mentioned helped.

I'm using fabric on Windows 7, with Python 2.7. My packages are installed with pip, apart from pycrypto, which I got from http://www.voidspace.org.uk/python/modules.shtml#pycrypto Is the version 1.16.0 (with the bug described in this issue) the last version for this Python or am I missing something? Thanks.

@dmikov
Copy link

dmikov commented Mar 15, 2016

Any eta on fix? I cannot go and change ctype ine on my machine. Our clients download pip at there premises so I cannot fix it on hundreds of servers.

@Dagur
Copy link

Dagur commented Apr 6, 2016

@zapu I have the same setup. Reverting back to paramiko 1.15.4 fixed the error for me

@ArmanFazylov
Copy link

@Dagur tnx for help! Fixed for me too

bitprophet added a commit that referenced this issue Apr 24, 2016
@bitprophet
Copy link
Member

#619 is merged, expect release of 1.16.1 soon.

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

No branches or pull requests