HACK: DEBUG
This commit is contained in:
parent
0227a463c3
commit
a853080724
|
@ -34,6 +34,9 @@ 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:
|
||||||
|
XNS_HOOK_LOG("RawMotion winid=0x%0x%s\n",
|
||||||
|
param->pWin->drawable.id,
|
||||||
|
isRootWin(param->pWin) ? " (root window)" : "");
|
||||||
if ((!subj->ns->allowMouseMotion) || !isRootWin(param->pWin))
|
if ((!subj->ns->allowMouseMotion) || !isRootWin(param->pWin))
|
||||||
goto reject;
|
goto reject;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -36,6 +36,25 @@ void hookSelectionFilter(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||||
if (subj->ns->superPower)
|
if (subj->ns->superPower)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
const char *op = "<>";
|
||||||
|
switch (param->op) {
|
||||||
|
case SELECTION_FILTER_GETOWNER:
|
||||||
|
op = "SELECTION_FILTER_GETOWNER";
|
||||||
|
break;
|
||||||
|
case SELECTION_FILTER_SETOWNER:
|
||||||
|
op = "SELECTION_FILTER_SETOWNER";
|
||||||
|
break;
|
||||||
|
case SELECTION_FILTER_CONVERT:
|
||||||
|
op = "SELECTION_FILTER_CONVERT";
|
||||||
|
break;
|
||||||
|
case SELECTION_FILTER_EV_REQUEST:
|
||||||
|
op = "SELECTION_FILTER_EV_REQUEST";
|
||||||
|
break;
|
||||||
|
case SELECTION_FILTER_EV_CLEAR:
|
||||||
|
op = "SELECTION_FILTER_EV_CLEAR";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
const char *origSelectionName = NameForAtom(param->selection);
|
const char *origSelectionName = NameForAtom(param->selection);
|
||||||
|
|
||||||
char selname[PATH_MAX] = { 0 };
|
char selname[PATH_MAX] = { 0 };
|
||||||
|
@ -47,6 +66,11 @@ void hookSelectionFilter(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||||
case SELECTION_FILTER_SETOWNER:
|
case SELECTION_FILTER_SETOWNER:
|
||||||
case SELECTION_FILTER_CONVERT:
|
case SELECTION_FILTER_CONVERT:
|
||||||
case SELECTION_FILTER_LISTEN:
|
case SELECTION_FILTER_LISTEN:
|
||||||
|
XNS_HOOK_LOG("%s origsel=%s (%d) newsel=%s (%d) -- using newsel\n", op,
|
||||||
|
origSelectionName,
|
||||||
|
param->selection,
|
||||||
|
selname,
|
||||||
|
realSelection);
|
||||||
// TODO: check whether window really belongs to the client
|
// TODO: check whether window really belongs to the client
|
||||||
param->selection = realSelection;
|
param->selection = realSelection;
|
||||||
break;
|
break;
|
||||||
|
@ -55,13 +79,30 @@ void hookSelectionFilter(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||||
{
|
{
|
||||||
// need to translate back, since we're having the ns-prefixed name here
|
// need to translate back, since we're having the ns-prefixed name here
|
||||||
const char *stripped = stripNS(origSelectionName);
|
const char *stripped = stripNS(origSelectionName);
|
||||||
param->selection = MakeAtom(stripped, strlen(stripped), TRUE);
|
ATOM strippedAtom = MakeAtom(stripped, strlen(stripped), TRUE);
|
||||||
|
XNS_HOOK_LOG("NOTIFY stripped=\"%s\" atom=%d name=\"%s\n", stripped, strippedAtom, NameForAtom(strippedAtom));
|
||||||
|
XNS_HOOK_LOG("NOTIFY origID %d origName %s transID %d transName %s strippedName %s atom %d\n",
|
||||||
|
param->selection,
|
||||||
|
origSelectionName,
|
||||||
|
realSelection,
|
||||||
|
selname,
|
||||||
|
stripped,
|
||||||
|
strippedAtom);
|
||||||
|
param->selection = strippedAtom;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nothing to do here: already having the client visible name
|
// nothing to do here: already having the client visible name
|
||||||
case SELECTION_FILTER_EV_REQUEST:
|
case SELECTION_FILTER_EV_REQUEST:
|
||||||
case SELECTION_FILTER_EV_CLEAR:
|
case SELECTION_FILTER_EV_CLEAR:
|
||||||
|
XNS_HOOK_LOG("%s origsel=%s (%d) newsel=%s (%d) -- using origsel\n", op,
|
||||||
|
NameForAtom(param->selection),
|
||||||
|
param->selection,
|
||||||
|
selname,
|
||||||
|
realSelection);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
XNS_HOOK_LOG("unknown op: %d selection=%d\n", param->op, param->selection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,16 +37,40 @@ void hookWindowProperty(CallbackListPtr *pcbl, void *unused, void *calldata)
|
||||||
|
|
||||||
// whitelist anything that goes to caller's own namespace
|
// whitelist anything that goes to caller's own namespace
|
||||||
struct XnamespaceClientPriv *obj = XnsClientPriv(owner);
|
struct XnamespaceClientPriv *obj = XnsClientPriv(owner);
|
||||||
if (XnsClientSameNS(subj, obj))
|
if (XnsClientSameNS(subj, obj)) {
|
||||||
|
XNS_HOOK_LOG("same NS window property %s (atom 0x%x) window 0x%0x of client %d\n",
|
||||||
|
NameForAtom(param->property),
|
||||||
|
param->property,
|
||||||
|
param->window,
|
||||||
|
owner->index);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// allow access to namespace virtual root
|
// allow access to namespace virtual root
|
||||||
if (param->window == subj->ns->rootWindow->drawable.id)
|
if (param->window == subj->ns->rootWindow->drawable.id) {
|
||||||
|
XNS_HOOK_LOG("NS virtual root window property %s (atom 0x%x) window 0x%0x of client %d\n",
|
||||||
|
NameForAtom(param->property),
|
||||||
|
param->property,
|
||||||
|
param->window,
|
||||||
|
owner->index);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// redirect root window access to namespace's virtual root
|
// redirect root window access to namespace's virtual root
|
||||||
if (dixWindowIsRoot(param->window)) {
|
if (dixWindowIsRoot(param->window)) {
|
||||||
|
XNS_HOOK_LOG("redirect root window property %s (atom 0x%x) window 0x%0x of client %d to 0x%x\n",
|
||||||
|
NameForAtom(param->property),
|
||||||
|
param->property,
|
||||||
|
param->window,
|
||||||
|
owner->index,
|
||||||
|
subj->ns->rootWindow->drawable.id);
|
||||||
param->window = subj->ns->rootWindow->drawable.id;
|
param->window = subj->ns->rootWindow->drawable.id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XNS_HOOK_LOG("foreign NS window property %s (atom 0x%x) window 0x%0x of client %d\n",
|
||||||
|
NameForAtom(param->property),
|
||||||
|
param->property,
|
||||||
|
param->window,
|
||||||
|
owner->index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1609,6 +1609,7 @@ ProcSyncAwait(ClientPtr client)
|
||||||
SyncAwait *pAwait;
|
SyncAwait *pAwait;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
// not sure whether we need to filter here
|
||||||
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
|
REQUEST_AT_LEAST_SIZE(xSyncAwaitReq);
|
||||||
|
|
||||||
len = client->req_len << 2;
|
len = client->req_len << 2;
|
||||||
|
@ -2059,6 +2060,7 @@ ProcSyncQueryFence(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// not sure whether it needs to be filtered
|
||||||
static int
|
static int
|
||||||
ProcSyncAwaitFence(ClientPtr client)
|
ProcSyncAwaitFence(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,8 +162,10 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
rc = dixLookupWindow(&win, stuff->win, client, DixReceiveAccess);
|
rc = dixLookupWindow(&win, stuff->win, client, DixReceiveAccess);
|
||||||
|
|
||||||
// when access to the window is denied, just pretend everything's okay
|
// when access to the window is denied, just pretend everything's okay
|
||||||
if (rc == BadAccess)
|
if (rc == BadAccess) {
|
||||||
|
printf(" ==> ProcXISelectEvents() resource hook denied access to window 0x%0x\n", stuff->win);
|
||||||
return Success;
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -296,6 +298,21 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
evmask->mask_len * 4) != Success)
|
evmask->mask_len * 4) != Success)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
|
{
|
||||||
|
CARD32 *bits = (CARD32*)&evmask[1];
|
||||||
|
printf("mask before: 0x%0x\n", *bits);
|
||||||
|
printf("subtracting: 0x%0x\n", (XI_RawKeyPressMask | XI_RawKeyReleaseMask |
|
||||||
|
XI_RawButtonPress | XI_RawButtonRelease |
|
||||||
|
XI_RawMotion | XI_RawTouchBegin | XI_RawTouchUpdate |
|
||||||
|
XI_RawTouchEnd));
|
||||||
|
// (*bits) &= ~(XI_RawKeyPressMask | XI_RawKeyReleaseMask |
|
||||||
|
// XI_RawButtonPress | XI_RawButtonRelease |
|
||||||
|
// XI_RawMotion | XI_RawTouchBegin | XI_RawTouchUpdate |
|
||||||
|
// XI_RawTouchEnd);
|
||||||
|
printf("mask after: 0x%0x\n", *bits);
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: possible buffer overflow ?
|
||||||
evmask =
|
evmask =
|
||||||
(xXIEventMask *) (((unsigned char *) evmask) +
|
(xXIEventMask *) (((unsigned char *) evmask) +
|
||||||
evmask->mask_len * 4);
|
evmask->mask_len * 4);
|
||||||
|
|
Loading…
Reference in New Issue