Skip to content

Commit

Permalink
Merge pull request TigerVNC#1463 from TigerVNC/accessRightsFixes
Browse files Browse the repository at this point in the history
Minor fixes/future-proofing for SConnection::accessCheck() and 'accessRights'
  • Loading branch information
samhed authored May 2, 2022
2 parents 247404c + 3223f20 commit 6e762cd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion common/rfb/SConnection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -346,6 +347,8 @@ void SConnection::setAccessRights(AccessRights ar)

bool SConnection::accessCheck(AccessRights ar) const
{
assert(state_ >= RFBSTATE_QUERYING);

return (accessRights & ar) == ar;
}

Expand Down

0 comments on commit 6e762cd

Please sign in to comment.