From 7cec236a03917841131941ce97bd1dfd4a027327 Mon Sep 17 00:00:00 2001 From: Eamon Walsh Date: Wed, 3 Feb 2010 15:08:40 -0500 Subject: [PATCH] xselinux: Allow GetWindowContext to be used for pixmaps as well. Signed-off-by: Eamon Walsh Reviewed-by: Keith Packard --- Xext/xselinux.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Xext/xselinux.c b/Xext/xselinux.c index 4382c2150..a1c1b83d9 100644 --- a/Xext/xselinux.c +++ b/Xext/xselinux.c @@ -1357,18 +1357,26 @@ ProcSELinuxGetDeviceContext(ClientPtr client) static int ProcSELinuxGetWindowContext(ClientPtr client) { - WindowPtr pWin; + DrawablePtr pDraw; + PrivateRec **privatePtr; SELinuxObjectRec *obj; int rc; REQUEST(SELinuxGetContextReq); REQUEST_SIZE_MATCH(SELinuxGetContextReq); - rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess); + rc = dixLookupDrawable(&pDraw, stuff->id, client, + M_WINDOW | M_DRAWABLE_PIXMAP, + DixGetAttrAccess); if (rc != Success) return rc; - obj = dixLookupPrivate(&pWin->devPrivates, objectKey); + if (pDraw->type == M_DRAWABLE_PIXMAP) + privatePtr = &((PixmapPtr)pDraw)->devPrivates; + else + privatePtr = &((WindowPtr)pDraw)->devPrivates; + + obj = dixLookupPrivate(privatePtr, objectKey); return SELinuxSendContextReply(client, obj->sid); }