Make SecurityLookupIDBy* part of the base functionality.
This commit is contained in:
parent
45c229f526
commit
9138d5a51e
|
@ -824,8 +824,6 @@ LegalNewID(XID id, register ClientPtr client)
|
||||||
!LookupIDByClass(id, RC_ANY)));
|
!LookupIDByClass(id, RC_ANY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XACE
|
|
||||||
|
|
||||||
/* SecurityLookupIDByType and SecurityLookupIDByClass:
|
/* SecurityLookupIDByType and SecurityLookupIDByClass:
|
||||||
* These are the heart of the resource ID security system. They take
|
* These are the heart of the resource ID security system. They take
|
||||||
* two additional arguments compared to the old LookupID functions:
|
* two additional arguments compared to the old LookupID functions:
|
||||||
|
@ -841,10 +839,6 @@ SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype, Mask mode)
|
||||||
register ResourcePtr res;
|
register ResourcePtr res;
|
||||||
pointer retval = NULL;
|
pointer retval = NULL;
|
||||||
|
|
||||||
assert(client == NullClient ||
|
|
||||||
(client->index <= currentMaxClients && clients[client->index] == client));
|
|
||||||
assert( (rtype & TypeMask) <= lastResourceType);
|
|
||||||
|
|
||||||
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
|
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
|
||||||
clientTable[cid].buckets)
|
clientTable[cid].buckets)
|
||||||
{
|
{
|
||||||
|
@ -857,9 +851,11 @@ SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype, Mask mode)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef XACE
|
||||||
if (retval && client &&
|
if (retval && client &&
|
||||||
!XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, mode, retval))
|
!XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, mode, retval))
|
||||||
retval = NULL;
|
retval = NULL;
|
||||||
|
#endif
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -871,10 +867,6 @@ SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, Mask mode)
|
||||||
register ResourcePtr res = NULL;
|
register ResourcePtr res = NULL;
|
||||||
pointer retval = NULL;
|
pointer retval = NULL;
|
||||||
|
|
||||||
assert(client == NullClient ||
|
|
||||||
(client->index <= currentMaxClients && clients[client->index] == client));
|
|
||||||
assert (classes >= lastResourceClass);
|
|
||||||
|
|
||||||
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
|
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
|
||||||
clientTable[cid].buckets)
|
clientTable[cid].buckets)
|
||||||
{
|
{
|
||||||
|
@ -887,9 +879,11 @@ SecurityLookupIDByClass(ClientPtr client, XID id, RESTYPE classes, Mask mode)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef XACE
|
||||||
if (retval && client &&
|
if (retval && client &&
|
||||||
!XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, mode, retval))
|
!XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, mode, retval))
|
||||||
retval = NULL;
|
retval = NULL;
|
||||||
|
#endif
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -910,50 +904,3 @@ LookupIDByClass(XID id, RESTYPE classes)
|
||||||
return SecurityLookupIDByClass(NullClient, id, classes,
|
return SecurityLookupIDByClass(NullClient, id, classes,
|
||||||
SecurityUnknownAccess);
|
SecurityUnknownAccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* not XACE */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* LookupIDByType returns the object with the given id and type, else NULL.
|
|
||||||
*/
|
|
||||||
pointer
|
|
||||||
LookupIDByType(XID id, RESTYPE rtype)
|
|
||||||
{
|
|
||||||
int cid;
|
|
||||||
register ResourcePtr res;
|
|
||||||
|
|
||||||
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
|
|
||||||
clientTable[cid].buckets)
|
|
||||||
{
|
|
||||||
res = clientTable[cid].resources[Hash(cid, id)];
|
|
||||||
|
|
||||||
for (; res; res = res->next)
|
|
||||||
if ((res->id == id) && (res->type == rtype))
|
|
||||||
return res->value;
|
|
||||||
}
|
|
||||||
return (pointer)NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* LookupIDByClass returns the object with the given id and any one of the
|
|
||||||
* given classes, else NULL.
|
|
||||||
*/
|
|
||||||
pointer
|
|
||||||
LookupIDByClass(XID id, RESTYPE classes)
|
|
||||||
{
|
|
||||||
int cid;
|
|
||||||
register ResourcePtr res;
|
|
||||||
|
|
||||||
if (((cid = CLIENT_ID(id)) < MAXCLIENTS) &&
|
|
||||||
clientTable[cid].buckets)
|
|
||||||
{
|
|
||||||
res = clientTable[cid].resources[Hash(cid, id)];
|
|
||||||
|
|
||||||
for (; res; res = res->next)
|
|
||||||
if ((res->id == id) && (res->type & classes))
|
|
||||||
return res->value;
|
|
||||||
}
|
|
||||||
return (pointer)NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* XACE */
|
|
||||||
|
|
|
@ -285,10 +285,8 @@ _X_HIDDEN void *dixLookupTab[] = {
|
||||||
SYMFUNC(LookupIDByType)
|
SYMFUNC(LookupIDByType)
|
||||||
SYMFUNC(LookupIDByClass)
|
SYMFUNC(LookupIDByClass)
|
||||||
SYMFUNC(LegalNewID)
|
SYMFUNC(LegalNewID)
|
||||||
#ifdef XACE
|
|
||||||
SYMFUNC(SecurityLookupIDByClass)
|
SYMFUNC(SecurityLookupIDByClass)
|
||||||
SYMFUNC(SecurityLookupIDByType)
|
SYMFUNC(SecurityLookupIDByType)
|
||||||
#endif
|
|
||||||
SYMFUNC(FindClientResourcesByType)
|
SYMFUNC(FindClientResourcesByType)
|
||||||
SYMFUNC(FindAllClientResources)
|
SYMFUNC(FindAllClientResources)
|
||||||
SYMVAR(lastResourceType)
|
SYMVAR(lastResourceType)
|
||||||
|
|
|
@ -227,8 +227,6 @@ extern pointer LookupClientResourceComplex(
|
||||||
#define SecurityWriteAccess (1<<1) /* changing the object */
|
#define SecurityWriteAccess (1<<1) /* changing the object */
|
||||||
#define SecurityDestroyAccess (1<<2) /* destroying the object */
|
#define SecurityDestroyAccess (1<<2) /* destroying the object */
|
||||||
|
|
||||||
#ifdef XACE
|
|
||||||
|
|
||||||
extern pointer SecurityLookupIDByType(
|
extern pointer SecurityLookupIDByType(
|
||||||
ClientPtr /*client*/,
|
ClientPtr /*client*/,
|
||||||
XID /*id*/,
|
XID /*id*/,
|
||||||
|
@ -241,15 +239,6 @@ extern pointer SecurityLookupIDByClass(
|
||||||
RESTYPE /*classes*/,
|
RESTYPE /*classes*/,
|
||||||
Mask /*access_mode*/);
|
Mask /*access_mode*/);
|
||||||
|
|
||||||
#else /* not XACE */
|
|
||||||
|
|
||||||
#define SecurityLookupIDByType(client, id, rtype, access_mode) \
|
|
||||||
LookupIDByType(id, rtype)
|
|
||||||
|
|
||||||
#define SecurityLookupIDByClass(client, id, classes, access_mode) \
|
|
||||||
LookupIDByClass(id, classes)
|
|
||||||
|
|
||||||
#endif /* XACE */
|
|
||||||
|
|
||||||
extern void GetXIDRange(
|
extern void GetXIDRange(
|
||||||
int /*client*/,
|
int /*client*/,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user