xace: add hooks + new access codes: MIT-SHM extension

This commit is contained in:
Eamon Walsh 2007-09-20 06:53:51 -04:00 committed by Eamon Walsh
parent e93cff52fe
commit 90bacdef72

View File

@ -58,6 +58,7 @@ in this Software without prior written authorization from The Open Group.
#include "extnsionst.h" #include "extnsionst.h"
#include "servermd.h" #include "servermd.h"
#include "shmint.h" #include "shmint.h"
#include "xace.h"
#define _XSHM_SERVER_ #define _XSHM_SERVER_
#include <X11/extensions/shmstr.h> #include <X11/extensions/shmstr.h>
#include <X11/Xfuncproto.h> #include <X11/Xfuncproto.h>
@ -907,7 +908,7 @@ ProcShmGetImage(client)
return(BadValue); return(BadValue);
} }
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
DixUnknownAccess); DixReadAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
@ -1039,7 +1040,7 @@ ProcShmCreatePixmap(client)
return BadImplementation; return BadImplementation;
LEGAL_NEW_RESOURCE(stuff->pid, client); LEGAL_NEW_RESOURCE(stuff->pid, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
DixUnknownAccess); DixGetAttrAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
@ -1068,6 +1069,12 @@ CreatePmap:
shmdesc->addr + stuff->offset); shmdesc->addr + stuff->offset);
if (pMap) if (pMap)
{ {
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
pMap, RT_NONE, NULL, DixCreateAccess);
if (rc != Success) {
pDraw->pScreen->DestroyPixmap(pMap);
return rc;
}
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc); dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc);
shmdesc->refcnt++; shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
@ -1076,6 +1083,7 @@ CreatePmap:
{ {
return(client->noClientException); return(client->noClientException);
} }
pDraw->pScreen->DestroyPixmap(pMap);
} }
return (BadAlloc); return (BadAlloc);
} }