summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Mannehed <samuel@cendio.se>2022-05-02 08:43:34 +0200
committerGitHub <noreply@github.com>2022-05-02 08:43:34 +0200
commit6e762cd21765d441694c119765ae06d63d1978d2 (patch)
tree6d101d4b0b7588c5cf49af2608a21d91b763fdd7
parent247404c0ed518182dfce9376ce2bfa6a5fee9617 (diff)
parent3223f20d59f01c15a00d10580de7d0c0662a7484 (diff)
downloadtigervnc-6e762cd21765d441694c119765ae06d63d1978d2.tar.gz
tigervnc-6e762cd21765d441694c119765ae06d63d1978d2.zip
Merge pull request #1463 from TigerVNC/accessRightsFixes
Minor fixes/future-proofing for SConnection::accessCheck() and 'accessRights'
-rw-r--r--common/rfb/SConnection.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx
index 02865af1..f70d21dc 100644
--- a/common/rfb/SConnection.cxx
+++ b/common/rfb/SConnection.cxx
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <string.h>
+#include <assert.h>
#include <rfb/Exception.h>
#include <rfb/Security.h>
#include <rfb/clipboardTypes.h>
@@ -59,7 +60,7 @@ SConnection::SConnection()
is(0), os(0), reader_(0), writer_(0), ssecurity(0),
authFailureTimer(this, &SConnection::handleAuthFailureTimeout),
state_(RFBSTATE_UNINITIALISED), preferredEncoding(encodingRaw),
- clientClipboard(NULL), hasLocalClipboard(false),
+ accessRights(0x0000), clientClipboard(NULL), hasLocalClipboard(false),
unsolicitedClipboardAttempt(false)
{
defaultMajorVersion = 3;
@@ -346,6 +347,8 @@ void SConnection::setAccessRights(AccessRights ar)
bool SConnection::accessCheck(AccessRights ar) const
{
+ assert(state_ >= RFBSTATE_QUERYING);
+
return (accessRights & ar) == ar;
}