Commit Graph

575 Commits

Author SHA1 Message Date
Alan Coopersmith
895f40792a Add type name argument to CreateNewResourceType
Convert all calls of CreateNewResourceType to pass name argument

Breaks DIX ABI.

ABI versions bumped:

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2009-12-18 17:44:12 -08:00
Alan Coopersmith
a11c58fa0c Ensure all resource types created have names registered
Calls RegisterResourceName to record the type name for
use by X-Resource, XACE/SELinux/XTsol, and DTrace.

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2009-12-18 16:51:45 -08:00
Alan Coopersmith
eb750f8b5e Check for failures from CreateNewResourceType
Make sure to check return value before setting bitmask flags.
For most calls, just fails to init the extension.   Since Xinput
already calls FatalError() on initialization failure, so does
failure to allocate Xinput's resource type.

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2009-12-18 16:51:45 -08:00
Rami Ylimaki
eb967ca36c Xext: Fix a memory leak on GE client disconnect.
Add a call to dixRequestPrivate to inform dixFreePrivates that memory
allocated in GEClientCallback should be released when client
disconnects. Otherwise there is a leak of sizeof(GEClientInfoRec) for
every client connect/disconnect.

Also remove the explicit allocation and let GEGetClient /
dixLookupPrivate do it. This makes GEClientCallback similar to the
other extension callbacks.

Signed-off-by: Rami Ylimaki <ext-rami.ylimaki@nokia.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-11-25 10:55:22 +10:00
Jamey Sharp
25979c46b4 Alloc/free drawables array for each ProcPanoramiXShmGetImage call.
Updates my previous patch, b422b532f3.
keithp recommended against allocating the drawables array globally, but my
updated patch with that fixed isn't the patch that landed.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
2009-10-28 18:22:54 -07:00
Eamon Walsh
264ce9e836 xselinux: Use the now-exported IsPointerDevice() instead of a copy.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-10-14 20:33:53 -04:00
Eamon Walsh
6c2ae5fec5 xselinux: switch from x_device to separate x_pointer and x_keyboard classes.
This will allow separate controls over pointer and keyboard without having
to relabel the devices to separate types.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-10-14 19:19:19 -04:00
Eamon Walsh
0ff2831990 xselinux: Stop special-casing QueryPointer access checks.
XACE has been changed to not return BadAccess on device read failures.
Thus, no need for this workaround code.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-10-14 19:19:19 -04:00
Eamon Walsh
0493935691 xselinux: Factor out some dynamic array code into common helpers.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-10-14 19:19:18 -04:00
Eamon Walsh
ae8891ba0b xselinux: refactor extension code into smaller files.
New files:
xselinux_ext.c: Extension init and request handlers.
xselinux_hooks.c: XACE hook functions and other callbacks.
xselinux_label.c: Object security-labeling code.
xselinuxint.h: Shared internal functions.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-10-14 19:19:18 -04:00
Jamey Sharp
b0dd6be2c8 Cast small-int values through intptr_t when passed as pointers
On 64-bit systems, int and pointers don't have the same size, so GCC gives
warnings about casts between int and pointer types. However, in the cases
covered by this patch, it's always a value that fits in int being stored
temporarily as a pointer and then converted back later, which is safe.
Casting through the pointer-sized integer type intptr_t convinces the
compiler that this is OK.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-10-08 13:38:44 +11:00
Jamey Sharp
b422b532f3 Remove static MAXSCREENS limit from Xext/shm.c
Dynamically allocate per-screen data in the SHM extension, instead of
having a single static-sized array.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-10-08 13:29:30 +11:00
Jamey Sharp
44efcdde50 Fix overlay detection when matching Xv adaptors across screens.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Acked-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2009-10-07 12:46:38 -07:00
Michel Dänzer
11817a881c Fix ShmPutImage non-ZPixmap case.
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=23298 .
2009-09-29 08:56:59 +02:00
Peter Hutterer
693d4fdb1c Xext: switch mbuf.c to dixLookupResourceByType
Resolves a linker error caused by LookupIDByType.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-22 11:14:00 +10:00
Peter Hutterer
493d2f9c2f Xext: remove DisplayImageBuffers from mbuf.c
Not referenced by anything.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-22 11:05:07 +10:00
Peter Hutterer
fff40b3353 Xext: fix up multibuffer compiler errors.
Triggered by the xextproto 7.1 change, fixed by moving the matching
declarations from the header file to here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-22 10:54:47 +10:00
Peter Hutterer
55747d256d input: define server-supported protocol versions in one single file.
include/protocol-versions.h specifies each extension version as supported by
the server and sent back on the wire to the client.

