summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-03-22 15:55:35 -0400
committerEamon Walsh <ewalsh@moss-uranus.epoch.ncsc.mil>2007-03-22 15:55:35 -0400
commit1b766ffc0647d5e9a9bf6938d33548d977b5535e (patch)
tree9b5b4ec0ca71af2dff08328449263cfcab0e08ba
parent1b58304ac837735920747ed0f0d10ba331bdaeb7 (diff)
dix: reorganize property code to better support xace hook; requires new API for
changing a property, dixChangeWindowProperty, taking an additional client argument.
-rw-r--r--Xext/security.c2
-rw-r--r--Xext/xselinux.c2
-rw-r--r--dix/property.c55
-rw-r--r--hw/xfree86/loader/dixsym.c1
-rw-r--r--include/property.h11
5 files changed, 52 insertions, 19 deletions
diff --git a/Xext/security.c b/Xext/security.c
index b7a0925c7..00180b99e 100644
--- a/Xext/security.c
+++ b/Xext/security.c
@@ -1715,7 +1715,7 @@ SecurityCheckPropertyAccess(CallbackListPtr *pcbl, pointer unused,
/* if client trusted or window untrusted, allow operation */
- if ( (TRUSTLEVEL(client) == XSecurityClientTrusted) ||
+ if (!client || (TRUSTLEVEL(client) == XSecurityClientTrusted) ||
(TRUSTLEVEL(wClient(pWin)) != XSecurityClientTrusted) )
return;
diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index 4056d9e92..eb721a7c1 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1070,7 +1070,7 @@ XSELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
char *propname = NameForAtom(rec->propertyName);
tclient = wClient(pWin);
- if (!tclient || !HAVESTATE(tclient))
+ if (!client || !tclient || !HAVESTATE(tclient))
return;
propsid = GetPropertySID(SID(tclient)->ctx, propname);
diff --git a/dix/property.c b/dix/property.c
index 5e11b5f6c..c760ef188 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -230,19 +230,9 @@ ProcChangeProperty(ClientPtr client)
return(BadAtom);
}
- switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin,
- FindProperty(pWin, stuff->property), stuff->property,
- DixWriteAccess))
- {
- case XaceErrorOperation:
- client->errorValue = stuff->property;
- return BadAtom;
- case XaceIgnoreOperation:
- return Success;
- }
-
- err = ChangeWindowProperty(pWin, stuff->property, stuff->type, (int)format,
- (int)mode, len, (pointer)&stuff[1], TRUE);
+ err = dixChangeWindowProperty(client, pWin, stuff->property, stuff->type,
+ (int)format, (int)mode, len, &stuff[1],
+ TRUE);
if (err != Success)
return err;
else
@@ -250,9 +240,9 @@ ProcChangeProperty(ClientPtr client)
}
_X_EXPORT int
-ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
- int mode, unsigned long len, pointer value,
- Bool sendevent)
+dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
+ Atom type, int format, int mode, unsigned long len,
+ pointer value, Bool sendevent)
{
PropertyPtr pProp;
xEvent event;
@@ -286,12 +276,34 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
if (len)
memmove((char *)data, (char *)value, totalSize);
pProp->size = len;
- pProp->next = pWin->optional->userProps;
pProp->devPrivates = NULL;
+ switch (XaceHook(XACE_PROPERTY_ACCESS, pClient, pWin, pProp, property,
+ DixWriteAccess))
+ {
+ case XaceErrorOperation:
+ xfree(data);
+ xfree(pProp);
+ pClient->errorValue = property;
+ return BadAtom;
+ case XaceIgnoreOperation:
+ xfree(data);
+ xfree(pProp);
+ return Success;
+ }
+ pProp->next = pWin->optional->userProps;
pWin->optional->userProps = pProp;
}
else
{
+ switch (XaceHook(XACE_PROPERTY_ACCESS, pClient, pWin, pProp, property,
+ DixWriteAccess))
+ {
+ case XaceErrorOperation:
+ pClient->errorValue = property;
+ return BadAtom;
+ case XaceIgnoreOperation:
+ return Success;
+ }
/* To append or prepend to a property the request format and type
must match those of the already defined property. The
existing format and type are irrelevant when using the mode
@@ -357,6 +369,15 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
return(Success);
}
+_X_EXPORT int
+ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
+ int mode, unsigned long len, pointer value,
+ Bool sendevent)
+{
+ return dixChangeWindowProperty(NullClient, pWin, property, type, format,
+ mode, len, value, sendevent);
+}
+
int
DeleteProperty(WindowPtr pWin, Atom propName)
{
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index 1732d1fe4..6957f063e 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -192,6 +192,7 @@ _X_HIDDEN void *dixLookupTab[] = {
#endif
/* property.c */
SYMFUNC(ChangeWindowProperty)
+ SYMFUNC(dixChangeWindowProperty)
/* extension.c */
SYMFUNC(AddExtension)
SYMFUNC(AddExtensionAlias)
diff --git a/include/property.h b/include/property.h
index 8b6dc0912..77536aa4d 100644
--- a/include/property.h
+++ b/include/property.h
@@ -52,6 +52,17 @@ SOFTWARE.
typedef struct _Property *PropertyPtr;
+extern int dixChangeWindowProperty(
+ ClientPtr /*pClient*/,
+ WindowPtr /*pWin*/,
+ Atom /*property*/,
+ Atom /*type*/,
+ int /*format*/,
+ int /*mode*/,
+ unsigned long /*len*/,
+ pointer /*value*/,
+ Bool /*sendevent*/);
+
extern int ChangeWindowProperty(
WindowPtr /*pWin*/,
Atom /*property*/,