From: Pierre Ossman Date: Mon, 18 May 2020 17:42:13 +0000 (+0200) Subject: Separate query and authentication handling X-Git-Tag: v1.11.90~74^2~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=59f0aeaef22404b3156cc4ef986366386d4e4d8c;p=tigervnc.git Separate query and authentication handling Otherwise we might send duplicate result codes and other weird things. --- 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()