summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2006-12-15 15:50:46 -0500
committerEamon Walsh <ewalsh@moss-huskies.epoch.ncsc.mil>2006-12-15 15:50:46 -0500
commit25d5e0a629f82d95bd71daf9a920a70e095b5188 (patch)
treedece82b2dbb04f9810f37f8647eb1de1c2a85baa /dix
parent04c721854fbf1bd6379c165a53fab2bdc09961c0 (diff)
Convert callers of SecurityLookupWindow() to dixLookupWindow().
Diffstat (limited to 'dix')
-rw-r--r--dix/devices.c8
-rw-r--r--dix/dispatch.c214
-rw-r--r--dix/events.c117
-rw-r--r--dix/property.c45
4 files changed, 185 insertions, 199 deletions
diff --git a/dix/devices.c b/dix/devices.c
index e6a504954..9f4218414 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1840,16 +1840,16 @@ ProcGetMotionEvents(ClientPtr client)
WindowPtr pWin;
xTimecoord * coords = (xTimecoord *) NULL;
xGetMotionEventsReply rep;
- int i, count, xmin, xmax, ymin, ymax;
+ int i, count, xmin, xmax, ymin, ymax, rc;
unsigned long nEvents;
DeviceIntPtr mouse = inputInfo.pointer;
TimeStamp start, stop;
REQUEST(xGetMotionEventsReq);
REQUEST_SIZE_MATCH(xGetMotionEventsReq);
- pWin = SecurityLookupWindow(stuff->window, client, TRUE);
- if (!pWin)
- return BadWindow;
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
+ if (rc != Success)
+ return rc;
if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client);
rep.type = X_Reply;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 0421886a0..3060a4c39 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -554,17 +554,16 @@ ProcBadRequest(ClientPtr client)
int
ProcCreateWindow(ClientPtr client)
{
- register WindowPtr pParent, pWin;
+ WindowPtr pParent, pWin;
REQUEST(xCreateWindowReq);
- int result;
- int len;
+ int result, len, rc;
REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
LEGAL_NEW_RESOURCE(stuff->wid, client);
- if (!(pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client,
- DixWriteAccess)))
- return BadWindow;
+ rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess);
+ if (rc != Success)
+ return rc;
len = client->req_len - (sizeof(xCreateWindowReq) >> 2);
if (Ones(stuff->mask) != len)
return BadLength;
@@ -597,16 +596,15 @@ ProcCreateWindow(ClientPtr client)
int
ProcChangeWindowAttributes(register ClientPtr client)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
REQUEST(xChangeWindowAttributesReq);
register int result;
- int len;
+ int len, rc;
REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- DixWriteAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ if (rc != Success)
+ return rc;
len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2);
if (len != Ones(stuff->valueMask))
return BadLength;
@@ -623,15 +621,15 @@ ProcChangeWindowAttributes(register ClientPtr client)
int
ProcGetWindowAttributes(register ClientPtr client)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
REQUEST(xResourceReq);
xGetWindowAttributesReply wa;
+ int rc;
REQUEST_SIZE_MATCH(xResourceReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
GetWindowAttributes(pWin, client, &wa);
WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
return(client->noClientException);
@@ -640,14 +638,14 @@ ProcGetWindowAttributes(register ClientPtr client)
int
ProcDestroyWindow(register ClientPtr client)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
REQUEST(xResourceReq);
+ int rc;
REQUEST_SIZE_MATCH(xResourceReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
- DixDestroyAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess);
+ if (rc != Success)
+ return rc;
if (pWin->parent)
FreeResource(stuff->id, RT_NONE);
return(client->noClientException);
@@ -656,14 +654,14 @@ ProcDestroyWindow(register ClientPtr client)
int
ProcDestroySubwindows(register ClientPtr client)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
REQUEST(xResourceReq);
+ int rc;
REQUEST_SIZE_MATCH(xResourceReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
- DixDestroyAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess);
+ if (rc != Success)
+ return rc;
DestroySubwindows(pWin, client);
return(client->noClientException);
}
@@ -671,15 +669,14 @@ ProcDestroySubwindows(register ClientPtr client)
int
ProcChangeSaveSet(register ClientPtr client)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
REQUEST(xChangeSaveSetReq);
- register int result;
+ register int result, rc;
REQUEST_SIZE_MATCH(xChangeSaveSetReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
return BadMatch;
if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete))
@@ -700,19 +697,17 @@ ProcChangeSaveSet(register ClientPtr client)
int
ProcReparentWindow(register ClientPtr client)
{
- register WindowPtr pWin, pParent;
+ WindowPtr pWin, pParent;
REQUEST(xReparentWindowReq);
- register int result;
+ register int result, rc;
REQUEST_SIZE_MATCH(xReparentWindowReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- DixWriteAccess);
- if (!pWin)
- return(BadWindow);
- pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client,
- DixWriteAccess);
- if (!pParent)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ if (rc != Success)
+ return rc;
+ rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess);
+ if (rc != Success)
+ return rc;
if (SAME_SCREENS(pWin->drawable, pParent->drawable))
{
if ((pWin->backgroundState == ParentRelative) &&
@@ -735,14 +730,14 @@ ProcReparentWindow(register ClientPtr client)
int
ProcMapWindow(register ClientPtr client)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
REQUEST(xResourceReq);
+ int rc;
REQUEST_SIZE_MATCH(xResourceReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
MapWindow(pWin, client);
/* update cache to say it is mapped */
return(client->noClientException);
@@ -751,14 +746,14 @@ ProcMapWindow(register ClientPtr client)
int
ProcMapSubwindows(register ClientPtr client)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
REQUEST(xResourceReq);
+ int rc;
REQUEST_SIZE_MATCH(xResourceReq);
- pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
MapSubwindows(pWin, client);
/* update cache to say it is mapped */
return(client->noClientException);
@@ -767,14 +762,14 @@ ProcMapSubwindows(register ClientPtr client)
int
ProcUnmapWindow(register ClientPtr client)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
REQUEST(xResourceReq);
+ int rc;
REQUEST_SIZE_MATCH(xResourceReq);
- pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
UnmapWindow(pWin, FALSE);
/* update cache to say it is mapped */
return(client->noClientException);
@@ -783,14 +778,14 @@ ProcUnmapWindow(register ClientPtr client)
int
ProcUnmapSubwindows(register ClientPtr client)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
REQUEST(xResourceReq);
+ int rc;
REQUEST_SIZE_MATCH(xResourceReq);
- pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
UnmapSubwindows(pWin);
return(client->noClientException);
}
@@ -798,16 +793,15 @@ ProcUnmapSubwindows(register ClientPtr client)
int
ProcConfigureWindow(register ClientPtr client)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
REQUEST(xConfigureWindowReq);
register int result;
- int len;
+ int len, rc;
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
- pWin = (WindowPtr)SecurityLookupWindow( stuff->window, client,
- DixWriteAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ if (rc != Success)
+ return rc;
len = client->req_len - (sizeof(xConfigureWindowReq) >> 2);
if (Ones((Mask)stuff->mask) != len)
return BadLength;
@@ -822,8 +816,9 @@ ProcConfigureWindow(register ClientPtr client)
int
ProcCirculateWindow(register ClientPtr client)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
REQUEST(xCirculateWindowReq);
+ int rc;
REQUEST_SIZE_MATCH(xCirculateWindowReq);
if ((stuff->direction != RaiseLowest) &&
@@ -832,10 +827,9 @@ ProcCirculateWindow(register ClientPtr client)
client->errorValue = stuff->direction;
return BadValue;
}
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- DixWriteAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ if (rc != Success)
+ return rc;
CirculateWindow(pWin, (int)stuff->direction, client);
return(client->noClientException);
}
@@ -903,16 +897,15 @@ int
ProcQueryTree(register ClientPtr client)
{
xQueryTreeReply reply;
- int numChildren = 0;
- register WindowPtr pChild, pWin, pHead;
+ int rc, numChildren = 0;
+ WindowPtr pChild, pWin, pHead;
Window *childIDs = (Window *)NULL;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
reply.type = X_Reply;
reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
reply.sequenceNumber = client->sequence;
@@ -1025,10 +1018,9 @@ ProcSetSelectionOwner(register ClientPtr client)
return Success;
if (stuff->window != None)
{
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
+ int rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
else
pWin = (WindowPtr)None;
@@ -1142,12 +1134,12 @@ ProcConvertSelection(register ClientPtr client)
xEvent event;
WindowPtr pWin;
REQUEST(xConvertSelectionReq);
+ int rc;
REQUEST_SIZE_MATCH(xConvertSelectionReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->requestor, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target));
if (stuff->property != None)
@@ -1262,18 +1254,17 @@ ProcTranslateCoords(register ClientPtr client)
{
REQUEST(xTranslateCoordsReq);
- register WindowPtr pWin, pDst;
+ WindowPtr pWin, pDst;
xTranslateCoordsReply rep;
+ int rc;
REQUEST_SIZE_MATCH(xTranslateCoordsReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
- pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client,
- DixReadAccess);
- if (!pDst)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
+ rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
@@ -1762,13 +1753,13 @@ int
ProcClearToBackground(register ClientPtr client)
{
REQUEST(xClearAreaReq);
- register WindowPtr pWin;
+ WindowPtr pWin;
+ int rc;
REQUEST_SIZE_MATCH(xClearAreaReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- DixWriteAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ if (rc != Success)
+ return rc;
if (pWin->drawable.class == InputOnly)
{
client->errorValue = stuff->window;
@@ -2496,7 +2487,7 @@ ProcCreateColormap(register ClientPtr client)
VisualPtr pVisual;
ColormapPtr pmap;
Colormap mid;
- register WindowPtr pWin;
+ WindowPtr pWin;
ScreenPtr pScreen;
REQUEST(xCreateColormapReq);
int i, result;
@@ -2510,10 +2501,9 @@ ProcCreateColormap(register ClientPtr client)
}
mid = stuff->mid;
LEGAL_NEW_RESOURCE(mid, client);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
+ result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (result != Success)
+ return result;
pScreen = pWin->drawable.pScreen;
for (i = 0, pVisual = pScreen->visuals;
@@ -2631,16 +2621,14 @@ int
ProcListInstalledColormaps(register ClientPtr client)
{
xListInstalledColormapsReply *preply;
- int nummaps;
+ int nummaps, rc;
WindowPtr pWin;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
- DixReadAccess);
-
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
preply = (xListInstalledColormapsReply *)
ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) +
diff --git a/dix/events.c b/dix/events.c
index c7cf73e46..0053f42d4 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2228,16 +2228,15 @@ static int
XineramaWarpPointer(ClientPtr client)
{
WindowPtr dest = NULL;
- int x, y;
+ int x, y, rc;
REQUEST(xWarpPointerReq);
- if (stuff->dstWid != None)
- {
- dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess);
- if (!dest)
- return BadWindow;
+ if (stuff->dstWid != None) {
+ rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
x = sprite.hotPhys.x;
y = sprite.hotPhys.y;
@@ -2248,8 +2247,9 @@ XineramaWarpPointer(ClientPtr client)
XID winID = stuff->srcWid;
WindowPtr source;
- source = SecurityLookupWindow(winID, client, DixReadAccess);
- if (!source) return BadWindow;
+ rc = dixLookupWindow(&source, winID, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
winX = source->drawable.x;
winY = source->drawable.y;
@@ -2301,7 +2301,7 @@ int
ProcWarpPointer(ClientPtr client)
{
WindowPtr dest = NULL;
- int x, y;
+ int x, y, rc;
ScreenPtr newScreen;
REQUEST(xWarpPointerReq);
@@ -2313,11 +2313,10 @@ ProcWarpPointer(ClientPtr client)
return XineramaWarpPointer(client);
#endif
- if (stuff->dstWid != None)
- {
- dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess);
- if (!dest)
- return BadWindow;
+ if (stuff->dstWid != None) {
+ rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
}
x = sprite.hotPhys.x;
y = sprite.hotPhys.y;
@@ -2328,8 +2327,9 @@ ProcWarpPointer(ClientPtr client)
XID winID = stuff->srcWid;
WindowPtr source;
- source = SecurityLookupWindow(winID, client, DixReadAccess);
- if (!source) return BadWindow;
+ rc = dixLookupWindow(&source, winID, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
winX = source->drawable.x;
winY = source->drawable.y;
@@ -3532,8 +3532,8 @@ SetInputFocus(
Bool followOK)
{
register FocusClassPtr focus;
- register WindowPtr focusWin;
- int mode;
+ WindowPtr focusWin;
+ int mode, rc;
TimeStamp time;
UpdateCurrentTime();
@@ -3550,14 +3550,12 @@ SetInputFocus(
focusWin = (WindowPtr)(long)focusID;
else if ((focusID == FollowKeyboard) && followOK)
focusWin = inputInfo.keyboard->focus->win;
- else if (!(focusWin = SecurityLookupWindow(focusID, client,
- DixReadAccess)))
- return BadWindow;
- else
- {
+ else {
+ rc = dixLookupWindow(&focusWin, focusID, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
/* It is a match error to try to set the input focus to an
unviewable window. */
-
if(!focusWin->realized)
return(BadMatch);
}
@@ -3646,6 +3644,7 @@ ProcGrabPointer(ClientPtr client)
CursorPtr cursor, oldCursor;
REQUEST(xGrabPointerReq);
TimeStamp time;
+ int rc;
REQUEST_SIZE_MATCH(xGrabPointerReq);
UpdateCurrentTime();
@@ -3671,17 +3670,17 @@ ProcGrabPointer(ClientPtr client)
client->errorValue = stuff->eventMask;
return BadValue;
}
- pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess);
- if (!pWin)
- return BadWindow;
+ rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
if (stuff->confineTo == None)
confineTo = NullWindow;
else
{
- confineTo = SecurityLookupWindow(stuff->confineTo, client,
- DixReadAccess);
- if (!confineTo)
- return BadWindow;
+ rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
}
if (stuff->cursor == None)
cursor = NullCursor;
@@ -3812,9 +3811,10 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
unsigned this_mode, unsigned other_mode, Window grabWindow,
unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status)
{
- register WindowPtr pWin;
+ WindowPtr pWin;
register GrabPtr grab;
TimeStamp time;
+ int rc;
UpdateCurrentTime();
if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync))
@@ -3832,9 +3832,9 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
client->errorValue = ownerEvents;
return BadValue;
}
- pWin = SecurityLookupWindow(grabWindow, client, DixReadAccess);
- if (!pWin)
- return BadWindow;
+ rc = dixLookupWindow(&pWin, grabWindow, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
time = ClientTimeToServerTime(ctime);
grab = dev->grab;
if (grab && !SameClient(grab, client))
@@ -3918,11 +3918,12 @@ ProcQueryPointer(ClientPtr client)
WindowPtr pWin, t;
REQUEST(xResourceReq);
DeviceIntPtr mouse = inputInfo.pointer;
+ int rc;
REQUEST_SIZE_MATCH(xResourceReq);
- pWin = SecurityLookupWindow(stuff->id, client, DixReadAccess);
- if (!pWin)
- return BadWindow;
+ rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client);
rep.type = X_Reply;
@@ -4086,8 +4087,8 @@ ProcSendEvent(ClientPtr client)
effectiveFocus = pWin = inputFocus;
}
else
- pWin = SecurityLookupWindow(stuff->destination, client,
- DixReadAccess);
+ dixLookupWindow(&pWin, stuff->destination, client, DixReadAccess);
+
if (!pWin)
return BadWindow;
if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue))
@@ -4123,11 +4124,12 @@ ProcUngrabKey(ClientPtr client)
WindowPtr pWin;
GrabRec tempGrab;
DeviceIntPtr keybd = inputInfo.keyboard;
+ int rc;
REQUEST_SIZE_MATCH(xUngrabKeyReq);
- pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess);
- if (!pWin)
- return BadWindow;
+ rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) ||
(stuff->key < keybd->key->curKeySyms.minKeyCode))
@@ -4164,6 +4166,7 @@ ProcGrabKey(ClientPtr client)
REQUEST(xGrabKeyReq);
GrabPtr grab;
DeviceIntPtr keybd = inputInfo.keyboard;
+ int rc;
REQUEST_SIZE_MATCH(xGrabKeyReq);
if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse))
@@ -4196,9 +4199,9 @@ ProcGrabKey(ClientPtr client)
client->errorValue = stuff->modifiers;
return BadValue;
}
- pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess);
- if (!pWin)
- return BadWindow;
+ rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
grab = CreateGrab(client->index, keybd, pWin,
(Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents,
@@ -4218,6 +4221,7 @@ ProcGrabButton(ClientPtr client)
REQUEST(xGrabButtonReq);
CursorPtr cursor;
GrabPtr grab;
+ int rc;
REQUEST_SIZE_MATCH(xGrabButtonReq);
if ((stuff->pointerMode != GrabModeSync) &&
@@ -4248,16 +4252,16 @@ ProcGrabButton(ClientPtr client)
client->errorValue = stuff->eventMask;
return BadValue;
}
- pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess);
- if (!pWin)
- return BadWindow;
+ rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
if (stuff->confineTo == None)
confineTo = NullWindow;
else {
- confineTo = SecurityLookupWindow(stuff->confineTo, client,
- DixReadAccess);
- if (!confineTo)
- return BadWindow;
+ rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
+ DixReadAccess);
+ if (rc != Success)
+ return rc;
}
if (stuff->cursor == None)
cursor = NullCursor;
@@ -4289,6 +4293,7 @@ ProcUngrabButton(ClientPtr client)
REQUEST(xUngrabButtonReq);
WindowPtr pWin;
GrabRec tempGrab;
+ int rc;
REQUEST_SIZE_MATCH(xUngrabButtonReq);
if ((stuff->modifiers != AnyModifier) &&
@@ -4297,9 +4302,9 @@ ProcUngrabButton(ClientPtr client)
client->errorValue = stuff->modifiers;
return BadValue;
}
- pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess);
- if (!pWin)
- return BadWindow;
+ rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
tempGrab.resource = client->clientAsMask;
tempGrab.device = inputInfo.pointer;
tempGrab.window = pWin;
diff --git a/dix/property.c b/dix/property.c
index 5c1e957a5..d40284901 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -94,7 +94,7 @@ PrintPropertys(WindowPtr pWin)
int
ProcRotateProperties(ClientPtr client)
{
- int i, j, delta;
+ int i, j, delta, rc;
REQUEST(xRotatePropertiesReq);
WindowPtr pWin;
register Atom * atoms;
@@ -104,10 +104,9 @@ ProcRotateProperties(ClientPtr client)
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
UpdateCurrentTime();
- pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client,
- DixWriteAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ if (rc != Success)
+ return rc;
if (!stuff->nAtoms)
return(Success);
atoms = (Atom *) & stuff[1];
@@ -181,9 +180,7 @@ ProcChangeProperty(ClientPtr client)
WindowPtr pWin;
char format, mode;
unsigned long len;
- int sizeInBytes;
- int totalSize;
- int err;
+ int sizeInBytes, totalSize, err;
REQUEST(xChangePropertyReq);
REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
@@ -208,10 +205,9 @@ ProcChangeProperty(ClientPtr client)
totalSize = len * sizeInBytes;
REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- DixWriteAccess);
- if (!pWin)
- return(BadWindow);
+ err = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ if (err != Success)
+ return err;
if (!ValidAtom(stuff->property))
{
client->errorValue = stuff->property;
@@ -445,7 +441,7 @@ int
ProcGetProperty(ClientPtr client)
{
PropertyPtr pProp, prevProp;
- unsigned long n, len, ind;
+ unsigned long n, len, ind, rc;
WindowPtr pWin;
xGetPropertyReply reply;
Mask access_mode = DixReadAccess;
@@ -454,10 +450,9 @@ ProcGetProperty(ClientPtr client)
REQUEST_SIZE_MATCH(xGetPropertyReq);
if (stuff->delete)
UpdateCurrentTime();
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- DixReadAccess);
- if (!pWin)
- return BadWindow;
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
if (!ValidAtom(stuff->property))
{
@@ -585,16 +580,15 @@ ProcListProperties(ClientPtr client)
{
Atom *pAtoms = NULL, *temppAtoms;
xListPropertiesReply xlpr;
- int numProps = 0;
+ int rc, numProps = 0;
WindowPtr pWin;
PropertyPtr pProp;
REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq);
- pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client,
- DixReadAccess);
- if (!pWin)
- return(BadWindow);
+ rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
pProp = wUserProps (pWin);
while (pProp)
@@ -636,10 +630,9 @@ ProcDeleteProperty(register ClientPtr client)
REQUEST_SIZE_MATCH(xDeletePropertyReq);
UpdateCurrentTime();
- pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client,
- DixWriteAccess);
- if (!pWin)
- return(BadWindow);
+ result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ if (result != Success)
+ return result;
if (!ValidAtom(stuff->property))
{
client->errorValue = stuff->property;