�
=OXc@sdZddlZddlZddlZddlZddlTddlmZyddl Z
Wnek
rddl
Z
nXddlm
Z
dZdZd Zd
�Zd�Zej�dd
kr�ejnejZdejfd��YZd�Zdefd��YZdS(sP
Functions for communicating with Pageant, the basic windows ssh agent program.
i����N(t*(tbi(t_winapil�P�i iJcCs"tjjjtd�td��S(NtPageant(tctypestwindlltuser32tFindWindowAR(((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyt_get_pageant_window_object.scCs
tt��S(s�
Check to see if there is a "Pageant" agent we can talk to.
This checks both if we have the required libraries (win32all or ctypes)
and if there is a Pageant currently running.
(tboolR(((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pytcan_talk_to_agent2sit64bittCOPYDATASTRUCTcBs8eZdZdefdejjfdejfgZRS(sy
ctypes implementation of
http://msdn.microsoft.com/en-us/library/windows/desktop/ms649010%28v=vs.85%29.aspx
tnum_datat data_sizetdata_loc( t__name__t
__module__t__doc__t ULONG_PTRRtwintypestDWORDtc_void_pt_fields_(((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyR?s c
Cst�}|sdSdtj�}tj|ttj��}|��|j|�t j dt
|�t�}|j�\}}t
t||�}tjjj|ttj|�tj|��}|dkr|jd�|jd�} tjd| �d}
| |j|
�SdSWdQXdS(sa
Communication with the Pageant process is done through a shared
memory-mapped file.
sPageantRequest%08xRiis>IN(RtNonetthreadt get_identRt MemoryMapt_AGENT_MAX_MSGLENt get_security_attributes_for_usertwritetarrayRt zero_bytetbuffer_infoRt_AGENT_COPYDATA_IDRRRtSendMessageAtwin32con_WM_COPYDATAtsizeoftbyreftseektreadtstructtunpack(tmsgthwndtmap_nametpymaptchar_buffertchar_buffer_addresstchar_buffer_sizetcdstresponsetdatalentretlen((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyt_query_pageantKs(
!
tPageantConnectioncBs2eZdZd�Zd�Zd�Zd�ZRS(s
Mock "connection" to an agent which roughly approximates the behavior of
a unix local-domain socket (as used by Agent). Requests are sent to the
pageant daemon via special Windows magick, and responses are buffered back
for subsequent reads.
cCs
d|_dS(N(Rt _response(tself((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyt__init__wscCst|�|_dS(N(R6R8(R9tdata((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pytsendzscCsO|jdkrdS|j| }|j||_|jdkrKd|_n|S(Nt(R8R(R9tntret((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pytrecv}s
cCsdS(N((R9((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pytclose�s(RRRR:R<R@RA(((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyR7os
(RRtctypes.wintypesRtplatformR)t
paramiko.utiltparamiko.py3compatRt_threadRtImportErrorR=RR"RR$RR
tarchitecturetc_uint64tc_uint32Rt StructureRR6tobjectR7(((s8/usr/lib/python2.7/site-packages/paramiko/win_pageant.pyt<module>s(
( $ |