diff options
Diffstat (limited to 'Xext/xace.c')
-rw-r--r-- | Xext/xace.c | 124 |
1 files changed, 70 insertions, 54 deletions
diff --git a/Xext/xace.c b/Xext/xace.c index b4e0eee5f..9f8a8cc75 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" @@ -81,95 +79,117 @@ int XaceHook(int hook, ...) va_arg(ap, ClientPtr), va_arg(ap, XID), va_arg(ap, RESTYPE), - va_arg(ap, Mask), va_arg(ap, pointer), - TRUE /* default allow */ + va_arg(ap, RESTYPE), + va_arg(ap, pointer), + va_arg(ap, Mask), + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } case XACE_DEVICE_ACCESS: { XaceDeviceAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, DeviceIntPtr), - va_arg(ap, Bool), - TRUE /* default allow */ + va_arg(ap, Mask), + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } case XACE_PROPERTY_ACCESS: { XacePropertyAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, WindowPtr), - va_arg(ap, Atom), + va_arg(ap, PropertyPtr), va_arg(ap, Mask), - XaceAllowOperation /* default allow */ + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } - case XACE_DRAWABLE_ACCESS: { - XaceDrawableAccessRec rec = { + case XACE_SEND_ACCESS: { + XaceSendAccessRec rec = { va_arg(ap, ClientPtr), - va_arg(ap, DrawablePtr), - TRUE /* default allow */ + va_arg(ap, DeviceIntPtr), + va_arg(ap, WindowPtr), + va_arg(ap, xEventPtr), + va_arg(ap, int), + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } - case XACE_MAP_ACCESS: - case XACE_BACKGRND_ACCESS: { - XaceMapAccessRec rec = { + case XACE_RECEIVE_ACCESS: { + XaceReceiveAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, WindowPtr), - TRUE /* default allow */ + va_arg(ap, xEventPtr), + va_arg(ap, int), + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; + break; + } + case XACE_CLIENT_ACCESS: { + XaceClientAccessRec rec = { + va_arg(ap, ClientPtr), + va_arg(ap, ClientPtr), + va_arg(ap, Mask), + Success /* default allow */ + }; + calldata = &rec; + prv = &rec.status; break; } - case XACE_EXT_DISPATCH: case XACE_EXT_ACCESS: { XaceExtAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, ExtensionEntry*), - TRUE /* default allow */ + DixGetAttrAccess, + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } - case XACE_HOSTLIST_ACCESS: { - XaceHostlistAccessRec rec = { + case XACE_SERVER_ACCESS: { + XaceServerAccessRec rec = { va_arg(ap, ClientPtr), va_arg(ap, Mask), - TRUE /* default allow */ + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } - case XACE_SITE_POLICY: { - XaceSitePolicyRec rec = { - va_arg(ap, char*), - va_arg(ap, int), - FALSE /* default unrecognized */ + case XACE_SELECTION_ACCESS: { + XaceSelectionAccessRec rec = { + va_arg(ap, ClientPtr), + va_arg(ap, Atom), + va_arg(ap, Mask), + Success /* default allow */ }; calldata = &rec; - prv = &rec.rval; + prv = &rec.status; break; } - case XACE_DECLARE_EXT_SECURE: { - XaceDeclareExtSecureRec rec = { - va_arg(ap, ExtensionEntry*), - va_arg(ap, Bool) + case XACE_SCREEN_ACCESS: + case XACE_SCREENSAVER_ACCESS: { + XaceScreenAccessRec rec = { + va_arg(ap, ClientPtr), + va_arg(ap, ScreenPtr), + va_arg(ap, Mask), + Success /* default allow */ }; calldata = &rec; + prv = &rec.status; break; } case XACE_AUTH_AVAIL: { @@ -189,14 +209,6 @@ int XaceHook(int hook, ...) calldata = &rec; break; } - case XACE_WINDOW_INIT: { - XaceWindowRec rec = { - va_arg(ap, ClientPtr), - va_arg(ap, WindowPtr) - }; - calldata = &rec; - break; - } default: { va_end(ap); return 0; /* unimplemented hook number */ @@ -206,7 +218,7 @@ int XaceHook(int hook, ...) /* call callbacks and return result, if any. */ CallCallbacks(&XaceHooks[hook], calldata); - return prv ? *prv : 0; + return prv ? *prv : Success; } static int @@ -262,16 +274,16 @@ XaceCatchDispatchProc(ClientPtr client) { REQUEST(xReq); int major = stuff->reqType; - XaceCoreDispatchRec rec = { client, TRUE /* default allow */ }; + XaceCoreDispatchRec rec = { client, Success /* default allow */ }; if (!ProcVector[major]) - return (BadRequest); + return BadRequest; /* call callbacks and return result, if any. */ CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec); - if (!rec.rval) - return (BadAccess); + if (rec.status != Success) + return rec.status; return client->swapped ? (* SwappedProcVector[major])(client) : @@ -284,12 +296,16 @@ XaceCatchExtProc(ClientPtr client) REQUEST(xReq); int major = stuff->reqType; ExtensionEntry *ext = GetExtensionEntry(major); + XaceExtAccessRec rec = { client, ext, DixUseAccess, Success }; if (!ext || !ProcVector[major]) - return (BadRequest); + return BadRequest; + + /* call callbacks and return result, if any. */ + CallCallbacks(&XaceHooks[XACE_EXT_DISPATCH], &rec); - if (!XaceHook(XACE_EXT_DISPATCH, client, ext)) - return (BadRequest); /* pretend extension doesn't exist */ + if (rec.status != Success) + return BadRequest; /* pretend extension doesn't exist */ return client->swapped ? (* SwappedProcVector[major])(client) : |