Xnamespace: added function XnsAuthAsk
More boilerplate, existing behavior should not have been changed. Signed-off-by: SuperDuperDeou <87223140+SuperDuperDeou@users.noreply.github.com>
This commit is contained in:
parent
5015fc5e12
commit
45505b1b17
|
@ -43,13 +43,13 @@ void hookExtAccess(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||||
|
|
||||||
/* only allowed if namespace has flag set */
|
/* only allowed if namespace has flag set */
|
||||||
case EXTENSION_MAJOR_SHAPE:
|
case EXTENSION_MAJOR_SHAPE:
|
||||||
if (subj->ns->allowShape == ALLOW)
|
if (XnsAuthAsk(*subj, Shape, subj->ns->allowShape))
|
||||||
goto pass;
|
goto pass;
|
||||||
goto reject;
|
goto reject;
|
||||||
|
|
||||||
/* only allowed if namespace has flag set */
|
/* only allowed if namespace has flag set */
|
||||||
case EXTENSION_MAJOR_XINPUT:
|
case EXTENSION_MAJOR_XINPUT:
|
||||||
if (subj->ns->allowXInput == ALLOW)
|
if (XnsAuthAsk(*subj, XInput, subj->ns->allowXInput))
|
||||||
goto pass;
|
goto pass;
|
||||||
goto reject;
|
goto reject;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ void hookExtDispatch(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||||
|
|
||||||
/* allow several operations */
|
/* allow several operations */
|
||||||
case EXTENSION_MAJOR_XKEYBOARD:
|
case EXTENSION_MAJOR_XKEYBOARD:
|
||||||
if (subj->ns->allowXKeyboard == ALLOW)
|
if (XnsAuthAsk(*subj, XKeyboard, subj->ns->allowXKeyboard))
|
||||||
goto pass;
|
goto pass;
|
||||||
switch (client->minorOp) {
|
switch (client->minorOp) {
|
||||||
case X_kbUseExtension:
|
case X_kbUseExtension:
|
||||||
|
@ -56,11 +56,11 @@ void hookExtDispatch(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||||
|
|
||||||
/* allow if namespace has flag set */
|
/* allow if namespace has flag set */
|
||||||
case EXTENSION_MAJOR_SHAPE:
|
case EXTENSION_MAJOR_SHAPE:
|
||||||
if (subj->ns->allowShape == ALLOW)
|
if (XnsAuthAsk(*subj, XKeyboard, subj->ns->allowShape))
|
||||||
goto pass;
|
goto pass;
|
||||||
break;
|
break;
|
||||||
case EXTENSION_MAJOR_XINPUT:
|
case EXTENSION_MAJOR_XINPUT:
|
||||||
if (subj->ns->allowXInput == ALLOW)
|
if (XnsAuthAsk(*subj, XInput, subj->ns->allowXInput))
|
||||||
goto pass;
|
goto pass;
|
||||||
switch (client->minorOp) {
|
switch (client->minorOp) {
|
||||||
case X_ListInputDevices:
|
case X_ListInputDevices:
|
||||||
|
|
|
@ -35,7 +35,7 @@ hookReceive(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||||
if (gev->extension == EXTENSION_MAJOR_XINPUT) {
|
if (gev->extension == EXTENSION_MAJOR_XINPUT) {
|
||||||
switch (gev->evtype) {
|
switch (gev->evtype) {
|
||||||
case XI_RawMotion:
|
case XI_RawMotion:
|
||||||
if ((!(subj->ns->allowMouseMotion == ALLOW)) || !isRootWin(param->pWin))
|
if (!XnsAuthAsk(*subj, Mouse, subj->ns->allowMouseMotion) || !isRootWin(param->pWin))
|
||||||
goto reject;
|
goto reject;
|
||||||
continue;
|
continue;
|
||||||
case XI_RawKeyPress:
|
case XI_RawKeyPress:
|
||||||
|
|
|
@ -31,7 +31,7 @@ void hookResourceAccess(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||||
if (param->rtype == X11_RESTYPE_WINDOW) {
|
if (param->rtype == X11_RESTYPE_WINDOW) {
|
||||||
WindowPtr pWindow = (WindowPtr) param->res;
|
WindowPtr pWindow = (WindowPtr) param->res;
|
||||||
if (param->access_mode & DixCreateAccess) {
|
if (param->access_mode & DixCreateAccess) {
|
||||||
if (!(subj->ns->allowTransparency == ALLOW)) {
|
if (!XnsAuthAsk(*subj, Transparency, subj->ns->allowTransparency)) {
|
||||||
pWindow->forcedBG = TRUE;
|
pWindow->forcedBG = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <X11/Xmd.h>
|
#include <X11/Xmd.h>
|
||||||
|
|
||||||
|
#include "extension_priv.h"
|
||||||
#include "include/dixstruct.h"
|
#include "include/dixstruct.h"
|
||||||
#include "include/list.h"
|
#include "include/list.h"
|
||||||
#include "include/privates.h"
|
#include "include/privates.h"
|
||||||
|
@ -16,6 +17,14 @@ enum Authlevel {
|
||||||
ALLOW,
|
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 auth_token {
|
||||||
struct xorg_list entry;
|
struct xorg_list entry;
|
||||||
const char *authProto;
|
const char *authProto;
|
||||||
|
@ -85,4 +94,12 @@ static inline Bool streq(const char *a, const char *b)
|
||||||
return (strcmp(a,b) == 0);
|
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 */
|
#endif /* __XSERVER_NAMESPACE_H */
|
||||||
|
|
Loading…
Reference in New Issue