]> source.dussan.org Git - tigervnc.git/commitdiff
Separate query and authentication handling
authorPierre Ossman <ossman@cendio.se>
Mon, 18 May 2020 17:42:13 +0000 (19:42 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 21 May 2020 09:34:22 +0000 (11:34 +0200)
Otherwise we might send duplicate result codes and other weird things.

common/rfb/SConnection.cxx

index e9dbd665b94db63e597211d89a2da6c8f5088104..9e6d03229eaa144f40de182b436ff6a428d05236 100644 (file)
@@ -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()