dix: add dixResouceIsServerOwned()
Little helper function for checking whether a resource XID belongs to the server itself. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
1cbfe67a5a
commit
4ae7dca761
|
@ -762,7 +762,7 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||||
goto denied;
|
goto denied;
|
||||||
|
|
||||||
/* special checks for server-owned resources */
|
/* special checks for server-owned resources */
|
||||||
if (owner == serverClient) {
|
if (dixResouceIsServerOwned(rec->id)) {
|
||||||
if (rec->rtype & RC_DRAWABLE)
|
if (rec->rtype & RC_DRAWABLE)
|
||||||
/* additional operations allowed on root windows */
|
/* additional operations allowed on root windows */
|
||||||
allowed |= SecurityRootWindowExtraMask;
|
allowed |= SecurityRootWindowExtraMask;
|
||||||
|
|
|
@ -220,8 +220,6 @@ static void FindColorInRootCmap(ColormapPtr /* pmap */ ,
|
||||||
(bits) += (base); \
|
(bits) += (base); \
|
||||||
while((bits) & ~(mask)) \
|
while((bits) & ~(mask)) \
|
||||||
(bits) += ((bits) & ~(mask));
|
(bits) += ((bits) & ~(mask));
|
||||||
/* ID of server as client */
|
|
||||||
#define SERVER_ID 0
|
|
||||||
|
|
||||||
typedef struct _colorResource {
|
typedef struct _colorResource {
|
||||||
Colormap mid;
|
Colormap mid;
|
||||||
|
@ -418,7 +416,7 @@ FreeColormap(void *value, XID mid)
|
||||||
EntryPtr pent;
|
EntryPtr pent;
|
||||||
ColormapPtr pmap = (ColormapPtr) value;
|
ColormapPtr pmap = (ColormapPtr) value;
|
||||||
|
|
||||||
if (dixClientIdForXID(mid) != SERVER_ID) {
|
if (!dixResouceIsServerOwned(mid)) {
|
||||||
(*pmap->pScreen->UninstallColormap) (pmap);
|
(*pmap->pScreen->UninstallColormap) (pmap);
|
||||||
WalkTree(pmap->pScreen, (VisitWindowProcPtr) TellNoMap, (void *) &mid);
|
WalkTree(pmap->pScreen, (VisitWindowProcPtr) TellNoMap, (void *) &mid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,4 +82,14 @@ static inline ClientPtr dixClientForXID(XID xid) {
|
||||||
return NullClient;
|
return NullClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief check whether resource is owned by server
|
||||||
|
*
|
||||||
|
* @param XID the ID of the resource to check
|
||||||
|
* @return TRUE if resource is server owned
|
||||||
|
*/
|
||||||
|
static inline Bool dixResouceIsServerOwned(XID xid) {
|
||||||
|
return (dixClientForXID(xid) == serverClient);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* _XSERVER_DIX_RESOURCE_PRIV_H */
|
#endif /* _XSERVER_DIX_RESOURCE_PRIV_H */
|
||||||
|
|
|
@ -50,7 +50,7 @@ Bool xwl_pixmap_init(void);
|
||||||
static inline Bool
|
static inline Bool
|
||||||
xwl_is_client_pixmap(PixmapPtr pixmap)
|
xwl_is_client_pixmap(PixmapPtr pixmap)
|
||||||
{
|
{
|
||||||
return dixClientForXID(pixmap->drawable.id) != serverClient;
|
return (!dixResouceIsServerOwned(pixmap->drawable.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* XWAYLAND_PIXMAP_H */
|
#endif /* XWAYLAND_PIXMAP_H */
|
||||||
|
|
Loading…
Reference in New Issue