Xi: add XACE hooks for device creation (ChangeDeviceHierarchy)
AddInputDevice checks for permissions already, so all we do is modify a few callers to let AID sort it out.
This commit is contained in:
parent
6492d513c0
commit
ba315ae5dd
|
@ -52,6 +52,7 @@ from the author.
|
|||
#include "exevents.h"
|
||||
#include "exglobals.h"
|
||||
#include "geext.h"
|
||||
#include "xace.h"
|
||||
|
||||
#include "chdevhier.h"
|
||||
|
||||
|
@ -104,20 +105,17 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
|
|||
{
|
||||
xCreateMasterInfo* c = (xCreateMasterInfo*)any;
|
||||
char* name;
|
||||
int ret;
|
||||
|
||||
/* XXX: check for creation permission */
|
||||
|
||||
SWAPIF(swaps(&c->namelen, n));
|
||||
name = xcalloc(c->namelen + 1, sizeof(char));
|
||||
strncpy(name, (char*)&c[1], c->namelen);
|
||||
|
||||
|
||||
ret = AllocMasterDevice(name, &ptr, &keybd);
|
||||
if (ret != Success)
|
||||
rc = AllocMasterDevice(client, name, &ptr, &keybd);
|
||||
if (rc != Success)
|
||||
{
|
||||
xfree(name);
|
||||
return ret;
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (!c->sendCore)
|
||||
|
|
|
@ -100,7 +100,7 @@ DevPrivateKey CoreDevicePrivateKey = &CoreDevicePrivateKey;
|
|||
* @return The newly created device.
|
||||
*/
|
||||
DeviceIntPtr
|
||||
AddInputDevice(DeviceProc deviceProc, Bool autoStart)
|
||||
AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
|
||||
{
|
||||
DeviceIntPtr dev, *prev; /* not a typo */
|
||||
DeviceIntPtr devtmp;
|
||||
|
@ -562,9 +562,9 @@ CorePointerProc(DeviceIntPtr pDev, int what)
|
|||
void
|
||||
InitCoreDevices(void)
|
||||
{
|
||||
if (AllocMasterDevice("Virtual core",
|
||||
if (AllocMasterDevice(serverClient, "Virtual core",
|
||||
&inputInfo.pointer,
|
||||
&inputInfo.keyboard) == BadAlloc)
|
||||
&inputInfo.keyboard) != Success)
|
||||
FatalError("Failed to allocate core devices");
|
||||
}
|
||||
|
||||
|
@ -2597,13 +2597,13 @@ NextFreePointerDevice()
|
|||
* EnableDevice() manually.
|
||||
*/
|
||||
int
|
||||
AllocMasterDevice(char* name, DeviceIntPtr* ptr, DeviceIntPtr* keybd)
|
||||
AllocMasterDevice(ClientPtr client, char* name, DeviceIntPtr* ptr, DeviceIntPtr* keybd)
|
||||
{
|
||||
DeviceIntPtr pointer;
|
||||
DeviceIntPtr keyboard;
|
||||
*ptr = *keybd = NULL;
|
||||
|
||||
pointer = AddInputDevice(CorePointerProc, TRUE);
|
||||
pointer = AddInputDevice(client, CorePointerProc, TRUE);
|
||||
if (!pointer)
|
||||
return BadAlloc;
|
||||
|
||||
|
@ -2628,7 +2628,7 @@ AllocMasterDevice(char* name, DeviceIntPtr* ptr, DeviceIntPtr* keybd)
|
|||
pointer->u.lastSlave = NULL;
|
||||
pointer->isMaster = TRUE;
|
||||
|
||||
keyboard = AddInputDevice(CoreKeyboardProc, TRUE);
|
||||
keyboard = AddInputDevice(client, CoreKeyboardProc, TRUE);
|
||||
if (!keyboard)
|
||||
return BadAlloc;
|
||||
|
||||
|
|
|
@ -318,8 +318,8 @@ void
|
|||
InitInput(int argc, char *argv[])
|
||||
{
|
||||
DeviceIntPtr p, k;
|
||||
p = AddInputDevice(vfbMouseProc, TRUE);
|
||||
k = AddInputDevice(vfbKeybdProc, TRUE);
|
||||
p = AddInputDevice(serverClient, vfbMouseProc, TRUE);
|
||||
k = AddInputDevice(serverClient, vfbKeybdProc, TRUE);
|
||||
RegisterPointerDevice(p);
|
||||
RegisterKeyboardDevice(k);
|
||||
(void)mieqInit();
|
||||
|
|
|
@ -158,7 +158,7 @@ xf86ActivateDevice(LocalDevicePtr local)
|
|||
DeviceIntPtr dev;
|
||||
|
||||
if (local->flags & XI86_CONFIGURED) {
|
||||
dev = AddInputDevice(local->device_control, TRUE);
|
||||
dev = AddInputDevice(serverClient, local->device_control, TRUE);
|
||||
|
||||
if (dev == NULL)
|
||||
FatalError("Too many input devices");
|
||||
|
|
|
@ -89,8 +89,8 @@ InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
|
|||
void
|
||||
InitInput(int argc, char *argv[])
|
||||
{
|
||||
xnestPointerDevice = AddInputDevice(xnestPointerProc, TRUE);
|
||||
xnestKeyboardDevice = AddInputDevice(xnestKeyboardProc, TRUE);
|
||||
xnestPointerDevice = AddInputDevice(serverClient, xnestPointerProc, TRUE);
|
||||
xnestKeyboardDevice = AddInputDevice(serverClient, xnestKeyboardProc, TRUE);
|
||||
|
||||
if (!xnestEvents)
|
||||
xnestEvents = (xEvent *) xcalloc(sizeof(xEvent), GetMaximumEventsNum());
|
||||
|
|
|
@ -180,6 +180,7 @@ typedef struct _InputOption {
|
|||
extern void InitCoreDevices(void);
|
||||
|
||||
extern DeviceIntPtr AddInputDevice(
|
||||
ClientPtr /*client*/,
|
||||
DeviceProc /*deviceProc*/,
|
||||
Bool /*autoStart*/);
|
||||
|
||||
|
@ -471,7 +472,8 @@ extern Bool RegisterPairingClient(ClientPtr client);
|
|||
extern DeviceIntPtr GuessFreePointerDevice(void);
|
||||
extern DeviceIntPtr NextFreePointerDevice(void);
|
||||
|
||||
extern int AllocMasterDevice(char* name,
|
||||
extern int AllocMasterDevice(ClientPtr client,
|
||||
char* name,
|
||||
DeviceIntPtr* ptr,
|
||||
DeviceIntPtr* keybd);
|
||||
extern void DeepCopyDeviceClasses(DeviceIntPtr from,
|
||||
|
|
|
@ -63,6 +63,9 @@ XkbSrvLedInfoPtr sli;
|
|||
|
||||
sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
|
||||
|
||||
if (!sli)
|
||||
return update;
|
||||
|
||||
if (state_changes&(XkbModifierStateMask|XkbGroupStateMask))
|
||||
update|= sli->usesEffective;
|
||||
if (state_changes&(XkbModifierBaseMask|XkbGroupBaseMask))
|
||||
|
|
Loading…
Reference in New Issue