summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.rst2
-rw-r--r--paramiko/auth_handler.py13
-rw-r--r--paramiko/config.py4
-rw-r--r--sites/www/changelog.rst9
-rw-r--r--tests/test_util.py9
5 files changed, 25 insertions, 12 deletions
diff --git a/README.rst b/README.rst
index 601617e1..3ed9e7bc 100644
--- a/README.rst
+++ b/README.rst
@@ -11,7 +11,7 @@ Paramiko
:Paramiko: Python SSH module
:Copyright: Copyright (c) 2003-2009 Robey Pointer <robeypointer@gmail.com>
-:Copyright: Copyright (c) 2013-2015 Jeff Forcier <jeff@bitprophet.org>
+:Copyright: Copyright (c) 2013-2016 Jeff Forcier <jeff@bitprophet.org>
:License: `LGPL <https://www.gnu.org/copyleft/lesser.html>`_
:Homepage: http://www.paramiko.org/
:API docs: http://docs.paramiko.org
diff --git a/paramiko/auth_handler.py b/paramiko/auth_handler.py
index ef4a8c7e..38b23729 100644
--- a/paramiko/auth_handler.py
+++ b/paramiko/auth_handler.py
@@ -356,7 +356,7 @@ class AuthHandler (object):
m.add_string(p[0])
m.add_boolean(p[1])
self.transport._send_message(m)
-
+
def _parse_userauth_request(self, m):
if not self.transport.server_mode:
# er, uh... what?
@@ -495,8 +495,9 @@ class AuthHandler (object):
m.add_string(token)
self.transport._send_message(m)
else:
- raise SSHException("Client asked to handle paket %s"
- %MSG_NAMES[ptype])
+ result = AUTH_FAILED
+ self._send_auth_result(username, method, result)
+ return
# check MIC
ptype, m = self.transport.packetizer.read_message()
if ptype == MSG_USERAUTH_GSSAPI_MIC:
@@ -568,7 +569,7 @@ class AuthHandler (object):
lang = m.get_string()
self.transport._log(INFO, 'Auth banner: %s' % banner)
# who cares.
-
+
def _parse_userauth_info_request(self, m):
if self.auth_method != 'keyboard-interactive':
raise SSHException('Illegal info request from server')
@@ -580,14 +581,14 @@ class AuthHandler (object):
for i in range(prompts):
prompt_list.append((m.get_text(), m.get_boolean()))
response_list = self.interactive_handler(title, instructions, prompt_list)
-
+
m = Message()
m.add_byte(cMSG_USERAUTH_INFO_RESPONSE)
m.add_int(len(response_list))
for r in response_list:
m.add_string(r)
self.transport._send_message(m)
-
+
def _parse_userauth_info_response(self, m):
if not self.transport.server_mode:
raise SSHException('Illegal info response from server')
diff --git a/paramiko/config.py b/paramiko/config.py
index 0b1345fd..e18fa4bf 100644
--- a/paramiko/config.py
+++ b/paramiko/config.py
@@ -57,7 +57,9 @@ class SSHConfig (object):
"""
host = {"host": ['*'], "config": {}}
for line in file_obj:
- line = line.rstrip('\r\n').lstrip()
+ # Strip any leading or trailing whitespace from the line.
+ # See https://github.com/paramiko/paramiko/issues/499 for more info.
+ line = line.strip()
if not line or line.startswith('#'):
continue
diff --git a/sites/www/changelog.rst b/sites/www/changelog.rst
index 85fbe73e..6b30ff68 100644
--- a/sites/www/changelog.rst
+++ b/sites/www/changelog.rst
@@ -2,6 +2,15 @@
Changelog
=========
+* :support:`697` Remove whitespace in our ``setup.py``'s ``install_requires``
+ as it triggers occasional bugs in some versions of ``setuptools``. Thanks to
+ Justin Lecher for catch & original patch.
+* :bug:`499` Strip trailing/leading whitespace from lines when parsing SSH
+ config files - this brings things in line with OpenSSH behavior. Thanks to
+ Alfredo Esteban for the original report and Nick Pillitteri for the patch.
+* :bug:`652` Fix behavior of ``gssapi-with-mic`` auth requests so they fail
+ gracefully (allowing followup via other auth methods) instead of raising an
+ exception. Patch courtesy of ``@jamercee``.
* :feature:`588` Add missing file-like object methods for
`~paramiko.file.BufferedFile` and `~paramiko.sftp_file.SFTPFile`. Thanks to
Adam Meily for the patch.
diff --git a/tests/test_util.py b/tests/test_util.py
index bfdc525e..a6a2c30b 100644
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -30,6 +30,7 @@ import paramiko.util
from paramiko.util import lookup_ssh_host_config as host_config, safe_string
from paramiko.py3compat import StringIO, byte_ord, b
+# Note some lines in this configuration have trailing spaces on purpose
test_config_file = """\
Host *
User robey
@@ -110,7 +111,7 @@ class UtilTest(unittest.TestCase):
self.assertEqual(config._config,
[{'host': ['*'], 'config': {}}, {'host': ['*'], 'config': {'identityfile': ['~/.ssh/id_rsa'], 'user': 'robey'}},
{'host': ['*.example.com'], 'config': {'user': 'bjork', 'port': '3333'}},
- {'host': ['*'], 'config': {'crazy': 'something dumb '}},
+ {'host': ['*'], 'config': {'crazy': 'something dumb'}},
{'host': ['spoo.example.com'], 'config': {'crazy': 'something else'}}])
def test_3_host_config(self):
@@ -119,14 +120,14 @@ class UtilTest(unittest.TestCase):
config = paramiko.util.parse_ssh_config(f)
for host, values in {
- 'irc.danger.com': {'crazy': 'something dumb ',
+ 'irc.danger.com': {'crazy': 'something dumb',
'hostname': 'irc.danger.com',
'user': 'robey'},
- 'irc.example.com': {'crazy': 'something dumb ',
+ 'irc.example.com': {'crazy': 'something dumb',
'hostname': 'irc.example.com',
'user': 'robey',
'port': '3333'},
- 'spoo.example.com': {'crazy': 'something dumb ',
+ 'spoo.example.com': {'crazy': 'something dumb',
'hostname': 'spoo.example.com',
'user': 'robey',
'port': '3333'}