You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by GitBox <gi...@apache.org> on 2020/08/04 12:15:00 UTC

[GitHub] [mina-sshd] lgoldstein commented on a change in pull request #156: [SSHD-1050] Fixed race condition in AuthFuture if exception caught before authentication started

lgoldstein commented on a change in pull request #156:
URL: https://github.com/apache/mina-sshd/pull/156#discussion_r465005694



##########
File path: sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
##########
@@ -124,8 +123,19 @@ public AuthFuture auth() throws IOException {
         ClientUserAuthService authService = getUserAuthService();
         synchronized (sessionLock) {
             String serviceName = nextServiceName();
+            // SSHD-1050 - check if need to propagate any previously caught exceptions
+            Throwable caught = (authFuture instanceof InitialAuthFuture) ? authFuture.getException() : null;
             authFuture = ValidateUtils.checkNotNull(
                     authService.auth(serviceName), "No auth future generated by service=%s", serviceName);
+            if (caught != null) {
+                /*
+                 * Safe to do under session lock despite SSHD-916 since
+                 * the newly generated future has no associated listeners
+                 * attached to it yet
+                 */
+                signalAuthFailure(authFuture, caught);

Review comment:
       Seems a good idea...




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org