Skip to content

Commit

Permalink
Replacce previous fix for GSS auth hang on Windows
Browse files Browse the repository at this point in the history
This commit reverts the previous GSS auth fix and replaces it with a
better one. While the previous change avoided the hang, it didn't
properly address the root cause of the problem, and didn't properly
maintain code coverage.
  • Loading branch information
ronf committed Feb 18, 2022
1 parent 9a38cb7 commit 2f733d5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions asyncssh/gss_win32.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2017-2021 by Ron Frederick <ronf@timeheart.net> and others.
# Copyright (c) 2017-2022 by Ron Frederick <ronf@timeheart.net> and others.
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License v2.0 which accompanies this
Expand Down Expand Up @@ -109,8 +109,8 @@ def reset(self) -> None:

assert self._ctx is not None

if self._ctx.authenticated:
self._ctx.reset()
self._ctx.reset()
self._init_token = None

def step(self, token: Optional[bytes] = None) -> Optional[bytes]:
"""Perform next step in GSS security exchange"""
Expand Down
6 changes: 3 additions & 3 deletions tests/sspi_stub.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2017-2019 by Ron Frederick <ronf@timeheart.net> and others.
# Copyright (c) 2017-2022 by Ron Frederick <ronf@timeheart.net> and others.
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License v2.0 which accompanies this
Expand Down Expand Up @@ -105,7 +105,7 @@ def authorize(self, token):

if self._error:
self._error = False
raise SSPIError('Token authentication errror')
raise SSPIError('Token authentication error')

new_token, complete = step(self._host, token)

Expand All @@ -114,7 +114,7 @@ def authorize(self, token):

if new_token in (b'error', b'errtok'):
if token:
raise SSPIError('Token authentication errror')
raise SSPIError('Token authentication error')
else:
self._error = True
return True, [SSPIBuffer(b'')]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015-2021 by Ron Frederick <ronf@timeheart.net> and others.
# Copyright (c) 2015-2022 by Ron Frederick <ronf@timeheart.net> and others.
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License v2.0 which accompanies this
Expand Down Expand Up @@ -476,7 +476,7 @@ async def test_gss_auth(self):
with self.subTest('GSS with MIC auth not available'):
await self.check_auth(b'gssapi-with-mic', (False, None))

for steps in range(1, 4):
for steps in range(4):
with self.subTest('GSS with MIC auth available'):
await self.check_auth(b'gssapi-with-mic', (True, None),
gss_host=str(steps), success=True)
Expand Down

0 comments on commit 2f733d5

Please sign in to comment.