Merge branch 'banner-functionality'

This commit is contained in:
Jeff Forcier 2014-02-11 15:11:23 -08:00
commit 40708571bc
4 changed files with 17 additions and 1 deletions

View File

@ -7,4 +7,4 @@ invoke>=0.7.0
invocations>=0.4.4
sphinx>=1.1.3
alabaster>=0.3.0
releases>=0.5.0
releases>=0.5.1

View File

@ -45,6 +45,7 @@ class AuthHandler (object):
self.authenticated = False
self.auth_event = None
self.auth_method = ''
self.banner = None
self.password = None
self.private_key = None
self.interactive_handler = None
@ -375,6 +376,7 @@ class AuthHandler (object):
def _parse_userauth_banner(self, m):
banner = m.get_string()
self.banner = banner
lang = m.get_string()
self.transport._log(INFO, 'Auth banner: ' + banner)
# who cares.

View File

@ -1092,6 +1092,18 @@ class Transport (threading.Thread):
return None
return self.auth_handler.get_username()
def get_banner(self):
"""
Return the banner supplied by the server upon connect. If no banner is
supplied, this method returns C{None}.
@return: server supplied banner, or C{None}.
@rtype: string
"""
if not self.active or (self.auth_handler is None):
return None
return self.auth_handler.banner
def auth_none(self, username):
"""
Try to authenticate to the server using no authentication at all.

View File

@ -2,6 +2,8 @@
Changelog
=========
* :feature:`58` Allow client code to access the stored SSH server banner via
``Transport.get_banner()``. Thanks to ``@Jhoanor`` for the patch.
* :bug:`34` (PR :issue:`35`) Fix SFTP prefetching incompatibility with some
SFTP servers regarding request/response ordering. Thanks to Richard
Kettlewell for catch & patch.