Xi: if a pre-XI2 client tries to list the devices, pretend we don't have any.
XI 1.x isn't supported anymore, so let's pretend we don't have any devices. This stops clients from opening them and thus stops interference.
This commit is contained in:
parent
8973a3f798
commit
7447a30fb2
30
Xi/listdev.c
30
Xi/listdev.c
|
@ -64,6 +64,7 @@ SOFTWARE.
|
||||||
#include "XIstubs.h"
|
#include "XIstubs.h"
|
||||||
#include "extnsionst.h"
|
#include "extnsionst.h"
|
||||||
#include "exglobals.h" /* FIXME */
|
#include "exglobals.h" /* FIXME */
|
||||||
|
#include "exevents.h"
|
||||||
#include "xace.h"
|
#include "xace.h"
|
||||||
|
|
||||||
#include "listdev.h"
|
#include "listdev.h"
|
||||||
|
@ -313,12 +314,17 @@ CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
|
||||||
*
|
*
|
||||||
* This procedure lists the input devices available to the server.
|
* This procedure lists the input devices available to the server.
|
||||||
*
|
*
|
||||||
|
* If this request is called by a client that has not issued a
|
||||||
|
* GetExtensionVersion request with major/minor version set, we pretend no
|
||||||
|
* devices are available. It's the only thing we can do to stop pre-XI 2
|
||||||
|
* clients.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
ProcXListInputDevices(ClientPtr client)
|
ProcXListInputDevices(ClientPtr client)
|
||||||
{
|
{
|
||||||
xListInputDevicesReply rep;
|
xListInputDevicesReply rep;
|
||||||
|
XIClientPtr pXIClient;
|
||||||
int numdevs = 0;
|
int numdevs = 0;
|
||||||
int namesize = 1; /* need 1 extra byte for strcpy */
|
int namesize = 1; /* need 1 extra byte for strcpy */
|
||||||
int rc, size = 0;
|
int rc, size = 0;
|
||||||
|
@ -337,8 +343,11 @@ ProcXListInputDevices(ClientPtr client)
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
|
|
||||||
|
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||||
|
|
||||||
AddOtherInputDevices();
|
AddOtherInputDevices();
|
||||||
|
|
||||||
|
if (!pXIClient->major_version >= XI_2_Major) {
|
||||||
for (d = inputInfo.devices; d; d = d->next) {
|
for (d = inputInfo.devices; d; d = d->next) {
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
@ -353,6 +362,20 @@ ProcXListInputDevices(ClientPtr client)
|
||||||
SizeDeviceInfo(d, &namesize, &size);
|
SizeDeviceInfo(d, &namesize, &size);
|
||||||
numdevs++;
|
numdevs++;
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
/* Pretend we don't have XI devices connected */
|
||||||
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.pointer, DixGetAttrAccess);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, inputInfo.keyboard, DixGetAttrAccess);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
SizeDeviceInfo(inputInfo.pointer, &namesize, &size);
|
||||||
|
SizeDeviceInfo(inputInfo.keyboard, &namesize, &size);
|
||||||
|
numdevs = 2;
|
||||||
|
}
|
||||||
|
|
||||||
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
|
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
|
||||||
devbuf = (char *)xalloc(total_length);
|
devbuf = (char *)xalloc(total_length);
|
||||||
|
@ -361,10 +384,17 @@ ProcXListInputDevices(ClientPtr client)
|
||||||
savbuf = devbuf;
|
savbuf = devbuf;
|
||||||
|
|
||||||
dev = (xDeviceInfoPtr) devbuf;
|
dev = (xDeviceInfoPtr) devbuf;
|
||||||
|
if (pXIClient->major_version >= XI_2_Major)
|
||||||
|
{
|
||||||
for (d = inputInfo.devices; d; d = d->next, dev++)
|
for (d = inputInfo.devices; d; d = d->next, dev++)
|
||||||
ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
|
ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
|
||||||
for (d = inputInfo.off_devices; d; d = d->next, dev++)
|
for (d = inputInfo.off_devices; d; d = d->next, dev++)
|
||||||
ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
|
ListDeviceInfo(client, d, dev, &devbuf, &classbuf, &namebuf);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
ListDeviceInfo(client, inputInfo.pointer, dev, &devbuf, &classbuf, &namebuf);
|
||||||
|
ListDeviceInfo(client, inputInfo.keyboard, dev, &devbuf, &classbuf, &namebuf);
|
||||||
|
}
|
||||||
|
|
||||||
rep.ndevices = numdevs;
|
rep.ndevices = numdevs;
|
||||||
rep.length = (total_length + 3) >> 2;
|
rep.length = (total_length + 3) >> 2;
|
||||||
|
|
Loading…
Reference in New Issue