XACE: Move the property access hook to its own function.
This commit is contained in:
parent
019ad5acd2
commit
bb1a577a68
20
Xext/xace.c
20
Xext/xace.c
|
@ -51,6 +51,14 @@ int XaceHookDispatch(ClientPtr client, int major)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
|
||||||
|
PropertyPtr pProp, Mask access_mode)
|
||||||
|
{
|
||||||
|
XacePropertyAccessRec rec = { client, pWin, pProp, access_mode, Success };
|
||||||
|
CallCallbacks(&XaceHooks[XACE_PROPERTY_ACCESS], &rec);
|
||||||
|
return rec.status;
|
||||||
|
}
|
||||||
|
|
||||||
void XaceHookAuditEnd(ClientPtr ptr, int result)
|
void XaceHookAuditEnd(ClientPtr ptr, int result)
|
||||||
{
|
{
|
||||||
XaceAuditRec rec = { ptr, result };
|
XaceAuditRec rec = { ptr, result };
|
||||||
|
@ -100,18 +108,6 @@ int XaceHook(int hook, ...)
|
||||||
prv = &rec.status;
|
prv = &rec.status;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case XACE_PROPERTY_ACCESS: {
|
|
||||||
XacePropertyAccessRec rec = {
|
|
||||||
va_arg(ap, ClientPtr),
|
|
||||||
va_arg(ap, WindowPtr),
|
|
||||||
va_arg(ap, PropertyPtr),
|
|
||||||
va_arg(ap, Mask),
|
|
||||||
Success /* default allow */
|
|
||||||
};
|
|
||||||
calldata = &rec;
|
|
||||||
prv = &rec.status;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XACE_SEND_ACCESS: {
|
case XACE_SEND_ACCESS: {
|
||||||
XaceSendAccessRec rec = {
|
XaceSendAccessRec rec = {
|
||||||
va_arg(ap, ClientPtr),
|
va_arg(ap, ClientPtr),
|
||||||
|
|
|
@ -27,6 +27,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
#include "pixmap.h" /* for DrawablePtr */
|
#include "pixmap.h" /* for DrawablePtr */
|
||||||
#include "regionstr.h" /* for RegionPtr */
|
#include "regionstr.h" /* for RegionPtr */
|
||||||
|
#include "window.h" /* for WindowPtr */
|
||||||
|
#include "property.h" /* for PropertyPtr */
|
||||||
|
|
||||||
/* Default window background */
|
/* Default window background */
|
||||||
#define XaceBackgroundNoneState None
|
#define XaceBackgroundNoneState None
|
||||||
|
@ -65,6 +67,8 @@ extern int XaceHook(
|
||||||
/* Special-cased hook functions
|
/* Special-cased hook functions
|
||||||
*/
|
*/
|
||||||
extern int XaceHookDispatch(ClientPtr ptr, int major);
|
extern int XaceHookDispatch(ClientPtr ptr, int major);
|
||||||
|
extern int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
||||||
|
PropertyPtr pProp, Mask access_mode);
|
||||||
extern void XaceHookAuditEnd(ClientPtr ptr, int result);
|
extern void XaceHookAuditEnd(ClientPtr ptr, int result);
|
||||||
|
|
||||||
/* Register a callback for a given hook.
|
/* Register a callback for a given hook.
|
||||||
|
@ -101,11 +105,13 @@ extern void XaceCensorImage(
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define XaceHook(args...) Success
|
#define XaceHook(args...) Success
|
||||||
#define XaceHookDispatch(args...) Success
|
#define XaceHookDispatch(args...) Success
|
||||||
|
#define XaceHookPropertyAccess(args...) Success
|
||||||
#define XaceHookAuditEnd(args...) { ; }
|
#define XaceHookAuditEnd(args...) { ; }
|
||||||
#define XaceCensorImage(args...) { ; }
|
#define XaceCensorImage(args...) { ; }
|
||||||
#else
|
#else
|
||||||
#define XaceHook(...) Success
|
#define XaceHook(...) Success
|
||||||
#define XaceHookDispatch(...) Success
|
#define XaceHookDispatch(...) Success
|
||||||
|
#define XaceHookPropertyAccess(...) Success
|
||||||
#define XaceHookAuditEnd(...) { ; }
|
#define XaceHookAuditEnd(...) { ; }
|
||||||
#define XaceCensorImage(...) { ; }
|
#define XaceCensorImage(...) { ; }
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1166,7 +1166,7 @@ ProcSELinuxGetPropertyContext(ClientPtr client)
|
||||||
if (!pProp)
|
if (!pProp)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp, DixGetAttrAccess);
|
rc = XaceHookPropertyAccess(client, pWin, pProp, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
|
@ -156,8 +156,8 @@ ProcRotateProperties(ClientPtr client)
|
||||||
xfree(props);
|
xfree(props);
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp,
|
rc = XaceHookPropertyAccess(client, pWin, pProp,
|
||||||
DixReadAccess|DixWriteAccess);
|
DixReadAccess|DixWriteAccess);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
xfree(props);
|
xfree(props);
|
||||||
client->errorValue = atoms[i];
|
client->errorValue = atoms[i];
|
||||||
|
@ -276,8 +276,8 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
||||||
memmove((char *)data, (char *)value, totalSize);
|
memmove((char *)data, (char *)value, totalSize);
|
||||||
pProp->size = len;
|
pProp->size = len;
|
||||||
pProp->devPrivates = NULL;
|
pProp->devPrivates = NULL;
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, pClient, pWin, pProp,
|
rc = XaceHookPropertyAccess(pClient, pWin, pProp,
|
||||||
DixCreateAccess|DixWriteAccess);
|
DixCreateAccess|DixWriteAccess);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
xfree(data);
|
xfree(data);
|
||||||
xfree(pProp);
|
xfree(pProp);
|
||||||
|
@ -289,8 +289,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, pClient, pWin, pProp,
|
rc = XaceHookPropertyAccess(pClient, pWin, pProp, DixWriteAccess);
|
||||||
DixWriteAccess);
|
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
pClient->errorValue = property;
|
pClient->errorValue = property;
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -382,8 +381,7 @@ DeleteProperty(ClientPtr client, WindowPtr pWin, Atom propName)
|
||||||
}
|
}
|
||||||
if (pProp)
|
if (pProp)
|
||||||
{
|
{
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp,
|
rc = XaceHookPropertyAccess(client, pWin, pProp, DixDestroyAccess);
|
||||||
DixDestroyAccess);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -502,7 +500,7 @@ ProcGetProperty(ClientPtr client)
|
||||||
if (stuff->delete)
|
if (stuff->delete)
|
||||||
access_mode |= DixDestroyAccess;
|
access_mode |= DixDestroyAccess;
|
||||||
|
|
||||||
rc = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp, access_mode);
|
rc = XaceHookPropertyAccess(client, pWin, pProp, access_mode);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
client->errorValue = stuff->property;
|
client->errorValue = stuff->property;
|
||||||
return rc;
|
return rc;
|
||||||
|
|
Loading…
Reference in New Issue