xace: add hooks + new access codes: Composite extension

This commit is contained in:
Eamon Walsh 2007-08-31 11:03:54 -04:00 committed by Eamon Walsh
parent fd04b983db
commit c9ceb48780

View File

@ -45,6 +45,7 @@
#endif #endif
#include "compint.h" #include "compint.h"
#include "xace.h"
#define SERVER_COMPOSITE_MAJOR 0 #define SERVER_COMPOSITE_MAJOR 0
#define SERVER_COMPOSITE_MINOR 4 #define SERVER_COMPOSITE_MINOR 4
@ -157,14 +158,16 @@ static int
ProcCompositeRedirectWindow (ClientPtr client) ProcCompositeRedirectWindow (ClientPtr client)
{ {
WindowPtr pWin; WindowPtr pWin;
int rc;
REQUEST(xCompositeRedirectWindowReq); REQUEST(xCompositeRedirectWindowReq);
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq); REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
if (!pWin) DixSetAttrAccess|DixManageAccess|DixBlendAccess);
if (rc != Success)
{ {
client->errorValue = stuff->window; client->errorValue = stuff->window;
return BadWindow; return (rc == BadValue) ? BadWindow : rc;
} }
return compRedirectWindow (client, pWin, stuff->update); return compRedirectWindow (client, pWin, stuff->update);
} }
@ -173,14 +176,16 @@ static int
ProcCompositeRedirectSubwindows (ClientPtr client) ProcCompositeRedirectSubwindows (ClientPtr client)
{ {
WindowPtr pWin; WindowPtr pWin;
int rc;
REQUEST(xCompositeRedirectSubwindowsReq); REQUEST(xCompositeRedirectSubwindowsReq);
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq); REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
if (!pWin) DixSetAttrAccess|DixManageAccess|DixBlendAccess);
if (rc != Success)
{ {
client->errorValue = stuff->window; client->errorValue = stuff->window;
return BadWindow; return (rc == BadValue) ? BadWindow : rc;
} }
return compRedirectSubwindows (client, pWin, stuff->update); return compRedirectSubwindows (client, pWin, stuff->update);
} }
@ -223,14 +228,16 @@ ProcCompositeCreateRegionFromBorderClip (ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
CompWindowPtr cw; CompWindowPtr cw;
RegionPtr pBorderClip, pRegion; RegionPtr pBorderClip, pRegion;
int rc;
REQUEST(xCompositeCreateRegionFromBorderClipReq); REQUEST(xCompositeCreateRegionFromBorderClipReq);
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq); REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
if (!pWin) DixGetAttrAccess);
if (rc != Success)
{ {
client->errorValue = stuff->window; client->errorValue = stuff->window;
return BadWindow; return (rc == BadValue) ? BadWindow : rc;
} }
LEGAL_NEW_RESOURCE (stuff->region, client); LEGAL_NEW_RESOURCE (stuff->region, client);
@ -257,14 +264,16 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
CompWindowPtr cw; CompWindowPtr cw;
PixmapPtr pPixmap; PixmapPtr pPixmap;
int rc;
REQUEST(xCompositeNameWindowPixmapReq); REQUEST(xCompositeNameWindowPixmapReq);
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq); REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
if (!pWin) DixGetAttrAccess);
if (rc != Success)
{ {
client->errorValue = stuff->window; client->errorValue = stuff->window;
return BadWindow; return (rc == BadValue) ? BadWindow : rc;
} }
if (!pWin->viewable) if (!pWin->viewable)
@ -429,13 +438,15 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
ScreenPtr pScreen; ScreenPtr pScreen;
CompScreenPtr cs; CompScreenPtr cs;
CompOverlayClientPtr pOc; CompOverlayClientPtr pOc;
int rc;
REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq); REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); rc = dixLookupResource((pointer *)&pWin, stuff->window, RT_WINDOW, client,
if (!pWin) DixGetAttrAccess);
if (rc != Success)
{ {
client->errorValue = stuff->window; client->errorValue = stuff->window;
return BadWindow; return (rc == BadValue) ? BadWindow : rc;
} }
pScreen = pWin->drawable.pScreen; pScreen = pWin->drawable.pScreen;
@ -446,6 +457,12 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
return BadAlloc; return BadAlloc;
} }
} }
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
RT_WINDOW, DixGetAttrAccess, cs->pOverlayWin);
if (rc != Success)
return rc;
MapWindow(cs->pOverlayWin, serverClient); MapWindow(cs->pOverlayWin, serverClient);
/* Record that client is using this overlay window */ /* Record that client is using this overlay window */