From 5407b1a27468d5abedde93b51aad5bd97bd046c4 Mon Sep 17 00:00:00 2001 From: Sebastian Deiss Date: Mon, 17 Mar 2014 13:50:13 +0100 Subject: Add a flag to check if GSS-API / SSPI is available. --- paramiko/__init__.py | 2 +- paramiko/ssh_gss.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/paramiko/__init__.py b/paramiko/__init__.py index 51329271..8304cf6d 100644 --- a/paramiko/__init__.py +++ b/paramiko/__init__.py @@ -65,7 +65,7 @@ __license__ = "GNU Lesser General Public License (LGPL)" from paramiko.transport import SecurityOptions, Transport from paramiko.client import SSHClient, MissingHostKeyPolicy, AutoAddPolicy, RejectPolicy, WarningPolicy from paramiko.auth_handler import AuthHandler -from paramiko.ssh_gss import GSSAuth +from paramiko.ssh_gss import GSSAuth, GSS_AUTH_AVAILABLE from paramiko.channel import Channel, ChannelFile from paramiko.ssh_exception import SSHException, PasswordRequiredException, \ BadAuthenticationType, ChannelException, BadHostKeyException, \ diff --git a/paramiko/ssh_gss.py b/paramiko/ssh_gss.py index 417dab6e..d4b897a7 100644 --- a/paramiko/ssh_gss.py +++ b/paramiko/ssh_gss.py @@ -45,10 +45,19 @@ Created on 07.11.2013 import struct import os import sys + +''' +@var GSS_AUTH_AVAILABLE: Constraint that indicates if GSS-API / SSPI is + Available. +@type GSS_AUTH_AVAILABLE: Boolean +''' +GSS_AUTH_AVAILABLE = True + try: from pyasn1.type.univ import ObjectIdentifier from pyasn1.codec.der import encoder, decoder except ImportError: + GSS_AUTH_AVAILABLE = False class ObjectIdentifier(object): def __init__(self, *args): raise NotImplementedError("Module pyasn1 not importable") @@ -61,7 +70,7 @@ from paramiko.common import MSG_USERAUTH_REQUEST from paramiko.ssh_exception import SSHException """ -@var _API: constraint for the used API +@var _API: Constraint for the used API @type _API: String """ _API = "MIT" @@ -74,6 +83,7 @@ except ImportError: import sspi _API = "SSPI" except ImportError: + GSS_AUTH_AVAILABLE = False _API = None -- cgit v1.2.3