From 6f25a23db1df27e992c34f6fd4c82e83c44fc2e2 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 2 Sep 2009 19:53:35 +0000 Subject: Switched to xorg-server-1.6.3.901.tar.gz --- xorg-server/dix/resource.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'xorg-server/dix/resource.c') diff --git a/xorg-server/dix/resource.c b/xorg-server/dix/resource.c index 7b0441ee9..7b133cae4 100644 --- a/xorg-server/dix/resource.c +++ b/xorg-server/dix/resource.c @@ -846,11 +846,10 @@ LegalNewID(XID id, ClientPtr client) } _X_EXPORT int -dixLookupResource(pointer *result, XID id, RESTYPE rtype, - ClientPtr client, Mask mode) +dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype, + ClientPtr client, Mask mode) { int cid = CLIENT_ID(id); - int istype = (rtype & TypeMask) && (rtype != RC_ANY); ResourcePtr res = NULL; *result = NULL; @@ -859,8 +858,38 @@ dixLookupResource(pointer *result, XID id, RESTYPE rtype, res = clientTable[cid].resources[Hash(cid, id)]; for (; res; res = res->next) - if ((res->id == id) && ((istype && res->type == rtype) || - (!istype && res->type & rtype))) + if (res->id == id && res->type == rtype) + break; + } + if (!res) + return BadValue; + + if (client) { + client->errorValue = id; + cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, + res->value, RT_NONE, NULL, mode); + if (cid != Success) + return cid; + } + + *result = res->value; + return Success; +} + +_X_EXPORT int +dixLookupResourceByClass(pointer *result, XID id, RESTYPE rclass, + ClientPtr client, Mask mode) +{ + int cid = CLIENT_ID(id); + ResourcePtr res = NULL; + + *result = NULL; + + if ((cid < MAXCLIENTS) && clientTable[cid].buckets) { + res = clientTable[cid].resources[Hash(cid, id)]; + + for (; res; res = res->next) + if (res->id == id && (res->type & rclass)) break; } if (!res) -- cgit v1.2.3