From c0ef3fd4936984be100f9a4738c89b02344ff141 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 23 Nov 2012 14:08:16 -0500 Subject: [PATCH] Create the memory map with the security attributes for the current user (rather than the default) to avoid permissions failures when the client and the agent run in different UAC contexts. Fixes #98. --- paramiko/win_pageant.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paramiko/win_pageant.py b/paramiko/win_pageant.py index 0410a99..7f354d2 100644 --- a/paramiko/win_pageant.py +++ b/paramiko/win_pageant.py @@ -27,6 +27,7 @@ import array import platform import ctypes.wintypes +import jaraco.windows.security as security import jaraco.windows.mmap as mmap _AGENT_COPYDATA_ID = 0x804e50ba @@ -74,7 +75,9 @@ def _query_pageant(msg): # create a name for the mmap map_name = 'PageantRequest%08x' % threading.current_thread().ident - pymap = mmap.MemoryMap(map_name, _AGENT_MAX_MSGLEN) + pymap = mmap.MemoryMap(map_name, _AGENT_MAX_MSGLEN, + security.get_security_attributes_for_user(), + ) with pymap: pymap.write(msg) # Create an array buffer containing the mapped filename