summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-03-22 13:06:50 -0400
committerEamon Walsh <ewalsh@moss-uranus.epoch.ncsc.mil>2007-03-22 14:07:01 -0400
commit1b58304ac837735920747ed0f0d10ba331bdaeb7 (patch)
tree8627267aaf8acc315520292f4fdf88a2eb6ab700
parent5486be4898766205149fadce71529724eb78fbf3 (diff)
xace: add new argument to property hook for property structure itself.
-rw-r--r--Xext/security.c6
-rw-r--r--Xext/xace.c3
-rw-r--r--Xext/xacestr.h2
-rw-r--r--dix/property.c67
4 files changed, 40 insertions, 38 deletions
diff --git a/Xext/security.c b/Xext/security.c
index 98e91ad48..b7a0925c7 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -28,14 +28,8 @@ in this Software without prior written authorization from The Open Group.
#include <dix-config.h>
#endif
-#include "dixstruct.h"
-#include "extnsionst.h"
-#include "windowstr.h"
-#include "inputstr.h"
#include "scrnintstr.h"
-#include "gcstruct.h"
#include "colormapst.h"
-#include "propertyst.h"
#include "xacestr.h"
#include "securitysrv.h"
#include <X11/extensions/securstr.h>
diff --git a/Xext/xace.c b/Xext/xace.c
index 9502b5da9..8e277ac81 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -22,9 +22,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
#include <stdarg.h>
-#include "windowstr.h"
#include "scrnintstr.h"
-#include "gcstruct.h"
#include "xacestr.h"
#include "modinit.h"
@@ -97,6 +95,7 @@ int XaceHook(int hook, ...)
XacePropertyAccessRec rec = {
va_arg(ap, ClientPtr),
va_arg(ap, WindowPtr),
+ va_arg(ap, PropertyPtr),
va_arg(ap, Atom),
va_arg(ap, Mask),
XaceAllowOperation /* default allow */
diff --git a/Xext/xacestr.h b/Xext/xacestr.h
index edf7b66fb..19d154021 100644
--- a/Xext/xacestr.h
+++ b/Xext/xacestr.h
@@ -27,6 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "gcstruct.h"
#include "windowstr.h"
#include "inputstr.h"
+#include "propertyst.h"
#include "selection.h"
#include "xace.h"
@@ -59,6 +60,7 @@ typedef struct {
typedef struct {
ClientPtr client;
WindowPtr pWin;
+ PropertyPtr pProp;
Atom propertyName;
Mask access_mode;
int rval;
diff --git a/dix/property.c b/dix/property.c
index 3aa8e77e8..5e11b5f6c 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -91,6 +91,19 @@ PrintPropertys(WindowPtr pWin)
}
#endif
+static _X_INLINE PropertyPtr
+FindProperty(WindowPtr pWin, Atom propertyName)
+{
+ PropertyPtr pProp = wUserProps(pWin);
+ while (pProp)
+ {
+ if (pProp->propertyName == propertyName)
+ break;
+ pProp = pProp->next;
+ }
+ return pProp;
+}
+
int
ProcRotateProperties(ClientPtr client)
{
@@ -115,35 +128,33 @@ ProcRotateProperties(ClientPtr client)
return(BadAlloc);
for (i = 0; i < stuff->nAtoms; i++)
{
- char action = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, atoms[i],
- DixReadAccess|DixWriteAccess);
-
- if (!ValidAtom(atoms[i]) || (XaceErrorOperation == action)) {
+ if (!ValidAtom(atoms[i])) {
DEALLOCATE_LOCAL(props);
client->errorValue = atoms[i];
return BadAtom;
}
- if (XaceIgnoreOperation == action) {
- DEALLOCATE_LOCAL(props);
- return Success;
- }
-
for (j = i + 1; j < stuff->nAtoms; j++)
if (atoms[j] == atoms[i])
{
DEALLOCATE_LOCAL(props);
return BadMatch;
}
- pProp = wUserProps (pWin);
- while (pProp)
- {
- if (pProp->propertyName == atoms[i])
- goto found;
- pProp = pProp->next;
- }
- DEALLOCATE_LOCAL(props);
- return BadMatch;
-found:
+ pProp = FindProperty(pWin, atoms[i]);
+ if (!pProp) {
+ DEALLOCATE_LOCAL(props);
+ return BadMatch;
+ }
+ switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp, atoms[i],
+ DixReadAccess|DixWriteAccess))
+ {
+ case XaceErrorOperation:
+ DEALLOCATE_LOCAL(props);
+ client->errorValue = atoms[i];
+ return BadAtom;
+ case XaceIgnoreOperation:
+ DEALLOCATE_LOCAL(props);
+ return Success;
+ }
props[i] = pProp;
}
delta = stuff->nPositions;
@@ -219,7 +230,8 @@ ProcChangeProperty(ClientPtr client)
return(BadAtom);
}
- switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
+ switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin,
+ FindProperty(pWin, stuff->property), stuff->property,
DixWriteAccess))
{
case XaceErrorOperation:
@@ -252,14 +264,8 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
totalSize = len * sizeInBytes;
/* first see if property already exists */
+ pProp = FindProperty(pWin, property);
- pProp = wUserProps (pWin);
- while (pProp)
- {
- if (pProp->propertyName == property)
- break;
- pProp = pProp->next;
- }
if (!pProp) /* just add to list */
{
if (!pWin->optional && !MakeWindowOptional (pWin))
@@ -490,8 +496,8 @@ ProcGetProperty(ClientPtr client)
if (stuff->delete)
access_mode |= DixDestroyAccess;
- switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
- access_mode))
+ switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp,
+ stuff->property, access_mode))
{
case XaceErrorOperation:
client->errorValue = stuff->property;
@@ -643,7 +649,8 @@ ProcDeleteProperty(register ClientPtr client)
return (BadAtom);
}
- switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, stuff->property,
+ switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin,
+ FindProperty(pWin, stuff->property), stuff->property,
DixDestroyAccess))
{
case XaceErrorOperation: