From 59f0aeaef22404b3156cc4ef986366386d4e4d8c Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 18 May 2020 19:42:13 +0200 Subject: [PATCH] Separate query and authentication handling Otherwise we might send duplicate result codes and other weird things. --- common/rfb/SConnection.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx index e9dbd665..9e6d0322 100644 --- a/common/rfb/SConnection.cxx +++ b/common/rfb/SConnection.cxx @@ -232,12 +232,8 @@ void SConnection::processSecurityMsg() { vlog.debug("processing security message"); try { - bool done = ssecurity->processMsg(); - if (done) { - state_ = RFBSTATE_QUERYING; - setAccessRights(ssecurity->getAccessRights()); - queryConnection(ssecurity->getUserName()); - } + if (!ssecurity->processMsg()) + return; } catch (AuthFailureException& e) { vlog.error("AuthFailureException: %s", e.str()); state_ = RFBSTATE_SECURITY_FAILURE; @@ -246,6 +242,10 @@ void SConnection::processSecurityMsg() authFailureMsg.replaceBuf(strDup(e.str())); authFailureTimer.start(100); } + + state_ = RFBSTATE_QUERYING; + setAccessRights(ssecurity->getAccessRights()); + queryConnection(ssecurity->getUserName()); } void SConnection::processSecurityFailure() -- 2.39.5