diff options
Diffstat (limited to 'xorg-server/dix/resource.c')
-rw-r--r-- | xorg-server/dix/resource.c | 39 |
1 files changed, 34 insertions, 5 deletions
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) |