summaryrefslogtreecommitdiff
path: root/dix/property.c
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2007-04-17 16:01:56 -0400
committerEamon Walsh <ewalsh@moss-uranus.epoch.ncsc.mil>2007-04-17 16:01:56 -0400
commit9cee4ec5e6e06d23aafb302494b082c77ade4623 (patch)
treeee073cce5999f79df2c8aa87f4891e83a38afaaa /dix/property.c
parent47bd311e3dcc501cbb202ce79a55ac32e9db50f2 (diff)
xace: change the semantics of the return value of XACE hooks to allow
arbitrary X status codes instead of just TRUE/FALSE. The dix layer in most cases still does not propagate the return value of XACE hooks back to the client, however. There is more error propagation work to do.
Diffstat (limited to 'dix/property.c')
-rw-r--r--dix/property.c64
1 files changed, 24 insertions, 40 deletions
diff --git a/dix/property.c b/dix/property.c
index 8deb62180..09f9e3152 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -144,16 +144,12 @@ ProcRotateProperties(ClientPtr client)
DEALLOCATE_LOCAL(props);
return BadMatch;
}
- switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp,
- DixReadAccess|DixWriteAccess))
- {
- case XaceErrorOperation:
+ rc = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp,
+ DixReadAccess|DixWriteAccess);
+ if (rc != Success) {
DEALLOCATE_LOCAL(props);
client->errorValue = atoms[i];
- return BadAtom;
- case XaceIgnoreOperation:
- DEALLOCATE_LOCAL(props);
- return Success;
+ return (rc == XaceIgnoreError) ? Success : rc;
}
props[i] = pProp;
}
@@ -246,8 +242,7 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
{
PropertyPtr pProp;
xEvent event;
- int sizeInBytes;
- int totalSize;
+ int sizeInBytes, totalSize, rc;
pointer data;
sizeInBytes = format>>3;
@@ -277,32 +272,24 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
memmove((char *)data, (char *)value, totalSize);
pProp->size = len;
pProp->devPrivates = NULL;
- switch (XaceHook(XACE_PROPERTY_ACCESS, pClient, pWin, pProp,
- DixCreateAccess))
- {
- case XaceErrorOperation:
+ rc = XaceHook(XACE_PROPERTY_ACCESS, pClient, pWin, pProp,
+ DixCreateAccess);
+ if (rc != Success) {
xfree(data);
xfree(pProp);
pClient->errorValue = property;
- return BadAtom;
- case XaceIgnoreOperation:
- xfree(data);
- xfree(pProp);
- return Success;
+ return (rc == XaceIgnoreError) ? Success : rc;
}
pProp->next = pWin->optional->userProps;
pWin->optional->userProps = pProp;
}
else
{
- switch (XaceHook(XACE_PROPERTY_ACCESS, pClient, pWin, pProp,
- DixWriteAccess))
- {
- case XaceErrorOperation:
+ rc = XaceHook(XACE_PROPERTY_ACCESS, pClient, pWin, pProp,
+ DixWriteAccess);
+ if (rc != Success) {
pClient->errorValue = property;
- return BadAtom;
- case XaceIgnoreOperation:
- return Success;
+ return (rc == XaceIgnoreError) ? Success : rc;
}
/* To append or prepend to a property the request format and type
must match those of the already defined property. The
@@ -471,7 +458,8 @@ int
ProcGetProperty(ClientPtr client)
{
PropertyPtr pProp, prevProp;
- unsigned long n, len, ind, rc;
+ unsigned long n, len, ind;
+ int rc;
WindowPtr pWin;
xGetPropertyReply reply;
Mask access_mode = DixReadAccess;
@@ -517,13 +505,12 @@ ProcGetProperty(ClientPtr client)
if (stuff->delete)
access_mode |= DixDestroyAccess;
- switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp, access_mode))
- {
- case XaceErrorOperation:
+
+ rc = XaceHook(XACE_PROPERTY_ACCESS, client, pWin, pProp, access_mode);
+ if (rc != Success) {
client->errorValue = stuff->property;
- return BadAtom;;
- case XaceIgnoreOperation:
- return NullPropertyReply(client, pProp->type, pProp->format, &reply);
+ return (rc == XaceIgnoreError) ?
+ NullPropertyReply(client, pProp->type, pProp->format, &reply) : rc;
}
/* If the request type and actual type don't match. Return the
@@ -669,14 +656,11 @@ ProcDeleteProperty(ClientPtr client)
return (BadAtom);
}
- switch (XaceHook(XACE_PROPERTY_ACCESS, client, pWin,
- FindProperty(pWin, stuff->property), DixDestroyAccess))
- {
- case XaceErrorOperation:
+ result = XaceHook(XACE_PROPERTY_ACCESS, client, pWin,
+ FindProperty(pWin, stuff->property), DixDestroyAccess);
+ if (result != Success) {
client->errorValue = stuff->property;
- return BadAtom;;
- case XaceIgnoreOperation:
- return Success;
+ return (result == XaceIgnoreError) ? Success : result;
}
result = DeleteProperty(pWin, stuff->property);