diff --git a/Xext/namespace/hook-ext-access.c b/Xext/namespace/hook-ext-access.c index 725c9a432..794db00b2 100644 --- a/Xext/namespace/hook-ext-access.c +++ b/Xext/namespace/hook-ext-access.c @@ -43,13 +43,13 @@ void hookExtAccess(CallbackListPtr *pcbl, void *unused, void *calldata) /* only allowed if namespace has flag set */ case EXTENSION_MAJOR_SHAPE: - if (subj->ns->allowShape == ALLOW) + if (XnsAuthAsk(*subj, Shape, subj->ns->allowShape)) goto pass; goto reject; /* only allowed if namespace has flag set */ case EXTENSION_MAJOR_XINPUT: - if (subj->ns->allowXInput == ALLOW) + if (XnsAuthAsk(*subj, XInput, subj->ns->allowXInput)) goto pass; goto reject; } diff --git a/Xext/namespace/hook-ext-dispatch.c b/Xext/namespace/hook-ext-dispatch.c index 0d1a38583..0921cc594 100644 --- a/Xext/namespace/hook-ext-dispatch.c +++ b/Xext/namespace/hook-ext-dispatch.c @@ -39,7 +39,7 @@ void hookExtDispatch(CallbackListPtr *pcbl, void *unused, void *calldata) /* allow several operations */ case EXTENSION_MAJOR_XKEYBOARD: - if (subj->ns->allowXKeyboard == ALLOW) + if (XnsAuthAsk(*subj, XKeyboard, subj->ns->allowXKeyboard)) goto pass; switch (client->minorOp) { case X_kbUseExtension: @@ -56,11 +56,11 @@ void hookExtDispatch(CallbackListPtr *pcbl, void *unused, void *calldata) /* allow if namespace has flag set */ case EXTENSION_MAJOR_SHAPE: - if (subj->ns->allowShape == ALLOW) + if (XnsAuthAsk(*subj, XKeyboard, subj->ns->allowShape)) goto pass; break; case EXTENSION_MAJOR_XINPUT: - if (subj->ns->allowXInput == ALLOW) + if (XnsAuthAsk(*subj, XInput, subj->ns->allowXInput)) goto pass; switch (client->minorOp) { case X_ListInputDevices: diff --git a/Xext/namespace/hook-receive.c b/Xext/namespace/hook-receive.c index 7f850c31a..0893d3b61 100644 --- a/Xext/namespace/hook-receive.c +++ b/Xext/namespace/hook-receive.c @@ -35,7 +35,7 @@ hookReceive(CallbackListPtr *pcbl, void *unused, void *calldata) if (gev->extension == EXTENSION_MAJOR_XINPUT) { switch (gev->evtype) { case XI_RawMotion: - if ((!(subj->ns->allowMouseMotion == ALLOW)) || !isRootWin(param->pWin)) + if (!XnsAuthAsk(*subj, Mouse, subj->ns->allowMouseMotion) || !isRootWin(param->pWin)) goto reject; continue; case XI_RawKeyPress: diff --git a/Xext/namespace/hook-resource.c b/Xext/namespace/hook-resource.c index 5c2ca3493..ee72620f3 100644 --- a/Xext/namespace/hook-resource.c +++ b/Xext/namespace/hook-resource.c @@ -31,7 +31,7 @@ void hookResourceAccess(CallbackListPtr *pcbl, void *unused, void *calldata) if (param->rtype == X11_RESTYPE_WINDOW) { WindowPtr pWindow = (WindowPtr) param->res; if (param->access_mode & DixCreateAccess) { - if (!(subj->ns->allowTransparency == ALLOW)) { + if (!XnsAuthAsk(*subj, Transparency, subj->ns->allowTransparency)) { pWindow->forcedBG = TRUE; } } diff --git a/Xext/namespace/namespace.h b/Xext/namespace/namespace.h index 048a30a70..084afb2b1 100644 --- a/Xext/namespace/namespace.h +++ b/Xext/namespace/namespace.h @@ -4,6 +4,7 @@ #include #include +#include "extension_priv.h" #include "include/dixstruct.h" #include "include/list.h" #include "include/privates.h" @@ -16,6 +17,14 @@ enum Authlevel { ALLOW, }; +enum AuthType { + Mouse = EXTENSION_MAJOR_XINPUT, + Shape = EXTENSION_MAJOR_SHAPE, + Transparency = EXTENSION_MAJOR_SHAPE, + XInput = EXTENSION_MAJOR_XINPUT, + XKeyboard = EXTENSION_MAJOR_XKEYBOARD, +}; + struct auth_token { struct xorg_list entry; const char *authProto; @@ -85,4 +94,12 @@ static inline Bool streq(const char *a, const char *b) return (strcmp(a,b) == 0); } +static inline Bool XnsAuthAsk(struct XnamespaceClientPriv source, enum AuthType event, enum Authlevel authlevel) { + //TODO + //Should spawn a window that knows the window's name and namespace (source), and what has been + //requested (event) if the authlevel is ASK + if (authlevel == ALLOW) return TRUE; + return FALSE; +}; + #endif /* __XSERVER_NAMESPACE_H */