Writer perms were checked in multiple places, consolidate and fix a missing case

This commit is contained in:
Lauri Kasanen 2021-05-10 11:02:20 +03:00
parent aefdb1392f
commit 7a695c976e
3 changed files with 9 additions and 5 deletions

View File

@ -252,4 +252,7 @@ namespace rfb {
bool hasLocalClipboard;
};
}
#define WRITER_PERMS (AccessKeyEvents | AccessPtrEvents | AccessCutText | AccessSetDesktopSize)
#endif

View File

@ -86,8 +86,9 @@ VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s,
}
bool write, owner;
if (!getPerms(write, owner) || !write)
accessRights = (accessRights & ~(AccessPtrEvents | AccessKeyEvents | AccessSetDesktopSize));
if (!getPerms(write, owner) || !write) {
accessRights &= ~WRITER_PERMS;
}
// Configure the socket
setSocketTimeouts();
@ -1216,9 +1217,9 @@ void VNCSConnectionST::writeFramebufferUpdate()
close("User was deleted");
return;
} else if (!write) {
accessRights = (accessRights & ~(AccessPtrEvents | AccessKeyEvents | AccessSetDesktopSize));
accessRights &= ~WRITER_PERMS;
} else {
accessRights |= AccessPtrEvents | AccessKeyEvents | AccessSetDesktopSize;
accessRights |= WRITER_PERMS;
}
}

View File

@ -206,7 +206,7 @@ namespace rfb {
bool write, owner;
if (!getPerms(write, owner) || !write)
accessRights = (accessRights & ~(AccessPtrEvents | AccessKeyEvents));
accessRights &= ~WRITER_PERMS;
needsPermCheck = false;
}