Replace XC-SECURITY code with XACE security hooks

(cherry picked from 8526cd6395 commit)
This commit is contained in:
Eamon Walsh
2004-05-05 20:04:52 +00:00
committed by Alan Coopersmith
parent 8d9ccc90a5
commit 37f0ae0245
14 changed files with 133 additions and 185 deletions

View File

@@ -129,9 +129,8 @@ Equipment Corporation.
#ifdef XAPPGROUP
#include <X11/extensions/Xagsrv.h>
#endif
#ifdef XCSECURITY
#define _SECURITY_SERVER
#include <X11/extensions/security.h>
#ifdef XACE
#include "xace.h"
#endif
/******
@@ -726,11 +725,11 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w,
}
pWin->borderWidth = bw;
#ifdef XCSECURITY
#ifdef XACE
/* can't let untrusted clients have background None windows;
* they make it too easy to steal window contents
*/
if (client->trustLevel != XSecurityClientTrusted)
if (!XaceHook(XACE_BACKGRND_ACCESS, client, pWin))
{
pWin->backgroundState = BackgroundPixel;
pWin->background.pixel = 0;
@@ -1020,9 +1019,9 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
borderRelative = TRUE;
if (pixID == None)
{
#ifdef XCSECURITY
#ifdef XACE
/* can't let untrusted clients have background None windows */
if (client->trustLevel == XSecurityClientTrusted)
if (XaceHook(XACE_BACKGRND_ACCESS, client, pWin))
{
#endif
if (pWin->backgroundState == BackgroundPixmap)
@@ -1031,7 +1030,7 @@ ChangeWindowAttributes(register WindowPtr pWin, Mask vmask, XID *vlist, ClientPt
MakeRootTile(pWin);
else
pWin->backgroundState = None;
#ifdef XCSECURITY
#ifdef XACE
}
else
{ /* didn't change the background to None, so don't tell ddx */
@@ -2719,13 +2718,9 @@ MapWindow(register WindowPtr pWin, ClientPtr client)
if (pWin->mapped)
return(Success);
#ifdef XCSECURITY
/* don't let an untrusted client map a child-of-trusted-window, InputOnly
* window; too easy to steal device input
*/
if ( (client->trustLevel != XSecurityClientTrusted) &&
(pWin->drawable.class == InputOnly) &&
(wClient(pWin->parent)->trustLevel == XSecurityClientTrusted) )
#ifdef XACE
/* general check for permission to map window */
if (!XaceHook(XACE_MAP_ACCESS, client, pWin))
return Success;
#endif