Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully fail gss-with-mic to allow fallback to next authentication #652

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions paramiko/auth_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def _interactive_query(self, q):
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?
Expand Down Expand Up @@ -495,8 +495,9 @@ def _parse_userauth_request(self, m):
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:
Expand Down Expand Up @@ -568,7 +569,7 @@ def _parse_userauth_banner(self, m):
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')
Expand All @@ -580,14 +581,14 @@ def _parse_userauth_info_request(self, m):
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')
Expand Down