This fixes up several issues with the server potentially reporting a higher
version of the protocol if recompiled against a newer version of the
protocol.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Rémi Cardona <remi@gentoo.org>
Acked-by: Julien Cristau <jcristau@debian.org>
2009-09-21 21:47:35 +10:00
Peter Hutterer
aa71e268f5 Xext: silence 'warning: no previous prototype' for sync, bigreq and xcmisc.
xcmisc and bigreq don't have their own header so just declare it here to
shut up the compiler.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-21 09:17:56 +10:00
Thomas Jaeger
971d4eac12 Xext: include security protocol header instead of client header
Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-20 19:57:01 +10:00
Peter Hutterer
e62549b8d6 Xext: don't try to initialize XTEST device properties if they failed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-09-10 09:48:05 +10:00
Eamon Walsh
a470e8426e Correct outdated e-mail address in "Author" statements.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-09-02 17:56:52 -04:00
Jerome Glisse
0e46066efe Xext: fix a typo for bigreqsproto.h header file
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2009-09-01 13:59:47 +02:00
Jeremy Huddleston
c61d8ce150 Xext: Require newer versions of xcmiscproto, bigreqsproto, and xf86bigfontproto for new *proto.h header file names
bigreqsproto >= 1.1.0
xcmiscproto >= 1.2.0
xf86bigfontproto >= 1.2.0
2009-08-31 18:44:53 -07:00
Peter Hutterer
903c3db1d1 Xext: rename Xtst* to XTest*
This patch corrects a misnaming of XTest-related functions.

The extension itself announces itself as XTEST. Xtst is the library name
itself, but all library functions are prefixed by XTest. Same with the
naming in the server.

- Rename all *Xtst* functions to *XTest* for consistency with the library
  and in-server API.
- Rename the "Xtst device" property to "XTEST device" for consistency with
  the extension naming.
- Rename the device naming to "<master device name> XTEST device". The
  default xtest devices become "Virtual core XTEST pointer" and "Virtual
  core XTEST keyboard".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-27 14:24:51 +10:00
Peter Hutterer
8bfd23e144 input: move XTest device initialization into Xext/xtest.c
XTest devices are non-optional but nonetheless specific to the XTEST
extension.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-27 14:24:50 +10:00
Peter Hutterer
990d204ef8 Xext: remove un-used extern of DeviceMotionNotify.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-24 10:15:00 +10:00
Eamon Walsh
73975ef3a3 xselinux: Allow per-client device create contexts.
The previous behavior was to set the serverClient's value which was used globally.
This is in support of XI2, where clients can create device pairs directly.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-08-17 14:51:10 -04:00
Eamon Walsh
66e32d252c xselinux: Add more new device permissions for XI2.
Reflects the ability of clients to create/destroy device objects.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-08-17 14:51:10 -04:00
Richard Hughes
c1d901d723 Don't reset the lastDeviceEventTime when doing DPMS actions
When we change the DPMS mode, don't play games with the last event time as
this breaks applications using IDLETIME to turn the backlight off after a
preset time.

This patch fixes gnome-power-manager and xfce-power-manager

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-17 11:18:38 +10:00
Peter Hutterer
db568f9eab Xext: fix up wrong conditions for negative sync transitions.
If the counter had a value higher than the trigger value for a negative
transition, the trigger value did not get set.

The correct sequence of checks is:
if (positive transition)
   if (counter value < trigger value)
      set up trigger
if (negative transition)
   if (counter value > trigger value)
      set up trigger

Red Hat Bug 501601 <https://bugzilla.redhat.com/show_bug.cgi?id=501601>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-14 07:49:52 +10:00
Peter Hutterer
36e24a6d93 Xext: add missing return code check to ProcSyncDestroyAlarm
Introduced with 57aff88c7d.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13 11:19:37 +10:00
Peter Hutterer
e46f02fa2d Xext: allocate a separate event list for XTest events (#23100)
XTest event processing may be interrupted by a SIGIO. If Xtest uses the same
event list as the rest of the server, this list may be overwritten
in-flight.

X.Org Bug 23100 <http://bugs.freedesktop.org/show_bug.cgi?id=23100>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-08-13 11:19:35 +10:00
Peter Hutterer
4db8950b1d Xext: include securproto.h instead of securstr.h
Reported-by: Byeong-ryeol Kim
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-17 14:40:54 +10:00
Peter Hutterer
d3f6b43a24 Update to xextproto 7.0.99.1.
xextproto had Xlib client headers moved into libXext.
Protocol header files are named fooproto.h, header files with constants
foo.h or fooconst.h where foo.h was already in use for client-side headers.
2009-07-15 17:00:05 +10:00
Peter Hutterer
7b9e84e320 Xext: switch to byte counting functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-14 10:14:01 +10:00
Michael Lorenz
36dc66ae79 The way XaceHook() mixes struct initializers and va_arg() is not portable and
gives bogus data on sparc and probably others leading to a crash.

Fix:
Don't use initializers, instead set each member directly to enforce order.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-07-07 20:21:39 -04:00
Peter Hutterer
89cf81cd85 Xext: return BadValue for XTestFakeInput on unsupported capabilities.
Calling XTestFakeDevice*Event on a device that doesn't allow the matching
event returns BadValue.

Reported-by: Florian Echtler
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-06 12:59:42 +10:00
Peter Hutterer
744bb55982 Xext: remove unused variable 'it'.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-07-06 12:58:03 +10:00
Peter Hutterer
0814f511d5 input: store the master device's ID in the devPrivate for XTest devices.
Rather than storing a simple boolean in the devPrivate for XTest devices,
store the actual master device's id (since it is constant for the life of
the device anyway).

