From d32d457775224c7afa12456810603def13bdc6a6 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 20 Jan 2014 22:47:04 +0200 Subject: Fix agent auth on Windows/Python 2.5) (with thanks to @lndbrg) --- paramiko/_winapi.py | 7 ++++++- paramiko/win_pageant.py | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/paramiko/_winapi.py b/paramiko/_winapi.py index 9af8adde..b8759245 100644 --- a/paramiko/_winapi.py +++ b/paramiko/_winapi.py @@ -10,6 +10,11 @@ import ctypes import ctypes.wintypes import __builtin__ +try: + USHORT = ctypes.wintypes.USHORT +except AttributeError: + USHORT = ctypes.c_ushort + ###################### # jaraco.windows.error @@ -173,7 +178,7 @@ class SECURITY_DESCRIPTOR(ctypes.Structure): PACL Dacl; } SECURITY_DESCRIPTOR; """ - SECURITY_DESCRIPTOR_CONTROL = ctypes.wintypes.USHORT + SECURITY_DESCRIPTOR_CONTROL = USHORT REVISION = 1 _fields_ = [ diff --git a/paramiko/win_pageant.py b/paramiko/win_pageant.py index de1cd64b..a7aea87b 100644 --- a/paramiko/win_pageant.py +++ b/paramiko/win_pageant.py @@ -23,11 +23,11 @@ Functions for communicating with Pageant, the basic windows ssh agent program. from __future__ import with_statement -import struct -import threading import array -import platform import ctypes.wintypes +import platform +import struct +import thread from . import _winapi @@ -74,7 +74,7 @@ def _query_pageant(msg): return None # create a name for the mmap - map_name = 'PageantRequest%08x' % threading.current_thread().ident + map_name = 'PageantRequest%08x' % thread.get_ident() pymap = _winapi.MemoryMap(map_name, _AGENT_MAX_MSGLEN, _winapi.get_security_attributes_for_user(), -- cgit v1.2.3