diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2007-03-22 15:55:35 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@moss-uranus.epoch.ncsc.mil> | 2007-03-22 15:55:35 -0400 |
commit | 1b766ffc0647d5e9a9bf6938d33548d977b5535e (patch) | |
tree | 9b5b4ec0ca71af2dff08328449263cfcab0e08ba /dix/property.c | |
parent | 1b58304ac837735920747ed0f0d10ba331bdaeb7 (diff) |
dix: reorganize property code to better support xace hook; requires new API for
changing a property, dixChangeWindowProperty, taking an additional client argument.
Diffstat (limited to 'dix/property.c')
-rw-r--r-- | dix/property.c | 55 |
1 files changed, 38 insertions, 17 deletions
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) { |