From 8f609404caa511a464207507129de586d325b3d9 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 24 Jul 2019 00:02:51 +0200 Subject: NXproperty.c: prevent deletion of NX_AGENT_VERSION property Fixes ArcticaProject/nx-libs#825 --- nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'nx-X11/programs/Xserver/hw/nxagent') diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index a0c355b41..94e9e4b2a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -682,3 +682,50 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete, return(Success); } #endif + +int +ProcDeleteProperty(register ClientPtr client) +{ + WindowPtr pWin; + REQUEST(xDeletePropertyReq); + int result; + + REQUEST_SIZE_MATCH(xDeletePropertyReq); + UpdateCurrentTime(); + pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, + DixWriteAccess); + if (!pWin) + return(BadWindow); + if (!ValidAtom(stuff->property)) + { + client->errorValue = stuff->property; + return (BadAtom); + } + +#ifdef XCSECURITY + switch(SecurityCheckPropertyAccess(client, pWin, stuff->property, + DixDestroyAccess)) + { + case SecurityErrorOperation: + client->errorValue = stuff->property; + return BadAtom;; + case SecurityIgnoreOperation: + return Success; + } +#endif + +#ifdef NXAGENT_SERVER + /* prevent clients from deleting the NX_AGENT_VERSION property */ + { + Atom prop = MakeAtom("NX_AGENT_VERSION", strlen("NX_AGENT_VERSION"), True); + if (stuff->property == prop) + return client->noClientException; + } +#endif + + result = DeleteProperty(pWin, stuff->property); + if (client->noClientException != Success) + return(client->noClientException); + else + return(result); +} -- cgit v1.2.3