Fix most remaining deprecated resource lookups.
Callsites updated to use dixLookupResourceBy{Type,Class}. TODO: Audit access modes to make sure they reflect the usage.
This commit is contained in:
parent
1abe0ee3da
commit
57aff88c7d
|
@ -354,9 +354,12 @@ PanoramiXRes *
|
|||
PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen)
|
||||
{
|
||||
PanoramiXSearchData data;
|
||||
pointer val;
|
||||
|
||||
if(!screen)
|
||||
return LookupIDByType(id, type);
|
||||
if(!screen) {
|
||||
dixLookupResourceByType(&val, id, type, serverClient, DixReadAccess);
|
||||
return val;
|
||||
}
|
||||
|
||||
data.screen = screen;
|
||||
data.id = id;
|
||||
|
|
|
@ -97,6 +97,4 @@ typedef struct {
|
|||
|
||||
#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)
|
||||
|
||||
#define SKIP_FAKE_WINDOW(a) if(!LookupIDByType(a, XRT_WINDOW)) return
|
||||
|
||||
#endif /* _PANORAMIX_H_ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
54
Xext/saver.c
54
Xext/saver.c
|
@ -533,11 +533,14 @@ UninstallSaverColormap (ScreenPtr pScreen)
|
|||
{
|
||||
SetupScreen(pScreen);
|
||||
ColormapPtr pCmap;
|
||||
int rc;
|
||||
|
||||
if (pPriv && pPriv->installedMap != None)
|
||||
{
|
||||
pCmap = (ColormapPtr) LookupIDByType (pPriv->installedMap, RT_COLORMAP);
|
||||
if (pCmap)
|
||||
rc = dixLookupResourceByType((pointer *)&pCmap, pPriv->installedMap,
|
||||
RT_COLORMAP, serverClient,
|
||||
DixUninstallAccess);
|
||||
if (rc == Success)
|
||||
(*pCmap->pScreen->UninstallColormap) (pCmap);
|
||||
pPriv->installedMap = None;
|
||||
CheckScreenPrivate (pScreen);
|
||||
|
@ -651,8 +654,9 @@ CreateSaverWindow (ScreenPtr pScreen)
|
|||
if (i < numInstalled)
|
||||
return TRUE;
|
||||
|
||||
pCmap = (ColormapPtr) LookupIDByType (wantMap, RT_COLORMAP);
|
||||
if (!pCmap)
|
||||
result = dixLookupResourceByType((pointer *)&pCmap, wantMap, RT_COLORMAP,
|
||||
serverClient, DixInstallAccess);
|
||||
if (result != Success)
|
||||
return TRUE;
|
||||
|
||||
pPriv->installedMap = wantMap;
|
||||
|
@ -1252,15 +1256,16 @@ ProcScreenSaverSetAttributes (ClientPtr client)
|
|||
PanoramiXRes *backPix = NULL;
|
||||
PanoramiXRes *bordPix = NULL;
|
||||
PanoramiXRes *cmap = NULL;
|
||||
int i, status = 0, len;
|
||||
int i, status, len;
|
||||
int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
|
||||
XID orig_visual, tmp;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
|
||||
|
||||
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
|
||||
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
|
||||
return BadDrawable;
|
||||
status = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (status != Success)
|
||||
return (status == BadValue) ? BadDrawable : status;
|
||||
|
||||
len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2);
|
||||
if (Ones(stuff->mask) != len)
|
||||
|
@ -1270,9 +1275,11 @@ ProcScreenSaverSetAttributes (ClientPtr client)
|
|||
pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1));
|
||||
tmp = *((CARD32 *) &stuff[1] + pback_offset);
|
||||
if ((tmp != None) && (tmp != ParentRelative)) {
|
||||
if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
|
||||
client, tmp, XRT_PIXMAP, DixReadAccess)))
|
||||
return BadPixmap;
|
||||
status = dixLookupResourceByType((pointer *)&backPix, tmp,
|
||||
XRT_PIXMAP, client,
|
||||
DixReadAccess);
|
||||
if (status != Success)
|
||||
return (status == BadValue) ? BadPixmap : status;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1280,9 +1287,11 @@ ProcScreenSaverSetAttributes (ClientPtr client)
|
|||
pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1));
|
||||
tmp = *((CARD32 *) &stuff[1] + pbord_offset);
|
||||
if (tmp != CopyFromParent) {
|
||||
if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
|
||||
client, tmp, XRT_PIXMAP, DixReadAccess)))
|
||||
return BadPixmap;
|
||||
status = dixLookupResourceByType((pointer *)&bordPix, tmp,
|
||||
XRT_PIXMAP, client,
|
||||
DixReadAccess);
|
||||
if (status != Success)
|
||||
return (status == BadValue) ? BadPixmap : status;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1290,9 +1299,11 @@ ProcScreenSaverSetAttributes (ClientPtr client)
|
|||
cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1));
|
||||
tmp = *((CARD32 *) &stuff[1] + cmap_offset);
|
||||
if ((tmp != CopyFromParent) && (tmp != None)) {
|
||||
if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
|
||||
client, tmp, XRT_COLORMAP, DixReadAccess)))
|
||||
return BadColor;
|
||||
status = dixLookupResourceByType((pointer *)&cmap, tmp,
|
||||
XRT_COLORMAP, client,
|
||||
DixReadAccess);
|
||||
if (status != Success)
|
||||
return (status == BadValue) ? BadColor : status;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1327,11 +1338,12 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
|
|||
if(!noPanoramiXExtension) {
|
||||
REQUEST(xScreenSaverUnsetAttributesReq);
|
||||
PanoramiXRes *draw;
|
||||
int i;
|
||||
int rc, i;
|
||||
|
||||
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
|
||||
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
|
||||
return BadDrawable;
|
||||
rc = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? BadDrawable : rc;
|
||||
|
||||
for(i = PanoramiXNumScreens - 1; i > 0; i--) {
|
||||
stuff->drawable = draw->info[i].id;
|
||||
|
|
|
@ -623,13 +623,16 @@ ProcSecurityRevokeAuthorization(
|
|||
{
|
||||
REQUEST(xSecurityRevokeAuthorizationReq);
|
||||
SecurityAuthorizationPtr pAuth;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
|
||||
|
||||
pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client,
|
||||
stuff->authId, SecurityAuthorizationResType, DixDestroyAccess);
|
||||
if (!pAuth)
|
||||
return SecurityErrorBase + XSecurityBadAuthorization;
|
||||
rc = dixLookupResourceByType((pointer *)&pAuth, stuff->authId,
|
||||
SecurityAuthorizationResType, client,
|
||||
DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ?
|
||||
SecurityErrorBase + XSecurityBadAuthorization : rc;
|
||||
|
||||
FreeResource(stuff->authId, RT_NONE);
|
||||
return Success;
|
||||
|
|
75
Xext/shape.c
75
Xext/shape.c
|
@ -353,13 +353,14 @@ ProcPanoramiXShapeRectangles(
|
|||
{
|
||||
REQUEST(xShapeRectanglesReq);
|
||||
PanoramiXRes *win;
|
||||
int j, result = 0;
|
||||
int j, result;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
|
||||
|
||||
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
|
||||
return BadWindow;
|
||||
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
|
||||
client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadWindow : result;
|
||||
|
||||
FOR_NSCREENS(j) {
|
||||
stuff->dest = win->info[j].id;
|
||||
|
@ -451,18 +452,20 @@ ProcPanoramiXShapeMask(
|
|||
{
|
||||
REQUEST(xShapeMaskReq);
|
||||
PanoramiXRes *win, *pmap;
|
||||
int j, result = 0;
|
||||
int j, result;
|
||||
|
||||
REQUEST_SIZE_MATCH (xShapeMaskReq);
|
||||
|
||||
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
|
||||
return BadWindow;
|
||||
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
|
||||
client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadWindow : result;
|
||||
|
||||
if(stuff->src != None) {
|
||||
if(!(pmap = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->src, XRT_PIXMAP, DixReadAccess)))
|
||||
return BadPixmap;
|
||||
result = dixLookupResourceByType((pointer *)&pmap, stuff->src,
|
||||
XRT_PIXMAP, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadPixmap : result;
|
||||
} else
|
||||
pmap = NULL;
|
||||
|
||||
|
@ -579,17 +582,19 @@ ProcPanoramiXShapeCombine(
|
|||
{
|
||||
REQUEST(xShapeCombineReq);
|
||||
PanoramiXRes *win, *win2;
|
||||
int j, result = 0;
|
||||
int j, result;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE (xShapeCombineReq);
|
||||
|
||||
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
|
||||
return BadWindow;
|
||||
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
|
||||
client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadWindow : result;
|
||||
|
||||
if(!(win2 = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->src, XRT_WINDOW, DixReadAccess)))
|
||||
return BadWindow;
|
||||
result = dixLookupResourceByType((pointer *)&win2, stuff->src, XRT_WINDOW,
|
||||
client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadWindow : result;
|
||||
|
||||
FOR_NSCREENS(j) {
|
||||
stuff->dest = win->info[j].id;
|
||||
|
@ -651,13 +656,14 @@ ProcPanoramiXShapeOffset(
|
|||
{
|
||||
REQUEST(xShapeOffsetReq);
|
||||
PanoramiXRes *win;
|
||||
int j, result = 0;
|
||||
int j, result;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE (xShapeOffsetReq);
|
||||
|
||||
if(!(win = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->dest, XRT_WINDOW, DixWriteAccess)))
|
||||
return BadWindow;
|
||||
result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW,
|
||||
client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadWindow : result;
|
||||
|
||||
FOR_NSCREENS(j) {
|
||||
stuff->dest = win->info[j].id;
|
||||
|
@ -740,11 +746,13 @@ ShapeFreeClient (pointer data, XID id)
|
|||
ShapeEventPtr pShapeEvent;
|
||||
WindowPtr pWin;
|
||||
ShapeEventPtr *pHead, pCur, pPrev;
|
||||
int rc;
|
||||
|
||||
pShapeEvent = (ShapeEventPtr) data;
|
||||
pWin = pShapeEvent->window;
|
||||
pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, ShapeEventType);
|
||||
if (pHead) {
|
||||
rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
||||
ShapeEventType, serverClient, DixReadAccess);
|
||||
if (rc == Success) {
|
||||
pPrev = 0;
|
||||
for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur=pCur->next)
|
||||
pPrev = pCur;
|
||||
|
@ -789,8 +797,11 @@ ProcShapeSelectInput (ClientPtr client)
|
|||
rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
pHead = (ShapeEventPtr *)SecurityLookupIDByType(client,
|
||||
pWin->drawable.id, ShapeEventType, DixWriteAccess);
|
||||
rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
||||
ShapeEventType, client, DixWriteAccess);
|
||||
if (rc != Success && rc != BadValue)
|
||||
return rc;
|
||||
|
||||
switch (stuff->enable) {
|
||||
case xTrue:
|
||||
if (pHead) {
|
||||
|
@ -879,9 +890,11 @@ SendShapeNotify (WindowPtr pWin, int which)
|
|||
BoxRec extents;
|
||||
RegionPtr region;
|
||||
BYTE shaped;
|
||||
int rc;
|
||||
|
||||
pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, ShapeEventType);
|
||||
if (!pHead)
|
||||
rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
||||
ShapeEventType, serverClient, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return;
|
||||
switch (which) {
|
||||
case ShapeBounding:
|
||||
|
@ -958,8 +971,10 @@ ProcShapeInputSelected (ClientPtr client)
|
|||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
pHead = (ShapeEventPtr *) SecurityLookupIDByType(client,
|
||||
pWin->drawable.id, ShapeEventType, DixReadAccess);
|
||||
rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
||||
ShapeEventType, client, DixReadAccess);
|
||||
if (rc != Success && rc != BadValue)
|
||||
return rc;
|
||||
enabled = xFalse;
|
||||
if (pHead) {
|
||||
for (pShapeEvent = *pHead;
|
||||
|
|
34
Xext/shm.c
34
Xext/shm.c
|
@ -144,12 +144,11 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, NULL};
|
|||
|
||||
#define VERIFY_SHMSEG(shmseg,shmdesc,client) \
|
||||
{ \
|
||||
shmdesc = (ShmDescPtr)LookupIDByType(shmseg, ShmSegType); \
|
||||
if (!shmdesc) \
|
||||
{ \
|
||||
client->errorValue = shmseg; \
|
||||
return BadShmSegCode; \
|
||||
} \
|
||||
int rc; \
|
||||
rc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \
|
||||
client, DixReadAccess); \
|
||||
if (rc != Success) \
|
||||
return (rc == BadValue) ? BadShmSegCode : rc; \
|
||||
}
|
||||
|
||||
#define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \
|
||||
|
@ -513,20 +512,22 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
|
|||
static int
|
||||
ProcPanoramiXShmPutImage(ClientPtr client)
|
||||
{
|
||||
int j, result = 0, orig_x, orig_y;
|
||||
int j, result, orig_x, orig_y;
|
||||
PanoramiXRes *draw, *gc;
|
||||
Bool sendEvent, isRoot;
|
||||
|
||||
REQUEST(xShmPutImageReq);
|
||||
REQUEST_SIZE_MATCH(xShmPutImageReq);
|
||||
|
||||
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
|
||||
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
|
||||
return BadDrawable;
|
||||
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadDrawable : result;
|
||||
|
||||
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->gc, XRT_GC, DixReadAccess)))
|
||||
return BadGC;
|
||||
result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
|
||||
XRT_GC, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadGC : result;
|
||||
|
||||
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
||||
|
||||
|
@ -570,9 +571,10 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
return(BadValue);
|
||||
}
|
||||
|
||||
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
|
||||
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
|
||||
return BadDrawable;
|
||||
rc = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? BadDrawable : rc;
|
||||
|
||||
if (draw->type == XRT_PIXMAP)
|
||||
return ProcShmGetImage(client);
|
||||
|
|
82
Xext/sync.c
82
Xext/sync.c
|
@ -1339,16 +1339,14 @@ ProcSyncSetCounter(ClientPtr client)
|
|||
REQUEST(xSyncSetCounterReq);
|
||||
SyncCounter *pCounter;
|
||||
CARD64 newvalue;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xSyncSetCounterReq);
|
||||
|
||||
pCounter = SecurityLookupIDByType(client, stuff->cid, RTCounter,
|
||||
DixWriteAccess);
|
||||
if (pCounter == NULL)
|
||||
{
|
||||
client->errorValue = stuff->cid;
|
||||
return SyncErrorBase + XSyncBadCounter;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter,
|
||||
client, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc;
|
||||
|
||||
if (IsSystemCounter(pCounter))
|
||||
{
|
||||
|
@ -1371,16 +1369,14 @@ ProcSyncChangeCounter(ClientPtr client)
|
|||
SyncCounter *pCounter;
|
||||
CARD64 newvalue;
|
||||
Bool overflow;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xSyncChangeCounterReq);
|
||||
|
||||
pCounter = SecurityLookupIDByType(client, stuff->cid, RTCounter,
|
||||
DixWriteAccess);
|
||||
if (pCounter == NULL)
|
||||
{
|
||||
client->errorValue = stuff->cid;
|
||||
return SyncErrorBase + XSyncBadCounter;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter,
|
||||
client, DixWriteAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc;
|
||||
|
||||
if (IsSystemCounter(pCounter))
|
||||
{
|
||||
|
@ -1408,16 +1404,15 @@ ProcSyncDestroyCounter(ClientPtr client)
|
|||
{
|
||||
REQUEST(xSyncDestroyCounterReq);
|
||||
SyncCounter *pCounter;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xSyncDestroyCounterReq);
|
||||
|
||||
pCounter = SecurityLookupIDByType(client, stuff->counter, RTCounter,
|
||||
DixDestroyAccess);
|
||||
if (pCounter == NULL)
|
||||
{
|
||||
client->errorValue = stuff->counter;
|
||||
return SyncErrorBase + XSyncBadCounter;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter, RTCounter,
|
||||
client, DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc;
|
||||
|
||||
if (IsSystemCounter(pCounter))
|
||||
{
|
||||
client->errorValue = stuff->counter;
|
||||
|
@ -1552,16 +1547,14 @@ ProcSyncQueryCounter(ClientPtr client)
|
|||
REQUEST(xSyncQueryCounterReq);
|
||||
xSyncQueryCounterReply rep;
|
||||
SyncCounter *pCounter;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xSyncQueryCounterReq);
|
||||
|
||||
pCounter = SecurityLookupIDByType(client, stuff->counter, RTCounter,
|
||||
DixReadAccess);
|
||||
if (pCounter == NULL)
|
||||
{
|
||||
client->errorValue = stuff->counter;
|
||||
return SyncErrorBase + XSyncBadCounter;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter,
|
||||
RTCounter, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc;
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
|
@ -1682,12 +1675,10 @@ ProcSyncChangeAlarm(ClientPtr client)
|
|||
|
||||
REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq);
|
||||
|
||||
if (!(pAlarm = SecurityLookupIDByType(client, stuff->alarm, RTAlarm,
|
||||
DixWriteAccess)))
|
||||
{
|
||||
client->errorValue = stuff->alarm;
|
||||
return SyncErrorBase + XSyncBadAlarm;
|
||||
}
|
||||
status = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm,
|
||||
client, DixWriteAccess);
|
||||
if (status != Success)
|
||||
return (status == BadValue) ? SyncErrorBase + XSyncBadAlarm : status;
|
||||
|
||||
vmask = stuff->valueMask;
|
||||
len = client->req_len - (sizeof(xSyncChangeAlarmReq) >> 2);
|
||||
|
@ -1719,16 +1710,14 @@ ProcSyncQueryAlarm(ClientPtr client)
|
|||
SyncAlarm *pAlarm;
|
||||
xSyncQueryAlarmReply rep;
|
||||
SyncTrigger *pTrigger;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xSyncQueryAlarmReq);
|
||||
|
||||
pAlarm = SecurityLookupIDByType(client, stuff->alarm, RTAlarm,
|
||||
DixReadAccess);
|
||||
if (!pAlarm)
|
||||
{
|
||||
client->errorValue = stuff->alarm;
|
||||
return SyncErrorBase + XSyncBadAlarm;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm,
|
||||
client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? SyncErrorBase + XSyncBadAlarm : rc;
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.length = (sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)) >> 2;
|
||||
|
@ -1776,16 +1765,15 @@ ProcSyncQueryAlarm(ClientPtr client)
|
|||
static int
|
||||
ProcSyncDestroyAlarm(ClientPtr client)
|
||||
{
|
||||
SyncAlarm *pAlarm;
|
||||
int rc;
|
||||
REQUEST(xSyncDestroyAlarmReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq);
|
||||
|
||||
if (!(SecurityLookupIDByType(client, stuff->alarm, RTAlarm,
|
||||
DixDestroyAccess)))
|
||||
{
|
||||
client->errorValue = stuff->alarm;
|
||||
return SyncErrorBase + XSyncBadAlarm;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm,
|
||||
client, DixDestroyAccess);
|
||||
return (rc == BadValue) ? SyncErrorBase + XSyncBadAlarm : rc;
|
||||
|
||||
FreeResource(stuff->alarm, RT_NONE);
|
||||
return client->noClientException;
|
||||
|
|
|
@ -427,15 +427,15 @@ ProcXF86BigfontQueryFont(
|
|||
}
|
||||
#endif
|
||||
client->errorValue = stuff->id; /* EITHER font or gc */
|
||||
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
|
||||
DixGetAttrAccess);
|
||||
dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT,
|
||||
client, DixGetAttrAccess);
|
||||
if (!pFont) {
|
||||
GC *pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC,
|
||||
DixGetAttrAccess);
|
||||
if (!pGC) {
|
||||
client->errorValue = stuff->id;
|
||||
GC *pGC;
|
||||
dixLookupResourceByType((pointer *)&pGC, stuff->id, RT_GC,
|
||||
client, DixGetAttrAccess);
|
||||
if (!pGC)
|
||||
return BadFont; /* procotol spec says only error is BadFont */
|
||||
}
|
||||
|
||||
pFont = pGC->font;
|
||||
}
|
||||
|
||||
|
|
234
Xext/xvdisp.c
234
Xext/xvdisp.c
|
@ -479,11 +479,7 @@ ProcXvQueryEncodings(ClientPtr client)
|
|||
REQUEST(xvQueryEncodingsReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryEncodingsReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -540,12 +536,7 @@ ProcXvPutVideo(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xvPutVideoReq);
|
||||
|
||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -583,12 +574,7 @@ ProcXvPutStill(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xvPutStillReq);
|
||||
|
||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -626,12 +612,7 @@ ProcXvGetVideo(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xvGetVideoReq);
|
||||
|
||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -669,12 +650,7 @@ ProcXvGetStill(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xvGetStillReq);
|
||||
|
||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -723,11 +699,7 @@ ProcXvSelectPortNotify(ClientPtr client)
|
|||
REQUEST(xvSelectPortNotifyReq);
|
||||
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -747,11 +719,7 @@ ProcXvGrabPort(ClientPtr client)
|
|||
REQUEST(xvGrabPortReq);
|
||||
REQUEST_SIZE_MATCH(xvGrabPortReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -784,11 +752,7 @@ ProcXvUngrabPort(ClientPtr client)
|
|||
REQUEST(xvGrabPortReq);
|
||||
REQUEST_SIZE_MATCH(xvGrabPortReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -808,11 +772,7 @@ ProcXvStopVideo(ClientPtr client)
|
|||
REQUEST(xvStopVideoReq);
|
||||
REQUEST_SIZE_MATCH(xvStopVideoReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -835,11 +795,7 @@ ProcXvSetPortAttribute(ClientPtr client)
|
|||
REQUEST(xvSetPortAttributeReq);
|
||||
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixSetAttrAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -873,11 +829,7 @@ ProcXvGetPortAttribute(ClientPtr client)
|
|||
REQUEST(xvGetPortAttributeReq);
|
||||
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -918,11 +870,7 @@ ProcXvQueryBestSize(ClientPtr client)
|
|||
REQUEST(xvQueryBestSizeReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -959,11 +907,7 @@ ProcXvQueryPortAttributes(ClientPtr client)
|
|||
REQUEST(xvQueryPortAttributesReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -1019,12 +963,7 @@ ProcXvPutImage(ClientPtr client)
|
|||
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
|
||||
|
||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -1105,12 +1044,7 @@ ProcXvShmPutImage(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xvShmPutImageReq);
|
||||
|
||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
|
@ -1141,11 +1075,10 @@ ProcXvShmPutImage(ClientPtr client)
|
|||
if(!pImage)
|
||||
return BadMatch;
|
||||
|
||||
if(!(shmdesc = (ShmDescPtr)LookupIDByType(stuff->shmseg, ShmSegType)))
|
||||
{
|
||||
client->errorValue = stuff->shmseg;
|
||||
return BadShmSegCode;
|
||||
}
|
||||
status = dixLookupResourceByType((pointer *)&shmdesc, stuff->shmseg,
|
||||
ShmSegType, serverClient, DixReadAccess);
|
||||
if (status != Success)
|
||||
return (status == BadValue) ? BadShmSegCode : status;
|
||||
|
||||
width = stuff->width;
|
||||
height = stuff->height;
|
||||
|
@ -1206,11 +1139,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
for(i = 0; i < pPort->pAdaptor->nImages; i++) {
|
||||
if(pPort->pAdaptor->pImages[i].id == stuff->id) {
|
||||
|
@ -1269,11 +1198,7 @@ ProcXvListImageFormats(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xvListImageFormatsReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
|
||||
{
|
||||
client->errorValue = stuff->port;
|
||||
return (_XvBadPort);
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
@ -1679,18 +1604,20 @@ SProcXvDispatch(ClientPtr client)
|
|||
static int
|
||||
XineramaXvStopVideo(ClientPtr client)
|
||||
{
|
||||
int result = Success, i;
|
||||
int result, i;
|
||||
PanoramiXRes *draw, *port;
|
||||
REQUEST(xvStopVideoReq);
|
||||
REQUEST_SIZE_MATCH(xvStopVideoReq);
|
||||
|
||||
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
|
||||
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
|
||||
return BadDrawable;
|
||||
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadDrawable : result;
|
||||
|
||||
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->port, XvXRTPort, DixReadAccess)))
|
||||
return _XvBadPort;
|
||||
result = dixLookupResourceByType((pointer *)&port, stuff->port,
|
||||
XvXRTPort, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? _XvBadPort : result;
|
||||
|
||||
FOR_NSCREENS_BACKWARD(i) {
|
||||
if(port->info[i].id) {
|
||||
|
@ -1708,13 +1635,14 @@ XineramaXvSetPortAttribute(ClientPtr client)
|
|||
{
|
||||
REQUEST(xvSetPortAttributeReq);
|
||||
PanoramiXRes *port;
|
||||
int result = Success, i;
|
||||
int result, i;
|
||||
|
||||
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
|
||||
|
||||
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->port, XvXRTPort, DixReadAccess)))
|
||||
return _XvBadPort;
|
||||
result = dixLookupResourceByType((pointer *)&port, stuff->port,
|
||||
XvXRTPort, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? _XvBadPort : result;
|
||||
|
||||
FOR_NSCREENS_BACKWARD(i) {
|
||||
if(port->info[i].id) {
|
||||
|
@ -1733,21 +1661,24 @@ XineramaXvShmPutImage(ClientPtr client)
|
|||
PanoramiXRes *draw, *gc, *port;
|
||||
Bool send_event = stuff->send_event;
|
||||
Bool isRoot;
|
||||
int result = Success, i, x, y;
|
||||
int result, i, x, y;
|
||||
|
||||
REQUEST_SIZE_MATCH(xvShmPutImageReq);
|
||||
|
||||
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
|
||||
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
|
||||
return BadDrawable;
|
||||
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadDrawable : result;
|
||||
|
||||
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->gc, XRT_GC, DixReadAccess)))
|
||||
return BadGC;
|
||||
result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
|
||||
XRT_GC, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadGC : result;
|
||||
|
||||
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->port, XvXRTPort, DixReadAccess)))
|
||||
return _XvBadPort;
|
||||
result = dixLookupResourceByType((pointer *)&port, stuff->port,
|
||||
XvXRTPort, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? _XvBadPort : result;
|
||||
|
||||
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
||||
|
||||
|
@ -1782,21 +1713,24 @@ XineramaXvPutImage(ClientPtr client)
|
|||
REQUEST(xvPutImageReq);
|
||||
PanoramiXRes *draw, *gc, *port;
|
||||
Bool isRoot;
|
||||
int result = Success, i, x, y;
|
||||
int result, i, x, y;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
|
||||
|
||||
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
|
||||
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
|
||||
return BadDrawable;
|
||||
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadDrawable : result;
|
||||
|
||||
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->gc, XRT_GC, DixReadAccess)))
|
||||
return BadGC;
|
||||
result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
|
||||
XRT_GC, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadGC : result;
|
||||
|
||||
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->port, XvXRTPort, DixReadAccess)))
|
||||
return _XvBadPort;
|
||||
result = dixLookupResourceByType((pointer *)&port, stuff->port,
|
||||
XvXRTPort, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? _XvBadPort : result;
|
||||
|
||||
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
||||
|
||||
|
@ -1827,21 +1761,24 @@ XineramaXvPutVideo(ClientPtr client)
|
|||
REQUEST(xvPutImageReq);
|
||||
PanoramiXRes *draw, *gc, *port;
|
||||
Bool isRoot;
|
||||
int result = Success, i, x, y;
|
||||
int result, i, x, y;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xvPutVideoReq);
|
||||
|
||||
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
|
||||
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
|
||||
return BadDrawable;
|
||||
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadDrawable : result;
|
||||
|
||||
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->gc, XRT_GC, DixReadAccess)))
|
||||
return BadGC;
|
||||
result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
|
||||
XRT_GC, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadGC : result;
|
||||
|
||||
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->port, XvXRTPort, DixReadAccess)))
|
||||
return _XvBadPort;
|
||||
result = dixLookupResourceByType((pointer *)&port, stuff->port,
|
||||
XvXRTPort, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? _XvBadPort : result;
|
||||
|
||||
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
||||
|
||||
|
@ -1872,21 +1809,24 @@ XineramaXvPutStill(ClientPtr client)
|
|||
REQUEST(xvPutImageReq);
|
||||
PanoramiXRes *draw, *gc, *port;
|
||||
Bool isRoot;
|
||||
int result = Success, i, x, y;
|
||||
int result, i, x, y;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
|
||||
|
||||
if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
|
||||
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
|
||||
return BadDrawable;
|
||||
result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadDrawable : result;
|
||||
|
||||
if(!(gc = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->gc, XRT_GC, DixReadAccess)))
|
||||
return BadGC;
|
||||
result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
|
||||
XRT_GC, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadGC : result;
|
||||
|
||||
if(!(port = (PanoramiXRes *)SecurityLookupIDByType(
|
||||
client, stuff->port, XvXRTPort, DixReadAccess)))
|
||||
return _XvBadPort;
|
||||
result = dixLookupResourceByType((pointer *)&port, stuff->port,
|
||||
XvXRTPort, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? _XvBadPort : result;
|
||||
|
||||
isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;
|
||||
|
||||
|
|
18
Xext/xvdix.h
18
Xext/xvdix.h
|
@ -201,17 +201,13 @@ typedef struct _XvPortRec {
|
|||
DevUnion devPriv;
|
||||
} XvPortRec, *XvPortPtr;
|
||||
|
||||
#define LOOKUP_PORT(_id, client)\
|
||||
((XvPortPtr)LookupIDByType(_id, XvRTPort))
|
||||
|
||||
#define LOOKUP_ENCODING(_id, client)\
|
||||
((XvEncodingPtr)LookupIDByType(_id, XvRTEncoding))
|
||||
|
||||
#define LOOKUP_VIDEONOTIFY_LIST(_id, client)\
|
||||
((XvVideoNotifyPtr)LookupIDByType(_id, XvRTVideoNotifyList))
|
||||
|
||||
#define LOOKUP_PORTNOTIFY_LIST(_id, client)\
|
||||
((XvPortNotifyPtr)LookupIDByType(_id, XvRTPortNotifyList))
|
||||
#define VALIDATE_XV_PORT(portID, pPort, mode)\
|
||||
{\
|
||||
int rc = dixLookupResourceByType((pointer *)&(pPort), portID,\
|
||||
XvRTPort, client, mode);\
|
||||
if (rc != Success)\
|
||||
return (rc == BadValue) ? _XvBadPort : rc;\
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int version, revision;
|
||||
|
|
|
@ -523,7 +523,8 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
|
|||
xvEvent event;
|
||||
XvVideoNotifyPtr pn;
|
||||
|
||||
pn = (XvVideoNotifyPtr)LookupIDByType(pDraw->id, XvRTVideoNotifyList);
|
||||
dixLookupResourceByType((pointer *)&pn, pDraw->id, XvRTVideoNotifyList,
|
||||
serverClient, DixReadAccess);
|
||||
|
||||
while (pn)
|
||||
{
|
||||
|
@ -905,10 +906,14 @@ XvdiSelectVideoNotify(
|
|||
BOOL onoff
|
||||
){
|
||||
XvVideoNotifyPtr pn,tpn,fpn;
|
||||
int rc;
|
||||
|
||||
/* FIND VideoNotify LIST */
|
||||
|
||||
pn = (XvVideoNotifyPtr)LookupIDByType(pDraw->id, XvRTVideoNotifyList);
|
||||
rc = dixLookupResourceByType((pointer *)&pn, pDraw->id, XvRTVideoNotifyList,
|
||||
client, DixWriteAccess);
|
||||
if (rc != Success && rc != BadValue)
|
||||
return rc;
|
||||
|
||||
/* IF ONE DONES'T EXIST AND NO MASK, THEN JUST RETURN */
|
||||
|
||||
|
|
57
Xext/xvmc.c
57
Xext/xvmc.c
|
@ -136,10 +136,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
|
|||
REQUEST(xvmcListSurfaceTypesReq);
|
||||
REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client))) {
|
||||
client->errorValue = stuff->port;
|
||||
return _XvBadPort;
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if(XvMCScreenKey) { /* any adaptors at all */
|
||||
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
|
||||
|
@ -192,10 +189,7 @@ ProcXvMCCreateContext(ClientPtr client)
|
|||
REQUEST(xvmcCreateContextReq);
|
||||
REQUEST_SIZE_MATCH(xvmcCreateContextReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client))) {
|
||||
client->errorValue = stuff->port;
|
||||
return _XvBadPort;
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
pScreen = pPort->pAdaptor->pScreen;
|
||||
|
||||
|
@ -273,11 +267,15 @@ ProcXvMCCreateContext(ClientPtr client)
|
|||
static int
|
||||
ProcXvMCDestroyContext(ClientPtr client)
|
||||
{
|
||||
pointer val;
|
||||
int rc;
|
||||
REQUEST(xvmcDestroyContextReq);
|
||||
REQUEST_SIZE_MATCH(xvmcDestroyContextReq);
|
||||
|
||||
if(!LookupIDByType(stuff->context_id, XvMCRTContext))
|
||||
return (XvMCBadContext + XvMCErrorBase);
|
||||
rc = dixLookupResourceByType(&val, stuff->context_id, XvMCRTContext,
|
||||
client, DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? XvMCBadContext + XvMCErrorBase : rc;
|
||||
|
||||
FreeResource(stuff->context_id, RT_NONE);
|
||||
|
||||
|
@ -297,8 +295,10 @@ ProcXvMCCreateSurface(ClientPtr client)
|
|||
REQUEST(xvmcCreateSurfaceReq);
|
||||
REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
|
||||
|
||||
if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext)))
|
||||
return (XvMCBadContext + XvMCErrorBase);
|
||||
result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id,
|
||||
XvMCRTContext, client, DixUseAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? XvMCBadContext + XvMCErrorBase : result;
|
||||
|
||||
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
|
||||
|
||||
|
@ -337,11 +337,15 @@ ProcXvMCCreateSurface(ClientPtr client)
|
|||
static int
|
||||
ProcXvMCDestroySurface(ClientPtr client)
|
||||
{
|
||||
pointer val;
|
||||
int rc;
|
||||
REQUEST(xvmcDestroySurfaceReq);
|
||||
REQUEST_SIZE_MATCH(xvmcDestroySurfaceReq);
|
||||
|
||||
if(!LookupIDByType(stuff->surface_id, XvMCRTSurface))
|
||||
return (XvMCBadSurface + XvMCErrorBase);
|
||||
rc = dixLookupResourceByType(&val, stuff->surface_id, XvMCRTSurface,
|
||||
client, DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? XvMCBadSurface + XvMCErrorBase : rc;
|
||||
|
||||
FreeResource(stuff->surface_id, RT_NONE);
|
||||
|
||||
|
@ -363,8 +367,10 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
|||
REQUEST(xvmcCreateSubpictureReq);
|
||||
REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq);
|
||||
|
||||
if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext)))
|
||||
return (XvMCBadContext + XvMCErrorBase);
|
||||
result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id,
|
||||
XvMCRTContext, client, DixUseAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? XvMCBadContext + XvMCErrorBase : result;
|
||||
|
||||
pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
|
||||
|
||||
|
@ -448,11 +454,15 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
|||
static int
|
||||
ProcXvMCDestroySubpicture(ClientPtr client)
|
||||
{
|
||||
pointer val;
|
||||
int rc;
|
||||
REQUEST(xvmcDestroySubpictureReq);
|
||||
REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq);
|
||||
|
||||
if(!LookupIDByType(stuff->subpicture_id, XvMCRTSubpicture))
|
||||
return (XvMCBadSubpicture + XvMCErrorBase);
|
||||
rc = dixLookupResourceByType(&val, stuff->subpicture_id, XvMCRTSubpicture,
|
||||
client, DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? XvMCBadSubpicture + XvMCErrorBase : rc;
|
||||
|
||||
FreeResource(stuff->subpicture_id, RT_NONE);
|
||||
|
||||
|
@ -475,10 +485,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
|
|||
REQUEST(xvmcListSubpictureTypesReq);
|
||||
REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq);
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client))) {
|
||||
client->errorValue = stuff->port;
|
||||
return _XvBadPort;
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
pScreen = pPort->pAdaptor->pScreen;
|
||||
|
||||
|
@ -571,11 +578,7 @@ ProcXvMCGetDRInfo(ClientPtr client)
|
|||
REQUEST(xvmcGetDRInfoReq);
|
||||
REQUEST_SIZE_MATCH(xvmcGetDRInfoReq);
|
||||
|
||||
|
||||
if(!(pPort = LOOKUP_PORT(stuff->port, client))) {
|
||||
client->errorValue = stuff->port;
|
||||
return _XvBadPort;
|
||||
}
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
pScreen = pPort->pAdaptor->pScreen;
|
||||
pScreenPriv = XVMC_GET_PRIVATE(pScreen);
|
||||
|
|
|
@ -94,12 +94,10 @@ int ProcXChangeDeviceCursor(ClientPtr client)
|
|||
}
|
||||
else
|
||||
{
|
||||
pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor,
|
||||
RT_CURSOR, DixReadAccess);
|
||||
if (!pCursor)
|
||||
{
|
||||
return BadCursor;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor,
|
||||
RT_CURSOR, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? BadCursor : rc;
|
||||
}
|
||||
|
||||
ChangeWindowDeviceCursor(pWin, pDev, pCursor);
|
||||
|
|
|
@ -88,7 +88,7 @@ ProcXExtendedGrabDevice(ClientPtr client)
|
|||
{
|
||||
xExtendedGrabDeviceReply rep;
|
||||
DeviceIntPtr dev;
|
||||
int rc = Success,
|
||||
int rc,
|
||||
errval = 0,
|
||||
i;
|
||||
WindowPtr grab_window,
|
||||
|
@ -145,14 +145,12 @@ ProcXExtendedGrabDevice(ClientPtr client)
|
|||
|
||||
if (stuff->cursor)
|
||||
{
|
||||
cursor = (CursorPtr)SecurityLookupIDByType(client,
|
||||
stuff->cursor,
|
||||
RT_CURSOR,
|
||||
DixReadAccess);
|
||||
if (!cursor)
|
||||
{
|
||||
rc = dixLookupResourceByType((pointer *)&cursor, stuff->cursor,
|
||||
RT_CURSOR, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
errval = stuff->cursor;
|
||||
rc = BadCursor;
|
||||
rc = (rc == BadValue) ? BadCursor : rc;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,11 +58,10 @@ typedef struct _DamageExt {
|
|||
} DamageExtRec, *DamageExtPtr;
|
||||
|
||||
#define VERIFY_DAMAGEEXT(pDamageExt, rid, client, mode) { \
|
||||
pDamageExt = SecurityLookupIDByType (client, rid, DamageExtType, mode); \
|
||||
if (!pDamageExt) { \
|
||||
client->errorValue = rid; \
|
||||
return DamageErrorBase + BadDamage; \
|
||||
} \
|
||||
int rc = dixLookupResourceByType((pointer *)&(pDamageExt), rid, \
|
||||
DamageExtType, client, mode); \
|
||||
if (rc != Success) \
|
||||
return (rc == BadValue) ? DamageErrorBase + BadDamage : rc; \
|
||||
}
|
||||
|
||||
void
|
||||
|
|
33
dbe/dbe.c
33
dbe/dbe.c
|
@ -411,20 +411,23 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
|
|||
{
|
||||
REQUEST(xDbeDeallocateBackBufferNameReq);
|
||||
DbeWindowPrivPtr pDbeWindowPriv;
|
||||
int i;
|
||||
int rc, i;
|
||||
pointer val;
|
||||
|
||||
|
||||
REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq);
|
||||
|
||||
/* Buffer name must be valid */
|
||||
if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
|
||||
stuff->buffer, dbeWindowPrivResType, DixDestroyAccess)) ||
|
||||
!(SecurityLookupIDByType(client, stuff->buffer, dbeDrawableResType,
|
||||
DixDestroyAccess)))
|
||||
{
|
||||
client->errorValue = stuff->buffer;
|
||||
return(dbeErrorBase + DbeBadBuffer);
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pDbeWindowPriv, stuff->buffer,
|
||||
dbeWindowPrivResType, client,
|
||||
DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? dbeErrorBase + DbeBadBuffer : rc;
|
||||
|
||||
rc = dixLookupResourceByType(&val, stuff->buffer, dbeDrawableResType,
|
||||
client, DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? dbeErrorBase + DbeBadBuffer : rc;
|
||||
|
||||
/* Make sure that the id is valid for the window.
|
||||
* This is paranoid code since we already looked up the ID by type
|
||||
|
@ -833,19 +836,21 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
|
|||
REQUEST(xDbeGetBackBufferAttributesReq);
|
||||
xDbeGetBackBufferAttributesReply rep;
|
||||
DbeWindowPrivPtr pDbeWindowPriv;
|
||||
int n;
|
||||
int rc, n;
|
||||
|
||||
|
||||
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
|
||||
|
||||
if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
|
||||
stuff->buffer, dbeWindowPrivResType, DixGetAttrAccess)))
|
||||
rc = dixLookupResourceByType((pointer *)&pDbeWindowPriv, stuff->buffer,
|
||||
dbeWindowPrivResType, client,
|
||||
DixGetAttrAccess);
|
||||
if (rc == Success)
|
||||
{
|
||||
rep.attributes = None;
|
||||
rep.attributes = pDbeWindowPriv->pWindow->drawable.id;
|
||||
}
|
||||
else
|
||||
{
|
||||
rep.attributes = pDbeWindowPriv->pWindow->drawable.id;
|
||||
rep.attributes = None;
|
||||
}
|
||||
|
||||
rep.type = X_Reply;
|
||||
|
|
|
@ -893,9 +893,9 @@ AllocColor (ColormapPtr pmap,
|
|||
if (pmap->mid != pmap->pScreen->defColormap &&
|
||||
pmap->pVisual->vid == pmap->pScreen->rootVisual)
|
||||
{
|
||||
ColormapPtr prootmap = (ColormapPtr)
|
||||
SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap,
|
||||
RT_COLORMAP, DixReadAccess);
|
||||
ColormapPtr prootmap;
|
||||
dixLookupResourceByType((pointer *)&prootmap, pmap->pScreen->defColormap,
|
||||
RT_COLORMAP, clients[client], DixReadAccess);
|
||||
|
||||
if (pmap->class == prootmap->class)
|
||||
FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb,
|
||||
|
@ -910,9 +910,9 @@ AllocColor (ColormapPtr pmap,
|
|||
if (pmap->mid != pmap->pScreen->defColormap &&
|
||||
pmap->pVisual->vid == pmap->pScreen->rootVisual)
|
||||
{
|
||||
ColormapPtr prootmap = (ColormapPtr)
|
||||
SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap,
|
||||
RT_COLORMAP, DixReadAccess);
|
||||
ColormapPtr prootmap;
|
||||
dixLookupResourceByType((pointer *)&prootmap, pmap->pScreen->defColormap,
|
||||
RT_COLORMAP, clients[client], DixReadAccess);
|
||||
|
||||
if (pmap->class == prootmap->class)
|
||||
{
|
||||
|
@ -1550,12 +1550,14 @@ FreePixels(ColormapPtr pmap, int client)
|
|||
int
|
||||
FreeClientPixels (pointer value, XID fakeid)
|
||||
{
|
||||
ColormapPtr pmap;
|
||||
colorResource *pcr = (colorResource *)value;
|
||||
pointer pmap;
|
||||
colorResource *pcr = value;
|
||||
int rc;
|
||||
|
||||
pmap = (ColormapPtr) LookupIDByType(pcr->mid, RT_COLORMAP);
|
||||
if (pmap)
|
||||
FreePixels(pmap, pcr->client);
|
||||
rc = dixLookupResourceByType(&pmap, pcr->mid, RT_COLORMAP, serverClient,
|
||||
DixRemoveAccess);
|
||||
if (rc == Success)
|
||||
FreePixels((ColormapPtr)pmap, pcr->client);
|
||||
xfree(pcr);
|
||||
return Success;
|
||||
}
|
||||
|
|
|
@ -545,8 +545,9 @@ CreateRootCursor(char *unused1, unsigned int unused2)
|
|||
if (err != Success)
|
||||
return NullCursor;
|
||||
|
||||
cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT);
|
||||
if (!cursorfont)
|
||||
err = dixLookupResourceByType((pointer *)&cursorfont, fontID, RT_FONT,
|
||||
serverClient, DixReadAccess);
|
||||
if (err != Success)
|
||||
return NullCursor;
|
||||
if (AllocGlyphCursor(fontID, 0, fontID, 1, 0, 0, 0, ~0, ~0, ~0,
|
||||
&curs, serverClient, (XID)0) != Success)
|
||||
|
|
|
@ -148,14 +148,18 @@ SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes,
|
|||
pointer
|
||||
LookupIDByType(XID id, RESTYPE rtype)
|
||||
{
|
||||
return SecurityLookupIDByType(NullClient, id, rtype, DixUnknownAccess);
|
||||
pointer val;
|
||||
dixLookupResourceByType(&val, id, rtype, NullClient, DixUnknownAccess);
|
||||
return val;
|
||||
}
|
||||
|
||||
/* replaced by dixLookupResourceByClass */
|
||||
pointer
|
||||
LookupIDByClass(XID id, RESTYPE classes)
|
||||
{
|
||||
return SecurityLookupIDByClass(NullClient, id, classes, DixUnknownAccess);
|
||||
pointer val;
|
||||
dixLookupResourceByClass(&val, id, classes, NullClient, DixUnknownAccess);
|
||||
return val;
|
||||
}
|
||||
|
||||
/* replaced by dixLookupResourceBy{Type,Class} */
|
||||
|
|
|
@ -1252,12 +1252,13 @@ int
|
|||
ProcCloseFont(ClientPtr client)
|
||||
{
|
||||
FontPtr pFont;
|
||||
int rc;
|
||||
REQUEST(xResourceReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xResourceReq);
|
||||
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
|
||||
DixDestroyAccess);
|
||||
if ( pFont != (FontPtr)NULL) /* id was valid */
|
||||
rc = dixLookupResourceByType((pointer *)&pFont, stuff->id, RT_FONT,
|
||||
client, DixDestroyAccess);
|
||||
if (rc == Success)
|
||||
{
|
||||
FreeResource(stuff->id, RT_NONE);
|
||||
return(client->noClientException);
|
||||
|
@ -1265,7 +1266,7 @@ ProcCloseFont(ClientPtr client)
|
|||
else
|
||||
{
|
||||
client->errorValue = stuff->id;
|
||||
return (BadFont);
|
||||
return (rc == BadValue) ? BadFont : rc;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -137,8 +137,9 @@ SetDefaultFont(char *defaultfontname)
|
|||
(unsigned) strlen(defaultfontname), defaultfontname);
|
||||
if (err != Success)
|
||||
return FALSE;
|
||||
pf = (FontPtr) LookupIDByType(fid, RT_FONT);
|
||||
if (pf == (FontPtr) NULL)
|
||||
err = dixLookupResourceByType((pointer *)&pf, fid, RT_FONT, serverClient,
|
||||
DixReadAccess);
|
||||
if (err != Success)
|
||||
return FALSE;
|
||||
defaultFont = pf;
|
||||
return TRUE;
|
||||
|
@ -1201,17 +1202,18 @@ doPolyText(ClientPtr client, PTclosurePtr c)
|
|||
}
|
||||
|
||||
/* Make sure our drawable hasn't disappeared while we slept. */
|
||||
if (c->slept &&
|
||||
c->pDraw &&
|
||||
c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did,
|
||||
RC_DRAWABLE, DixWriteAccess))
|
||||
if (c->slept && c->pDraw)
|
||||
{
|
||||
/* Our drawable has disappeared. Treat like client died... ask
|
||||
the FPE code to clean up after client and avoid further
|
||||
rendering while we clean up after ourself. */
|
||||
fpe = c->pGC->font->fpe;
|
||||
(*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
|
||||
c->pDraw = (DrawablePtr)0;
|
||||
DrawablePtr pDraw;
|
||||
dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
|
||||
if (c->pDraw != pDraw) {
|
||||
/* Our drawable has disappeared. Treat like client died... ask
|
||||
the FPE code to clean up after client and avoid further
|
||||
rendering while we clean up after ourself. */
|
||||
fpe = c->pGC->font->fpe;
|
||||
(*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
|
||||
c->pDraw = (DrawablePtr)0;
|
||||
}
|
||||
}
|
||||
|
||||
client_state = c->slept ? SLEEPING : NEVER_SLEPT;
|
||||
|
@ -1233,12 +1235,11 @@ doPolyText(ClientPtr client, PTclosurePtr c)
|
|||
| ((Font)*(c->pElt+3)) << 8
|
||||
| ((Font)*(c->pElt+2)) << 16
|
||||
| ((Font)*(c->pElt+1)) << 24;
|
||||
pFont = (FontPtr)SecurityLookupIDByType(client, fid, RT_FONT,
|
||||
DixReadAccess);
|
||||
if (!pFont)
|
||||
err = dixLookupResourceByType((pointer *)&pFont, fid, RT_FONT,
|
||||
client, DixReadAccess);
|
||||
if (err != Success)
|
||||
{
|
||||
client->errorValue = fid;
|
||||
err = BadFont;
|
||||
err = (err == BadValue) ? BadFont : err;
|
||||
/* restore pFont and fid for step 4 (described below) */
|
||||
pFont = oldpFont;
|
||||
fid = oldfid;
|
||||
|
@ -1486,17 +1487,18 @@ doImageText(ClientPtr client, ITclosurePtr c)
|
|||
}
|
||||
|
||||
/* Make sure our drawable hasn't disappeared while we slept. */
|
||||
if (c->slept &&
|
||||
c->pDraw &&
|
||||
c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did,
|
||||
RC_DRAWABLE, DixWriteAccess))
|
||||
if (c->slept && c->pDraw)
|
||||
{
|
||||
/* Our drawable has disappeared. Treat like client died... ask
|
||||
the FPE code to clean up after client. */
|
||||
fpe = c->pGC->font->fpe;
|
||||
(*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
|
||||
err = Success;
|
||||
goto bail;
|
||||
DrawablePtr pDraw;
|
||||
dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
|
||||
if (c->pDraw != pDraw) {
|
||||
/* Our drawable has disappeared. Treat like client died... ask
|
||||
the FPE code to clean up after client. */
|
||||
fpe = c->pGC->font->fpe;
|
||||
(*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
|
||||
err = Success;
|
||||
goto bail;
|
||||
}
|
||||
}
|
||||
|
||||
lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, c->itemSize, c->data);
|
||||
|
@ -2013,8 +2015,9 @@ FreeFonts(void)
|
|||
FontPtr
|
||||
find_old_font(XID id)
|
||||
{
|
||||
return (FontPtr) SecurityLookupIDByType(NullClient, id, RT_NONE,
|
||||
DixUnknownAccess);
|
||||
pointer pFont;
|
||||
dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess);
|
||||
return (FontPtr)pFont;
|
||||
}
|
||||
|
||||
Font
|
||||
|
|
|
@ -240,14 +240,9 @@ dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
|
|||
int
|
||||
dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access)
|
||||
{
|
||||
GCPtr pTmp = (GCPtr)SecurityLookupIDByType(client, id, RT_GC, access);
|
||||
if (pTmp) {
|
||||
*pGC = pTmp;
|
||||
return Success;
|
||||
}
|
||||
client->errorValue = id;
|
||||
*pGC = NULL;
|
||||
return BadGC;
|
||||
int rc;
|
||||
rc = dixLookupResourceByType((pointer *)pGC, id, RT_GC, client, access);
|
||||
return (rc == BadValue) ? BadGC : rc;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
13
dix/events.c
13
dix/events.c
|
@ -506,16 +506,17 @@ XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin)
|
|||
PanoramiXNumScreens*sizeof(WindowPtr));
|
||||
} else {
|
||||
PanoramiXRes *win;
|
||||
int i;
|
||||
int rc, i;
|
||||
|
||||
win = (PanoramiXRes*)LookupIDByType(pWin->drawable.id, XRT_WINDOW);
|
||||
|
||||
if(!win)
|
||||
rc = dixLookupResourceByType((pointer *)&win, pWin->drawable.id,
|
||||
XRT_WINDOW, serverClient, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return FALSE;
|
||||
|
||||
for(i = 0; i < PanoramiXNumScreens; i++) {
|
||||
pSprite->windows[i] = LookupIDByType(win->info[i].id, RT_WINDOW);
|
||||
if(!pSprite->windows[i]) /* window is being unmapped */
|
||||
rc = dixLookupWindow(pSprite->windows + i, win->info[i].id,
|
||||
serverClient, DixReadAccess);
|
||||
if (rc != Success) /* window is being unmapped */
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -392,13 +392,16 @@ unsigned int
|
|||
GetXIDList(ClientPtr pClient, unsigned count, XID *pids)
|
||||
{
|
||||
unsigned int found = 0;
|
||||
XID id = pClient->clientAsMask;
|
||||
XID rc, id = pClient->clientAsMask;
|
||||
XID maxid;
|
||||
pointer val;
|
||||
|
||||
maxid = id | RESOURCE_ID_MASK;
|
||||
while ( (found < count) && (id <= maxid) )
|
||||
{
|
||||
if (!LookupIDByClass(id, RC_ANY))
|
||||
rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
|
||||
DixGetAttrAccess);
|
||||
if (rc == BadValue)
|
||||
{
|
||||
pids[found++] = id;
|
||||
}
|
||||
|
@ -826,6 +829,8 @@ FreeAllResources(void)
|
|||
Bool
|
||||
LegalNewID(XID id, ClientPtr client)
|
||||
{
|
||||
pointer val;
|
||||
int rc;
|
||||
|
||||
#ifdef PANORAMIX
|
||||
XID minid, maxid;
|
||||
|
@ -838,9 +843,16 @@ LegalNewID(XID id, ClientPtr client)
|
|||
return TRUE;
|
||||
}
|
||||
#endif /* PANORAMIX */
|
||||
return ((client->clientAsMask == (id & ~RESOURCE_ID_MASK)) &&
|
||||
((clientTable[client->index].expectID <= id) ||
|
||||
!LookupIDByClass(id, RC_ANY)));
|
||||
if (client->clientAsMask == (id & ~RESOURCE_ID_MASK))
|
||||
{
|
||||
if (clientTable[client->index].expectID <= id)
|
||||
return TRUE;
|
||||
|
||||
rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient,
|
||||
DixGetAttrAccess);
|
||||
return (rc == BadValue);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
56
dix/window.c
56
dix/window.c
|
@ -2795,6 +2795,7 @@ UnrealizeTree(
|
|||
WindowPtr pChild;
|
||||
UnrealizeWindowProcPtr Unrealize;
|
||||
MarkUnrealizedWindowProcPtr MarkUnrealizedWindow;
|
||||
int rc;
|
||||
|
||||
Unrealize = pWin->drawable.pScreen->UnrealizeWindow;
|
||||
MarkUnrealizedWindow = pWin->drawable.pScreen->MarkUnrealizedWindow;
|
||||
|
@ -2808,9 +2809,10 @@ UnrealizeTree(
|
|||
#ifdef PANORAMIX
|
||||
if(!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) {
|
||||
PanoramiXRes *win;
|
||||
win = (PanoramiXRes*)LookupIDByType(pChild->drawable.id,
|
||||
XRT_WINDOW);
|
||||
if(win)
|
||||
rc = dixLookupResourceByType((pointer *)&win,
|
||||
pChild->drawable.id, XRT_WINDOW,
|
||||
serverClient, DixWriteAccess);
|
||||
if (rc == Success)
|
||||
win->u.win.visibility = VisibilityNotViewable;
|
||||
}
|
||||
#endif
|
||||
|
@ -3072,7 +3074,7 @@ SendVisibilityNotify(WindowPtr pWin)
|
|||
if(!noPanoramiXExtension) {
|
||||
PanoramiXRes *win;
|
||||
WindowPtr pWin2;
|
||||
int i, Scrnum;
|
||||
int rc, i, Scrnum;
|
||||
|
||||
Scrnum = pWin->drawable.pScreen->myNum;
|
||||
|
||||
|
@ -3086,9 +3088,10 @@ SendVisibilityNotify(WindowPtr pWin)
|
|||
for(i = 0; i < PanoramiXNumScreens; i++) {
|
||||
if(i == Scrnum) continue;
|
||||
|
||||
pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW);
|
||||
rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
|
||||
DixWriteAccess);
|
||||
|
||||
if (pWin2) {
|
||||
if (rc == Success) {
|
||||
if(pWin2->visibility == VisibilityPartiallyObscured)
|
||||
return;
|
||||
|
||||
|
@ -3098,17 +3101,19 @@ SendVisibilityNotify(WindowPtr pWin)
|
|||
break;
|
||||
case VisibilityPartiallyObscured:
|
||||
if(Scrnum) {
|
||||
pWin2 = (WindowPtr)LookupIDByType(win->info[0].id, RT_WINDOW);
|
||||
if (pWin2) pWin = pWin2;
|
||||
rc = dixLookupWindow(&pWin2, win->info[0].id, serverClient,
|
||||
DixWriteAccess);
|
||||
if (rc == Success) pWin = pWin2;
|
||||
}
|
||||
break;
|
||||
case VisibilityFullyObscured:
|
||||
for(i = 0; i < PanoramiXNumScreens; i++) {
|
||||
if(i == Scrnum) continue;
|
||||
|
||||
pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW);
|
||||
rc = dixLookupWindow(&pWin2, win->info[i].id, serverClient,
|
||||
DixWriteAccess);
|
||||
|
||||
if (pWin2) {
|
||||
if (rc == Success) {
|
||||
if(pWin2->visibility != VisibilityFullyObscured)
|
||||
return;
|
||||
|
||||
|
@ -3739,7 +3744,7 @@ DrawLogo(WindowPtr pWin)
|
|||
int x, y;
|
||||
unsigned int width, height, size;
|
||||
GC *pGC;
|
||||
int thin, gap, d31;
|
||||
int rc, thin, gap, d31;
|
||||
DDXPointRec poly[4];
|
||||
ChangeGCVal fore[2], back[2];
|
||||
xrgb rgb[2];
|
||||
|
@ -3760,20 +3765,23 @@ DrawLogo(WindowPtr pWin)
|
|||
fore[0].val = pScreen->whitePixel;
|
||||
else
|
||||
fore[0].val = pScreen->blackPixel;
|
||||
if ((pWin->backgroundState == BackgroundPixel) &&
|
||||
(cmap = (ColormapPtr)LookupIDByType(wColormap (pWin), RT_COLORMAP))) {
|
||||
Pixel querypixels[2];
|
||||
if (pWin->backgroundState == BackgroundPixel) {
|
||||
rc = dixLookupResourceByType((pointer *)&cmap, wColormap(pWin),
|
||||
RT_COLORMAP, serverClient, DixReadAccess);
|
||||
if (rc == Success) {
|
||||
Pixel querypixels[2];
|
||||
|
||||
querypixels[0] = fore[0].val;
|
||||
querypixels[1] = pWin->background.pixel;
|
||||
QueryColors(cmap, 2, querypixels, rgb);
|
||||
if ((rgb[0].red == rgb[1].red) &&
|
||||
(rgb[0].green == rgb[1].green) &&
|
||||
(rgb[0].blue == rgb[1].blue)) {
|
||||
if (fore[0].val == pScreen->blackPixel)
|
||||
fore[0].val = pScreen->whitePixel;
|
||||
else
|
||||
fore[0].val = pScreen->blackPixel;
|
||||
querypixels[0] = fore[0].val;
|
||||
querypixels[1] = pWin->background.pixel;
|
||||
QueryColors(cmap, 2, querypixels, rgb);
|
||||
if ((rgb[0].red == rgb[1].red) &&
|
||||
(rgb[0].green == rgb[1].green) &&
|
||||
(rgb[0].blue == rgb[1].blue)) {
|
||||
if (fore[0].val == pScreen->blackPixel)
|
||||
fore[0].val = pScreen->whitePixel;
|
||||
else
|
||||
fore[0].val = pScreen->blackPixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
fore[1].val = FillSolid;
|
||||
|
|
|
@ -85,8 +85,10 @@ fbUninstallColormap(ColormapPtr pmap)
|
|||
{
|
||||
if (pmap->mid != pmap->pScreen->defColormap)
|
||||
{
|
||||
curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
|
||||
RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&curpmap,
|
||||
pmap->pScreen->defColormap,
|
||||
RT_COLORMAP,
|
||||
serverClient, DixInstallAccess);
|
||||
(*pmap->pScreen->InstallColormap)(curpmap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,7 +217,8 @@ KdUninstallColormap (ColormapPtr pCmap)
|
|||
return;
|
||||
|
||||
/* install default if on same fb */
|
||||
defMap = (ColormapPtr) LookupIDByType(defMapID, RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&defMap, defMapID, RT_COLORMAP,
|
||||
serverClient, DixInstallAccess);
|
||||
if (defMap && KdColormapFb (defMap) == fb)
|
||||
(*pCmap->pScreen->InstallColormap)(defMap);
|
||||
else
|
||||
|
|
|
@ -508,8 +508,10 @@ vfbUninstallColormap(ColormapPtr pmap)
|
|||
{
|
||||
if (pmap->mid != pmap->pScreen->defColormap)
|
||||
{
|
||||
curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
|
||||
RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&curpmap,
|
||||
pmap->pScreen->defColormap,
|
||||
RT_COLORMAP, serverClient,
|
||||
DixInstallAccess);
|
||||
(*pmap->pScreen->InstallColormap)(curpmap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,8 +211,8 @@ Bool xf86HandleColormaps(
|
|||
ComputeGamma(pScreenPriv);
|
||||
|
||||
/* get the default map */
|
||||
|
||||
pDefMap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&pDefMap, pScreen->defColormap,
|
||||
RT_COLORMAP, serverClient, DixInstallAccess);
|
||||
|
||||
if(!CMapAllocateColormapPrivate(pDefMap)) {
|
||||
CMapUnwrapScreen(pScreen);
|
||||
|
|
|
@ -420,6 +420,7 @@ static int
|
|||
ProcXDGAInstallColormap(ClientPtr client)
|
||||
{
|
||||
ColormapPtr cmap;
|
||||
int rc;
|
||||
REQUEST(xXDGAInstallColormapReq);
|
||||
|
||||
if (stuff->screen > screenInfo.numScreens)
|
||||
|
@ -430,13 +431,13 @@ ProcXDGAInstallColormap(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
|
||||
|
||||
cmap = (ColormapPtr)LookupIDByType(stuff->cmap, RT_COLORMAP);
|
||||
if (cmap) {
|
||||
rc = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, RT_COLORMAP,
|
||||
client, DixInstallAccess);
|
||||
if (rc == Success) {
|
||||
DGAInstallCmap(cmap);
|
||||
return (client->noClientException);
|
||||
} else {
|
||||
client->errorValue = stuff->cmap;
|
||||
return (BadColor);
|
||||
return (rc == BadValue) ? BadColor : rc;
|
||||
}
|
||||
|
||||
return (client->noClientException);
|
||||
|
@ -858,6 +859,7 @@ static int
|
|||
ProcXF86DGAInstallColormap(ClientPtr client)
|
||||
{
|
||||
ColormapPtr pcmp;
|
||||
int rc;
|
||||
REQUEST(xXF86DGAInstallColormapReq);
|
||||
|
||||
if (stuff->screen > screenInfo.numScreens)
|
||||
|
@ -871,13 +873,13 @@ ProcXF86DGAInstallColormap(ClientPtr client)
|
|||
if (!DGAActive(stuff->screen))
|
||||
return (DGAErrorBase + XF86DGADirectNotActivated);
|
||||
|
||||
pcmp = (ColormapPtr )LookupIDByType(stuff->id, RT_COLORMAP);
|
||||
if (pcmp) {
|
||||
rc = dixLookupResourceByType((pointer *)&pcmp, stuff->id, RT_COLORMAP,
|
||||
client, DixInstallAccess);
|
||||
if (rc == Success) {
|
||||
DGAInstallCmap(pcmp);
|
||||
return (client->noClientException);
|
||||
} else {
|
||||
client->errorValue = stuff->id;
|
||||
return (BadColor);
|
||||
return (rc == BadValue) ? BadColor : rc;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1363,11 +1363,12 @@ Bool
|
|||
DRIDrawablePrivDelete(pointer pResource, XID id)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
int rc;
|
||||
|
||||
id = (XID)pResource;
|
||||
pWin = LookupIDByType(id, RT_WINDOW);
|
||||
rc = dixLookupWindow(&pWin, id, serverClient, DixGetAttrAccess);
|
||||
|
||||
if (pWin) {
|
||||
if (rc == Success) {
|
||||
DRIDrawablePrivPtr pDRIDrwPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
|
||||
|
||||
if (!pDRIDrwPriv)
|
||||
|
|
|
@ -277,8 +277,8 @@ vgaUninstallColormap(pmap)
|
|||
if ( pmap != miInstalledMaps[pmap->pScreen->myNum] )
|
||||
return;
|
||||
|
||||
defColormap = (ColormapPtr) LookupIDByType( pmap->pScreen->defColormap,
|
||||
RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&defColormap, pmap->pScreen->defColormap,
|
||||
RT_COLORMAP, serverClient, DixInstallAccess);
|
||||
|
||||
if (defColormap == miInstalledMaps[pmap->pScreen->myNum])
|
||||
return;
|
||||
|
|
|
@ -242,16 +242,16 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen)
|
|||
WindowPtr pWin;
|
||||
Visual *visual;
|
||||
ColormapPtr pCmap;
|
||||
|
||||
|
||||
pWin = xnestWindowPtr(icws.windows[0]);
|
||||
visual = xnestVisualFromID(pScreen, wVisual(pWin));
|
||||
|
||||
if (visual == xnestDefaultVisual(pScreen))
|
||||
pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin),
|
||||
RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin),
|
||||
RT_COLORMAP, serverClient, DixUseAccess);
|
||||
else
|
||||
pCmap = (ColormapPtr)LookupIDByType(pScreen->defColormap,
|
||||
RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&pCmap, pScreen->defColormap,
|
||||
RT_COLORMAP, serverClient, DixUseAccess);
|
||||
|
||||
XSetWindowColormap(xnestDisplay,
|
||||
xnestDefaultWindows[pScreen->myNum],
|
||||
|
@ -302,7 +302,8 @@ xnestDirectInstallColormaps(ScreenPtr pScreen)
|
|||
for (i = 0; i < n; i++) {
|
||||
ColormapPtr pCmap;
|
||||
|
||||
pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&pCmap, pCmapIDs[i], RT_COLORMAP,
|
||||
serverClient, DixInstallAccess);
|
||||
if (pCmap)
|
||||
XInstallColormap(xnestDisplay, xnestColormap(pCmap));
|
||||
}
|
||||
|
@ -321,7 +322,8 @@ xnestDirectUninstallColormaps(ScreenPtr pScreen)
|
|||
for (i = 0; i < n; i++) {
|
||||
ColormapPtr pCmap;
|
||||
|
||||
pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&pCmap, pCmapIDs[i], RT_COLORMAP,
|
||||
serverClient, DixUninstallAccess);
|
||||
if (pCmap)
|
||||
XUninstallColormap(xnestDisplay, xnestColormap(pCmap));
|
||||
}
|
||||
|
@ -365,8 +367,10 @@ xnestUninstallColormap(ColormapPtr pCmap)
|
|||
{
|
||||
if (pCmap->mid != pCmap->pScreen->defColormap)
|
||||
{
|
||||
pCurCmap = (ColormapPtr)LookupIDByType(pCmap->pScreen->defColormap,
|
||||
RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&pCurCmap,
|
||||
pCmap->pScreen->defColormap,
|
||||
RT_COLORMAP,
|
||||
serverClient, DixInstallAccess);
|
||||
(*pCmap->pScreen->InstallColormap)(pCurCmap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,8 @@ xnestCreateWindow(WindowPtr pWin)
|
|||
visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
|
||||
mask |= CWColormap;
|
||||
if (pWin->optional->colormap) {
|
||||
pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin),
|
||||
RT_COLORMAP, serverClient, DixUseAccess);
|
||||
attributes.colormap = xnestColormap(pCmap);
|
||||
}
|
||||
else
|
||||
|
@ -104,7 +105,8 @@ xnestCreateWindow(WindowPtr pWin)
|
|||
}
|
||||
else { /* root windows have their own colormaps at creation time */
|
||||
visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin));
|
||||
pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin),
|
||||
RT_COLORMAP, serverClient, DixUseAccess);
|
||||
mask |= CWColormap;
|
||||
attributes.colormap = xnestColormap(pCmap);
|
||||
}
|
||||
|
@ -338,7 +340,8 @@ xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
|
|||
if (mask & CWColormap) {
|
||||
ColormapPtr pCmap;
|
||||
|
||||
pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&pCmap, wColormap(pWin), RT_COLORMAP,
|
||||
serverClient, DixUseAccess);
|
||||
|
||||
attributes.colormap = xnestColormap(pCmap);
|
||||
|
||||
|
|
|
@ -87,8 +87,10 @@ miUninstallColormap(ColormapPtr pmap)
|
|||
{
|
||||
if (pmap->mid != pmap->pScreen->defColormap)
|
||||
{
|
||||
curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
|
||||
RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&curpmap,
|
||||
pmap->pScreen->defColormap,
|
||||
RT_COLORMAP, serverClient,
|
||||
DixUseAccess);
|
||||
(*pmap->pScreen->InstallColormap)(curpmap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -436,7 +436,7 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
|
|||
return;
|
||||
}
|
||||
realWin = win->info[0].id;
|
||||
pWin = LookupIDByType(realWin, RT_WINDOW);
|
||||
dixLookupWindow(&pWin, realWin, serverClient, DixSendAccess);
|
||||
}
|
||||
if(x || y || scrnum)
|
||||
for (i = 0; i < numRects; i++) {
|
||||
|
|
|
@ -279,7 +279,8 @@ RRFreeClient (pointer data, XID id)
|
|||
|
||||
pRREvent = (RREventPtr) data;
|
||||
pWin = pRREvent->window;
|
||||
pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, RREventType);
|
||||
dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
||||
RREventType, serverClient, DixDestroyAccess);
|
||||
if (pHead) {
|
||||
pPrev = 0;
|
||||
for (pCur = *pHead; pCur && pCur != pRREvent; pCur=pCur->next)
|
||||
|
@ -357,7 +358,8 @@ TellChanged (WindowPtr pWin, pointer value)
|
|||
rrScrPriv(pScreen);
|
||||
int i;
|
||||
|
||||
pHead = (RREventPtr *) LookupIDByType (pWin->drawable.id, RREventType);
|
||||
dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
||||
RREventType, serverClient, DixReadAccess);
|
||||
if (!pHead)
|
||||
return WT_WALKCHILDREN;
|
||||
|
||||
|
|
|
@ -340,15 +340,29 @@ extern _X_EXPORT RESTYPE RRClientType, RREventType; /* resource types for event
|
|||
extern _X_EXPORT DevPrivateKey RRClientPrivateKey;
|
||||
extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType;
|
||||
|
||||
#define LookupOutput(client,id,a) ((RROutputPtr) \
|
||||
(SecurityLookupIDByType (client, id, \
|
||||
RROutputType, a)))
|
||||
#define LookupCrtc(client,id,a) ((RRCrtcPtr) \
|
||||
(SecurityLookupIDByType (client, id, \
|
||||
RRCrtcType, a)))
|
||||
#define LookupMode(client,id,a) ((RRModePtr) \
|
||||
(SecurityLookupIDByType (client, id, \
|
||||
RRModeType, a)))
|
||||
#define VERIFY_RR_OUTPUT(id, ptr, a)\
|
||||
{\
|
||||
int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
|
||||
RROutputType, client, a);\
|
||||
if (rc != Success)\
|
||||
return (rc == BadValue) ? RRErrorBase + BadRROutput : rc;\
|
||||
}
|
||||
|
||||
#define VERIFY_RR_CRTC(id, ptr, a)\
|
||||
{\
|
||||
int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
|
||||
RRCrtcType, client, a);\
|
||||
if (rc != Success)\
|
||||
return (rc == BadValue) ? RRErrorBase + BadRRCrtc : rc;\
|
||||
}
|
||||
|
||||
#define VERIFY_RR_MODE(id, ptr, a)\
|
||||
{\
|
||||
int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
|
||||
RRModeType, client, a);\
|
||||
if (rc != Success)\
|
||||
return (rc == BadValue) ? RRErrorBase + BadRRMode : rc;\
|
||||
}
|
||||
|
||||
#define GetRRClient(pClient) ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey))
|
||||
#define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient)
|
||||
|
|
|
@ -658,10 +658,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
|
|||
BoxRec panned_area;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
|
||||
crtc = LookupCrtc(client, stuff->crtc, DixReadAccess);
|
||||
|
||||
if (!crtc)
|
||||
return RRErrorBase + BadRRCrtc;
|
||||
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
||||
|
||||
/* All crtcs must be associated with screens before client
|
||||
* requests are processed
|
||||
|
@ -775,17 +772,13 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
|||
TimeStamp configTime;
|
||||
TimeStamp time;
|
||||
Rotation rotation;
|
||||
int i, j;
|
||||
int rc, i, j;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq);
|
||||
numOutputs = (stuff->length - (SIZEOF (xRRSetCrtcConfigReq) >> 2));
|
||||
|
||||
crtc = LookupIDByType (stuff->crtc, RRCrtcType);
|
||||
if (!crtc)
|
||||
{
|
||||
client->errorValue = stuff->crtc;
|
||||
return RRErrorBase + BadRRCrtc;
|
||||
}
|
||||
VERIFY_RR_CRTC(stuff->crtc, crtc, DixSetAttrAccess);
|
||||
|
||||
if (stuff->mode == None)
|
||||
{
|
||||
mode = NULL;
|
||||
|
@ -794,12 +787,7 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
|||
}
|
||||
else
|
||||
{
|
||||
mode = LookupIDByType (stuff->mode, RRModeType);
|
||||
if (!mode)
|
||||
{
|
||||
client->errorValue = stuff->mode;
|
||||
return RRErrorBase + BadRRMode;
|
||||
}
|
||||
VERIFY_RR_MODE(stuff->mode, mode, DixSetAttrAccess);
|
||||
if (numOutputs == 0)
|
||||
return BadMatch;
|
||||
}
|
||||
|
@ -815,13 +803,13 @@ ProcRRSetCrtcConfig (ClientPtr client)
|
|||
outputIds = (RROutput *) (stuff + 1);
|
||||
for (i = 0; i < numOutputs; i++)
|
||||
{
|
||||
outputs[i] = (RROutputPtr) LookupIDByType (outputIds[i], RROutputType);
|
||||
if (!outputs[i])
|
||||
rc = dixLookupResourceByType((pointer *)(outputs + i), outputIds[i],
|
||||
RROutputType, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
client->errorValue = outputIds[i];
|
||||
if (outputs)
|
||||
xfree (outputs);
|
||||
return RRErrorBase + BadRROutput;
|
||||
return (rc == BadValue) ? RRErrorBase + BadRROutput : rc;
|
||||
}
|
||||
/* validate crtc for this output */
|
||||
for (j = 0; j < outputs[i]->numCrtcs; j++)
|
||||
|
@ -1027,10 +1015,7 @@ ProcRRGetPanning (ClientPtr client)
|
|||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRGetPanningReq);
|
||||
crtc = LookupCrtc(client, stuff->crtc, DixReadAccess);
|
||||
|
||||
if (!crtc)
|
||||
return RRErrorBase + BadRRCrtc;
|
||||
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
||||
|
||||
/* All crtcs must be associated with screens before client
|
||||
* requests are processed
|
||||
|
@ -1100,11 +1085,7 @@ ProcRRSetPanning (ClientPtr client)
|
|||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRSetPanningReq);
|
||||
crtc = LookupCrtc(client, stuff->crtc, DixReadAccess);
|
||||
|
||||
if (!crtc)
|
||||
return RRErrorBase + BadRRCrtc;
|
||||
|
||||
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
||||
|
||||
/* All crtcs must be associated with screens before client
|
||||
* requests are processed
|
||||
|
@ -1175,9 +1156,7 @@ ProcRRGetCrtcGammaSize (ClientPtr client)
|
|||
int n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq);
|
||||
crtc = LookupCrtc (client, stuff->crtc, DixReadAccess);
|
||||
if (!crtc)
|
||||
return RRErrorBase + BadRRCrtc;
|
||||
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
||||
|
||||
/* Gamma retrieval failed, any better error? */
|
||||
if (!RRCrtcGammaGet(crtc))
|
||||
|
@ -1207,9 +1186,7 @@ ProcRRGetCrtcGamma (ClientPtr client)
|
|||
char *extra = NULL;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq);
|
||||
crtc = LookupCrtc (client, stuff->crtc, DixReadAccess);
|
||||
if (!crtc)
|
||||
return RRErrorBase + BadRRCrtc;
|
||||
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
||||
|
||||
/* Gamma retrieval failed, any better error? */
|
||||
if (!RRCrtcGammaGet(crtc))
|
||||
|
@ -1252,9 +1229,7 @@ ProcRRSetCrtcGamma (ClientPtr client)
|
|||
CARD16 *red, *green, *blue;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq);
|
||||
crtc = LookupCrtc (client, stuff->crtc, DixWriteAccess);
|
||||
if (!crtc)
|
||||
return RRErrorBase + BadRRCrtc;
|
||||
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
||||
|
||||
len = client->req_len - (sizeof (xRRSetCrtcGammaReq) >> 2);
|
||||
if (len < (stuff->size * 3 + 1) >> 1)
|
||||
|
@ -1287,9 +1262,7 @@ ProcRRSetCrtcTransform (ClientPtr client)
|
|||
int nparams;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq);
|
||||
crtc = LookupCrtc (client, stuff->crtc, DixWriteAccess);
|
||||
if (!crtc)
|
||||
return RRErrorBase + BadRRCrtc;
|
||||
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
||||
|
||||
PictTransform_from_xRenderTransform (&transform, &stuff->transform);
|
||||
pixman_f_transform_from_pixman_transform (&f_transform, &transform);
|
||||
|
@ -1372,9 +1345,7 @@ ProcRRGetCrtcTransform (ClientPtr client)
|
|||
char *extra;
|
||||
|
||||
REQUEST_SIZE_MATCH (xRRGetCrtcTransformReq);
|
||||
crtc = LookupCrtc (client, stuff->crtc, DixWriteAccess);
|
||||
if (!crtc)
|
||||
return RRErrorBase + BadRRCrtc;
|
||||
VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
|
||||
|
||||
pending = &crtc->client_pending_transform;
|
||||
current = &crtc->client_current_transform;
|
||||
|
|
|
@ -79,9 +79,10 @@ ProcRRSelectInput (ClientPtr client)
|
|||
rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
pHead = (RREventPtr *)SecurityLookupIDByType(client,
|
||||
pWin->drawable.id, RREventType,
|
||||
DixWriteAccess);
|
||||
rc = dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
||||
RREventType, client, DixWriteAccess);
|
||||
if (rc != Success && rc != BadValue)
|
||||
return rc;
|
||||
|
||||
if (stuff->enable & (RRScreenChangeNotifyMask|
|
||||
RRCrtcChangeNotifyMask|
|
||||
|
|
|
@ -332,12 +332,8 @@ ProcRRDestroyMode (ClientPtr client)
|
|||
RRModePtr mode;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRDestroyModeReq);
|
||||
mode = LookupIDByType (stuff->mode, RRModeType);
|
||||
if (!mode)
|
||||
{
|
||||
client->errorValue = stuff->mode;
|
||||
return RRErrorBase + BadRRMode;
|
||||
}
|
||||
VERIFY_RR_MODE(stuff->mode, mode, DixDestroyAccess);
|
||||
|
||||
if (!mode->userScreen)
|
||||
return BadMatch;
|
||||
if (mode->refcnt > 1)
|
||||
|
@ -354,20 +350,8 @@ ProcRRAddOutputMode (ClientPtr client)
|
|||
RROutputPtr output;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRAddOutputModeReq);
|
||||
output = LookupOutput(client, stuff->output, DixReadAccess);
|
||||
|
||||
if (!output)
|
||||
{
|
||||
client->errorValue = stuff->output;
|
||||
return RRErrorBase + BadRROutput;
|
||||
}
|
||||
|
||||
mode = LookupIDByType (stuff->mode, RRModeType);
|
||||
if (!mode)
|
||||
{
|
||||
client->errorValue = stuff->mode;
|
||||
return RRErrorBase + BadRRMode;
|
||||
}
|
||||
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
|
||||
VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess);
|
||||
|
||||
return RROutputAddUserMode (output, mode);
|
||||
}
|
||||
|
@ -380,20 +364,8 @@ ProcRRDeleteOutputMode (ClientPtr client)
|
|||
RROutputPtr output;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq);
|
||||
output = LookupOutput(client, stuff->output, DixReadAccess);
|
||||
|
||||
if (!output)
|
||||
{
|
||||
client->errorValue = stuff->output;
|
||||
return RRErrorBase + BadRROutput;
|
||||
}
|
||||
|
||||
mode = LookupIDByType (stuff->mode, RRModeType);
|
||||
if (!mode)
|
||||
{
|
||||
client->errorValue = stuff->mode;
|
||||
return RRErrorBase + BadRRMode;
|
||||
}
|
||||
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
|
||||
VERIFY_RR_MODE(stuff->mode, mode, DixUseAccess);
|
||||
|
||||
return RROutputDeleteUserMode (output, mode);
|
||||
}
|
||||
|
|
|
@ -448,13 +448,7 @@ ProcRRGetOutputInfo (ClientPtr client)
|
|||
int i, n;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRGetOutputInfoReq);
|
||||
output = LookupOutput(client, stuff->output, DixReadAccess);
|
||||
|
||||
if (!output)
|
||||
{
|
||||
client->errorValue = stuff->output;
|
||||
return RRErrorBase + BadRROutput;
|
||||
}
|
||||
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
|
||||
|
||||
pScreen = output->pScreen;
|
||||
pScrPriv = rrGetScrPriv(pScreen);
|
||||
|
@ -569,24 +563,16 @@ ProcRRSetOutputPrimary(ClientPtr client)
|
|||
RROutputPtr output = NULL;
|
||||
WindowPtr pWin;
|
||||
rrScrPrivPtr pScrPriv;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq);
|
||||
|
||||
pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW,
|
||||
DixReadAccess);
|
||||
|
||||
if (!pWin) {
|
||||
client->errorValue = stuff->window;
|
||||
return BadWindow;
|
||||
}
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (stuff->output) {
|
||||
output = LookupOutput(client, stuff->output, DixReadAccess);
|
||||
|
||||
if (!output) {
|
||||
client->errorValue = stuff->output;
|
||||
return RRErrorBase + BadRROutput;
|
||||
}
|
||||
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
|
||||
|
||||
if (output->pScreen != pWin->drawable.pScreen) {
|
||||
client->errorValue = stuff->window;
|
||||
|
@ -608,16 +594,13 @@ ProcRRGetOutputPrimary(ClientPtr client)
|
|||
rrScrPrivPtr pScrPriv;
|
||||
xRRGetOutputPrimaryReply rep;
|
||||
RROutputPtr primary = NULL;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq);
|
||||
|
||||
pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW,
|
||||
DixReadAccess);
|
||||
|
||||
if (!pWin) {
|
||||
client->errorValue = stuff->window;
|
||||
return BadWindow;
|
||||
}
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
pScrPriv = rrGetScrPriv(pWin->drawable.pScreen);
|
||||
if (pScrPriv)
|
||||
|
|
|
@ -31,7 +31,8 @@ DeliverPropertyEvent(WindowPtr pWin, void *value)
|
|||
RREventPtr *pHead, pRREvent;
|
||||
ClientPtr client;
|
||||
|
||||
pHead = LookupIDByType(pWin->drawable.id, RREventType);
|
||||
dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
|
||||
RREventType, serverClient, DixReadAccess);
|
||||
if (!pHead)
|
||||
return WT_WALKCHILDREN;
|
||||
|
||||
|
@ -419,10 +420,7 @@ ProcRRListOutputProperties (ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq);
|
||||
|
||||
output = LookupOutput (client, stuff->output, DixReadAccess);
|
||||
|
||||
if (!output)
|
||||
return RRErrorBase + BadRROutput;
|
||||
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
|
||||
|
||||
for (prop = output->properties; prop; prop = prop->next)
|
||||
numProps++;
|
||||
|
@ -466,10 +464,7 @@ ProcRRQueryOutputProperty (ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq);
|
||||
|
||||
output = LookupOutput (client, stuff->output, DixReadAccess);
|
||||
|
||||
if (!output)
|
||||
return RRErrorBase + BadRROutput;
|
||||
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
|
||||
|
||||
prop = RRQueryOutputProperty (output, stuff->property);
|
||||
if (!prop)
|
||||
|
@ -513,10 +508,7 @@ ProcRRConfigureOutputProperty (ClientPtr client)
|
|||
|
||||
REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq);
|
||||
|
||||
output = LookupOutput (client, stuff->output, DixReadAccess);
|
||||
|
||||
if (!output)
|
||||
return RRErrorBase + BadRROutput;
|
||||
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
|
||||
|
||||
num_valid = stuff->length - (sizeof (xRRConfigureOutputPropertyReq) >> 2);
|
||||
return RRConfigureOutputProperty (output, stuff->property,
|
||||
|
@ -558,9 +550,7 @@ ProcRRChangeOutputProperty (ClientPtr client)
|
|||
totalSize = len * sizeInBytes;
|
||||
REQUEST_FIXED_SIZE(xRRChangeOutputPropertyReq, totalSize);
|
||||
|
||||
output = LookupOutput (client, stuff->output, DixWriteAccess);
|
||||
if (!output)
|
||||
return RRErrorBase + BadRROutput;
|
||||
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
|
||||
|
||||
if (!ValidAtom(stuff->property))
|
||||
{
|
||||
|
@ -590,9 +580,7 @@ ProcRRDeleteOutputProperty (ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq);
|
||||
UpdateCurrentTime();
|
||||
output = LookupOutput (client, stuff->output, DixWriteAccess);
|
||||
if (!output)
|
||||
return RRErrorBase + BadRROutput;
|
||||
VERIFY_RR_OUTPUT(stuff->output, output, DixReadAccess);
|
||||
|
||||
if (!ValidAtom(stuff->property))
|
||||
{
|
||||
|
@ -619,11 +607,8 @@ ProcRRGetOutputProperty (ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq);
|
||||
if (stuff->delete)
|
||||
UpdateCurrentTime();
|
||||
output = LookupOutput (client, stuff->output,
|
||||
stuff->delete ? DixWriteAccess :
|
||||
DixReadAccess);
|
||||
if (!output)
|
||||
return RRErrorBase + BadRROutput;
|
||||
VERIFY_RR_OUTPUT(stuff->output, output,
|
||||
stuff->delete ? DixWriteAccess : DixReadAccess);
|
||||
|
||||
if (!ValidAtom(stuff->property))
|
||||
{
|
||||
|
|
|
@ -127,11 +127,10 @@ static int numEnabledRCAPs;
|
|||
* returns an error.
|
||||
*/
|
||||
#define VERIFY_CONTEXT(_pContext, _contextid, _client) { \
|
||||
(_pContext) = (RecordContextPtr)LookupIDByType((_contextid), RTContext); \
|
||||
if (!(_pContext)) { \
|
||||
(_client)->errorValue = (_contextid); \
|
||||
return RecordErrorBase + XRecordBadContext; \
|
||||
} \
|
||||
int rc = dixLookupResourceByType((pointer *)&(_pContext), _contextid, \
|
||||
RTContext, _client, DixUseAccess); \
|
||||
if (rc != Success) \
|
||||
return (rc == BadValue) ? RecordErrorBase + XRecordBadContext : rc; \
|
||||
}
|
||||
|
||||
static int RecordDeleteContext(
|
||||
|
|
|
@ -410,8 +410,9 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
|
|||
return TRUE;
|
||||
|
||||
if (format->index.vid == pScreen->rootVisual) {
|
||||
format->index.pColormap =
|
||||
(ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
|
||||
dixLookupResourceByType((pointer *)&format->index.pColormap,
|
||||
pScreen->defColormap, RT_COLORMAP,
|
||||
serverClient, DixGetAttrAccess);
|
||||
} else {
|
||||
VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid);
|
||||
if (CreateColormap(FakeClientID (0), pScreen, pVisual,
|
||||
|
|
|
@ -409,11 +409,10 @@ extern _X_EXPORT RESTYPE GlyphSetType;
|
|||
#define SetPictureWindow(w,p) dixSetPrivate(&(w)->devPrivates, PictureWindowPrivateKey, p)
|
||||
|
||||
#define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\
|
||||
pPicture = SecurityLookupIDByType(client, pid, PictureType, mode);\
|
||||
if (!pPicture) { \
|
||||
client->errorValue = pid; \
|
||||
return err; \
|
||||
} \
|
||||
int rc = dixLookupResourceByType((pointer)&(pPicture), pid,\
|
||||
PictureType, client, mode);\
|
||||
if (rc != Success)\
|
||||
return (rc == BadValue) ? err : rc;\
|
||||
}
|
||||
|
||||
#define VERIFY_ALPHA(pPicture, pid, client, mode, err) {\
|
||||
|
|
170
render/render.c
170
render/render.c
|
@ -509,7 +509,7 @@ static int
|
|||
ProcRenderQueryPictIndexValues (ClientPtr client)
|
||||
{
|
||||
PictFormatPtr pFormat;
|
||||
int num;
|
||||
int rc, num;
|
||||
int rlength;
|
||||
int i, n;
|
||||
REQUEST(xRenderQueryPictIndexValuesReq);
|
||||
|
@ -518,16 +518,11 @@ ProcRenderQueryPictIndexValues (ClientPtr client)
|
|||
|
||||
REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq);
|
||||
|
||||
pFormat = (PictFormatPtr) SecurityLookupIDByType (client,
|
||||
stuff->format,
|
||||
PictFormatType,
|
||||
DixReadAccess);
|
||||
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format,
|
||||
PictFormatType, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
|
||||
|
||||
if (!pFormat)
|
||||
{
|
||||
client->errorValue = stuff->format;
|
||||
return RenderErrBase + BadPictFormat;
|
||||
}
|
||||
if (pFormat->type != PictTypeIndexed)
|
||||
{
|
||||
client->errorValue = stuff->format;
|
||||
|
@ -592,15 +587,11 @@ ProcRenderCreatePicture (ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
pFormat = (PictFormatPtr) SecurityLookupIDByType (client,
|
||||
stuff->format,
|
||||
PictFormatType,
|
||||
DixReadAccess);
|
||||
if (!pFormat)
|
||||
{
|
||||
client->errorValue = stuff->format;
|
||||
return RenderErrBase + BadPictFormat;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format,
|
||||
PictFormatType, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
|
||||
|
||||
if (pFormat->depth != pDrawable->depth)
|
||||
return BadMatch;
|
||||
len = client->req_len - (sizeof(xRenderCreatePictureReq) >> 2);
|
||||
|
@ -740,7 +731,7 @@ ProcRenderScale (ClientPtr client)
|
|||
static int
|
||||
ProcRenderTrapezoids (ClientPtr client)
|
||||
{
|
||||
int ntraps;
|
||||
int rc, ntraps;
|
||||
PicturePtr pSrc, pDst;
|
||||
PictFormatPtr pFormat;
|
||||
REQUEST(xRenderTrapezoidsReq);
|
||||
|
@ -761,15 +752,10 @@ ProcRenderTrapezoids (ClientPtr client)
|
|||
return BadMatch;
|
||||
if (stuff->maskFormat)
|
||||
{
|
||||
pFormat = (PictFormatPtr) SecurityLookupIDByType (client,
|
||||
stuff->maskFormat,
|
||||
PictFormatType,
|
||||
DixReadAccess);
|
||||
if (!pFormat)
|
||||
{
|
||||
client->errorValue = stuff->maskFormat;
|
||||
return RenderErrBase + BadPictFormat;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
|
||||
PictFormatType, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
|
||||
}
|
||||
else
|
||||
pFormat = 0;
|
||||
|
@ -787,7 +773,7 @@ ProcRenderTrapezoids (ClientPtr client)
|
|||
static int
|
||||
ProcRenderTriangles (ClientPtr client)
|
||||
{
|
||||
int ntris;
|
||||
int rc, ntris;
|
||||
PicturePtr pSrc, pDst;
|
||||
PictFormatPtr pFormat;
|
||||
REQUEST(xRenderTrianglesReq);
|
||||
|
@ -808,15 +794,10 @@ ProcRenderTriangles (ClientPtr client)
|
|||
return BadMatch;
|
||||
if (stuff->maskFormat)
|
||||
{
|
||||
pFormat = (PictFormatPtr) SecurityLookupIDByType (client,
|
||||
stuff->maskFormat,
|
||||
PictFormatType,
|
||||
DixReadAccess);
|
||||
if (!pFormat)
|
||||
{
|
||||
client->errorValue = stuff->maskFormat;
|
||||
return RenderErrBase + BadPictFormat;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
|
||||
PictFormatType, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
|
||||
}
|
||||
else
|
||||
pFormat = 0;
|
||||
|
@ -834,7 +815,7 @@ ProcRenderTriangles (ClientPtr client)
|
|||
static int
|
||||
ProcRenderTriStrip (ClientPtr client)
|
||||
{
|
||||
int npoints;
|
||||
int rc, npoints;
|
||||
PicturePtr pSrc, pDst;
|
||||
PictFormatPtr pFormat;
|
||||
REQUEST(xRenderTrianglesReq);
|
||||
|
@ -855,15 +836,10 @@ ProcRenderTriStrip (ClientPtr client)
|
|||
return BadMatch;
|
||||
if (stuff->maskFormat)
|
||||
{
|
||||
pFormat = (PictFormatPtr) SecurityLookupIDByType (client,
|
||||
stuff->maskFormat,
|
||||
PictFormatType,
|
||||
DixReadAccess);
|
||||
if (!pFormat)
|
||||
{
|
||||
client->errorValue = stuff->maskFormat;
|
||||
return RenderErrBase + BadPictFormat;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
|
||||
PictFormatType, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
|
||||
}
|
||||
else
|
||||
pFormat = 0;
|
||||
|
@ -881,7 +857,7 @@ ProcRenderTriStrip (ClientPtr client)
|
|||
static int
|
||||
ProcRenderTriFan (ClientPtr client)
|
||||
{
|
||||
int npoints;
|
||||
int rc, npoints;
|
||||
PicturePtr pSrc, pDst;
|
||||
PictFormatPtr pFormat;
|
||||
REQUEST(xRenderTrianglesReq);
|
||||
|
@ -902,15 +878,10 @@ ProcRenderTriFan (ClientPtr client)
|
|||
return BadMatch;
|
||||
if (stuff->maskFormat)
|
||||
{
|
||||
pFormat = (PictFormatPtr) SecurityLookupIDByType (client,
|
||||
stuff->maskFormat,
|
||||
PictFormatType,
|
||||
DixReadAccess);
|
||||
if (!pFormat)
|
||||
{
|
||||
client->errorValue = stuff->maskFormat;
|
||||
return RenderErrBase + BadPictFormat;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
|
||||
PictFormatType, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
|
||||
}
|
||||
else
|
||||
pFormat = 0;
|
||||
|
@ -954,15 +925,11 @@ ProcRenderCreateGlyphSet (ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq);
|
||||
|
||||
LEGAL_NEW_RESOURCE(stuff->gsid, client);
|
||||
format = (PictFormatPtr) SecurityLookupIDByType (client,
|
||||
stuff->format,
|
||||
PictFormatType,
|
||||
DixReadAccess);
|
||||
if (!format)
|
||||
{
|
||||
client->errorValue = stuff->format;
|
||||
return RenderErrBase + BadPictFormat;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&format, stuff->format,
|
||||
PictFormatType, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
|
||||
|
||||
switch (format->depth) {
|
||||
case 1:
|
||||
f = GlyphFormat1;
|
||||
|
@ -1300,7 +1267,7 @@ ProcRenderCompositeGlyphs (ClientPtr client)
|
|||
int nlist;
|
||||
int space;
|
||||
int size;
|
||||
int n;
|
||||
int rc, n;
|
||||
|
||||
REQUEST(xRenderCompositeGlyphsReq);
|
||||
|
||||
|
@ -1327,28 +1294,18 @@ ProcRenderCompositeGlyphs (ClientPtr client)
|
|||
return BadMatch;
|
||||
if (stuff->maskFormat)
|
||||
{
|
||||
pFormat = (PictFormatPtr) SecurityLookupIDByType (client,
|
||||
stuff->maskFormat,
|
||||
PictFormatType,
|
||||
DixReadAccess);
|
||||
if (!pFormat)
|
||||
{
|
||||
client->errorValue = stuff->maskFormat;
|
||||
return RenderErrBase + BadPictFormat;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat,
|
||||
PictFormatType, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc;
|
||||
}
|
||||
else
|
||||
pFormat = 0;
|
||||
|
||||
glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client,
|
||||
stuff->glyphset,
|
||||
GlyphSetType,
|
||||
DixUseAccess);
|
||||
if (!glyphSet)
|
||||
{
|
||||
client->errorValue = stuff->glyphset;
|
||||
return RenderErrBase + BadGlyphSet;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset,
|
||||
GlyphSetType, client, DixUseAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc;
|
||||
|
||||
buffer = (CARD8 *) (stuff + 1);
|
||||
end = (CARD8 *) stuff + (client->req_len << 2);
|
||||
|
@ -1402,18 +1359,16 @@ ProcRenderCompositeGlyphs (ClientPtr client)
|
|||
if (buffer + sizeof (GlyphSet) < end)
|
||||
{
|
||||
memcpy(&gs, buffer, sizeof(GlyphSet));
|
||||
glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client,
|
||||
gs,
|
||||
GlyphSetType,
|
||||
DixUseAccess);
|
||||
if (!glyphSet)
|
||||
rc = dixLookupResourceByType((pointer *)&glyphSet, gs,
|
||||
GlyphSetType, client,
|
||||
DixUseAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
client->errorValue = gs;
|
||||
if (glyphsBase != glyphsLocal)
|
||||
xfree (glyphsBase);
|
||||
if (listsBase != listsLocal)
|
||||
xfree (listsBase);
|
||||
return RenderErrBase + BadGlyphSet;
|
||||
return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc;
|
||||
}
|
||||
}
|
||||
buffer += 4;
|
||||
|
@ -1902,13 +1857,12 @@ ProcRenderCreateAnimCursor (ClientPtr client)
|
|||
elt = (xAnimCursorElt *) (stuff + 1);
|
||||
for (i = 0; i < ncursor; i++)
|
||||
{
|
||||
cursors[i] = (CursorPtr)SecurityLookupIDByType(client, elt->cursor,
|
||||
RT_CURSOR, DixReadAccess);
|
||||
if (!cursors[i])
|
||||
ret = dixLookupResourceByType((pointer *)(cursors + 1), elt->cursor,
|
||||
RT_CURSOR, client, DixReadAccess);
|
||||
if (ret != Success)
|
||||
{
|
||||
xfree (cursors);
|
||||
client->errorValue = elt->cursor;
|
||||
return BadCursor;
|
||||
return (ret == BadValue) ? BadCursor : ret;
|
||||
}
|
||||
deltas[i] = elt->delay;
|
||||
elt++;
|
||||
|
@ -2689,11 +2643,10 @@ SProcRenderDispatch (ClientPtr client)
|
|||
#include "panoramiXsrv.h"
|
||||
|
||||
#define VERIFY_XIN_PICTURE(pPicture, pid, client, mode, err) {\
|
||||
pPicture = SecurityLookupIDByType(client, pid, XRT_PICTURE, mode);\
|
||||
if (!pPicture) { \
|
||||
client->errorValue = pid; \
|
||||
return err; \
|
||||
} \
|
||||
int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\
|
||||
XRT_PICTURE, client, mode);\
|
||||
if (rc != Success)\
|
||||
return (rc == BadValue) ? err : rc;\
|
||||
}
|
||||
|
||||
#define VERIFY_XIN_ALPHA(pPicture, pid, client, mode, err) {\
|
||||
|
@ -2713,12 +2666,13 @@ PanoramiXRenderCreatePicture (ClientPtr client)
|
|||
{
|
||||
REQUEST(xRenderCreatePictureReq);
|
||||
PanoramiXRes *refDraw, *newPict;
|
||||
int result = Success, j;
|
||||
int result, j;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq);
|
||||
if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass(
|
||||
client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess)))
|
||||
return BadDrawable;
|
||||
result = dixLookupResourceByClass((pointer *)&refDraw, stuff->drawable,
|
||||
XRC_DRAWABLE, client, DixWriteAccess);
|
||||
if (result != Success)
|
||||
return (result == BadValue) ? BadDrawable : result;
|
||||
if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
newPict->type = XRT_PICTURE;
|
||||
|
|
|
@ -203,6 +203,8 @@ XFixesSelectCursorInput (ClientPtr pClient,
|
|||
CARD32 eventMask)
|
||||
{
|
||||
CursorEventPtr *prev, e;
|
||||
pointer val;
|
||||
int rc;
|
||||
|
||||
for (prev = &cursorEvents; (e = *prev); prev = &e->next)
|
||||
{
|
||||
|
@ -235,7 +237,10 @@ XFixesSelectCursorInput (ClientPtr pClient,
|
|||
* Add a resource hanging from the window to
|
||||
* catch window destroy
|
||||
*/
|
||||
if (!LookupIDByType(pWindow->drawable.id, CursorWindowType))
|
||||
rc = dixLookupResourceByType( &val, pWindow->drawable.id,
|
||||
CursorWindowType, serverClient,
|
||||
DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
if (!AddResource (pWindow->drawable.id, CursorWindowType,
|
||||
(pointer) pWindow))
|
||||
{
|
||||
|
|
|
@ -133,6 +133,7 @@ XFixesSelectSelectionInput (ClientPtr pClient,
|
|||
WindowPtr pWindow,
|
||||
CARD32 eventMask)
|
||||
{
|
||||
pointer val;
|
||||
int rc;
|
||||
SelectionEventPtr *prev, e;
|
||||
|
||||
|
@ -173,7 +174,10 @@ XFixesSelectSelectionInput (ClientPtr pClient,
|
|||
* Add a resource hanging from the window to
|
||||
* catch window destroy
|
||||
*/
|
||||
if (!LookupIDByType(pWindow->drawable.id, SelectionWindowType))
|
||||
rc = dixLookupResourceByType (&val, pWindow->drawable.id,
|
||||
SelectionWindowType, serverClient,
|
||||
DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
if (!AddResource (pWindow->drawable.id, SelectionWindowType,
|
||||
(pointer) pWindow))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue