ssh agent support

John Arbash Meinel john at arbash-meinel.com
Thu Dec 8 22:19:46 GMT 2005


John Arbash Meinel wrote:
> Robey Pointer wrote:
> 
> ...
> 
>>> Can you post a location where to find the sources in case I want to come
>>> back and look at it?
>> I forgot who sent it to me originally -- whoever it was, thank you! :)
>>
>> I reposted it here:
>>     http://www.lag.net/paramiko/winpgnt.c
>>
>> robey
>>
>>
> 
> Well, I'm looking at it, and it doesn't seem that tricky if you aren't
> trying to do the Async stuff (which they seemed to recommend against).
> 
> It first gets a handle to the Pageant window using FindWindow.
> Then it creates a named memory map (similar to mmap, just
> CreateFileMapping without actually giving a file to map).
> It then writes the IN message to this file, and uses SendMessage to send
> the WM_COPYDATA message, to tell Pageant to run the AGENT_COPYDATA_ID
> function the name of the mapped file.
> I assume that the Pageant code checks for a WM_COPYDATA message, and the
> AGENT_COPYDATA_ID opens the named memory map, reads the data from it,
> and then writes back the response.
> 
> Just to say it isn't terrible, though it is completely win32 specific.
> I'm looking through the win32all stuff to see if all of the functions
> are available. (FindWindow, and SendMessage are, but I haven't found
> COPYDATASTRUCT, which might be in ctypes, etc).
> 
> Which means that on Windows you could have paramiko see if win32all is
> installed, and if so, then it could check to see if Pageant was running.
> 
> I've decided to look into it a bit deeper. I might actually get somewhere.

Attached is a rough draft of converting the C code that you had into
python, using win32all and ctypes.

I think it is valid, but I don't know what messages are sent back and
forth to Pageant. It might be the same messages that are written to a
normal ssh-agent, but I can't really test it without knowing for sure.

Anyway, I thought I would post it, in case someone else gets a chance to
take up the torch. I have to work on other things now.

John
=:->

> 
> John
> =:->
> 
> 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pageant_support.py
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20051208/e51edd72/attachment.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051208/e51edd72/attachment.pgp 


More information about the bazaar mailing list