Callers should use GetXtstDevice now instead of digging around in the
devPrivates themselves.

This patch allows for a cleanup in the creation of new master devices since
GetMaster and GetXtstDevice spare the need for loops, IsPointer checks and
similar.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Close <Benjamin.Close@clearchain.com>
2009-07-01 08:46:31 +10:00
Eamon Walsh
51105de9b0 xselinux: ignore property hook calls with the new Post access mode bit set.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-06-26 17:05:52 -04:00
Eamon Walsh
3efb23a6c4 xselinux: Add new device permissions for XI2.
Refects the ability of clients to add/remove devices and device properties.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-06-18 20:56:19 -04:00
Eamon Walsh
1e060c3d8b xselinux: Move the security class mapping to the header file.
Take the mapping of DixAccess bits to Flask permissions, move it
into the header file, break up the extremely long lines, and
annotate the permission names with the bit being referenced.

Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
2009-06-18 20:56:18 -04:00
Peter Hutterer
d7aef3f663 Merge branch 'master' into xi2
Conflicts:
	Xext/geext.c
	Xi/chdevcur.c
	Xi/extgrbdev.c
	Xi/xiproperty.c
	configure.ac
	dix/ptrveloc.c
	hw/xfree86/common/xf86Config.c
	mi/mipointer.h
	test/input.c
	xkb/xkb.c
2009-05-28 17:20:58 +10:00
Peter Hutterer
b12d302df8 Input: rename DeviceIntRec->isMaster to ->type.
isMaster is not enough as long as we differ between master pointers and
keyboard. With flexible device classes, the usual checks for whether a
master device is a pointer (currently check for ->button, ->valuators or
->key) do not work as an SD may post an event through a master and mess this
check up.

Example, a device with valuators but no buttons would remove the button
class from the VCP and thus result in the
IsPointerDevice(inputInfo.pointer) == FALSE.

This will become worse in the future when new device classes are introduced
that aren't provided in the current system (e.g. a switch class).

This patch replaces isMaster with "type", one of SLAVE, MASTER_POINTER and
MASTER_KEYBOARD. All checks for dev->isMaster are replaced with an
IsMaster(dev).
2009-05-22 15:44:50 +10:00
Eamon Walsh
0952d12717 xselinux: Relax ownership restriction on SetSelectionUseContext.
Instead, clients should keep track of the selection instances they use.
2009-05-11 15:27:46 -04:00
Alan Coopersmith
b680bda34d Fix a couple off-by-one array boundary checks.
Error: Write outside array bounds at Xext/geext.c:406
        in function 'GEWindowSetMask' [Symbolic analysis]
       In array dereference of cli->nextSib[extension] with index 'extension'
       Array size is 128 elements (of 4 bytes each), index <= 128

Error: Buffer overflow at dix/events.c:592
	in function 'SetMaskForEvent' [Symbolic analysis]
       In array dereference of filters[deviceid] with index 'deviceid'
       Array size is 20 elements (of 512 bytes each), index >= 0 and index <= 20

Error: Read buffer overflow at hw/xfree86/loader/loader.c:226
	in function 'LoaderOpen' [Symbolic analysis]
       In array dereference of refCount[new_handle] with index 'new_handle'
       Array size is 256 elements (of 4 bytes each), index >= 1 and index <= 256

These bugs were found using the Parfait source code analysis tool.
For more information see http://research.sun.com/projects/parfait

Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-08 12:27:11 -07:00
Peter Hutterer
a38d33f6ac Xext: shut up compiler warnings in xtest.c
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-05 14:12:04 +10:00
Peter Hutterer
14d5471981 Xext: return BadDevice from XTest if we don't have keys/buttons/valuators.
BadDevice is an XI error, but this cannot happen for core XTest fake input
anyway since the device will be the matching virtual XTest slave device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-05 14:12:04 +10:00
Peter Hutterer
f1bed0959e Xext: fix core Xtest button presses, don't call PickPointer.
We already did the device selection before, so dev should be the XTest virtual
pointer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2009-05-05 14:12:04 +10:00