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; bool hasLocalClipboard;
}; };
} }
#define WRITER_PERMS (AccessKeyEvents | AccessPtrEvents | AccessCutText | AccessSetDesktopSize)
#endif #endif

View File

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

View File

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