xorg-server: Changes to 'upstream-unstable'
Xext/xselinux.c | 131 +++++++++----------------------
Xext/xselinux.h | 8 -
Xi/exevents.c | 13 +--
Xi/setmode.c | 10 ++
configure.ac | 18 +---
dix/devices.c | 8 -
dix/events.c | 83 +------------------
dix/getevents.c | 7 +
hw/xfree86/common/xf86VGAarbiter.c | 65 ---------------
hw/xfree86/common/xf86cmap.c | 9 --
hw/xfree86/modes/xf86Crtc.c | 14 +--
hw/xfree86/modes/xf86Crtc.h | 26 ++++++
hw/xfree86/modes/xf86RandR12.c | 14 ++-
hw/xfree86/os-support/solaris/sun_bell.c | 5 -
hw/xquartz/GL/indirect.c | 2
hw/xquartz/GL/visualConfigs.c | 3
hw/xquartz/X11Application.m | 18 ++--
hw/xquartz/mach-startup/bundle-main.c | 30 +++++--
hw/xquartz/mach-startup/stub.c | 7 -
hw/xquartz/pbproxy/x-selection.h | 9 --
hw/xquartz/quartzAudio.c | 35 ++++----
hw/xquartz/quartzKeyboard.c | 2
include/dix-config.h.in | 2
include/dix.h | 6 -
include/eventconvert.h | 6 -
record/record.c | 123 ++++++++++++++++-------------
26 files changed, 262 insertions(+), 392 deletions(-)
New commits:
commit 1242e494c8abc25d51fa0f8120ba353ffcf7be08
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Mar 5 09:27:13 2010 +1000
xserver 1.7.5.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 0726bd2..08e444e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.7.5, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2010-02-16"
+AC_INIT([xorg-server], 1.7.5.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2010-03-05"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([dist-bzip2 foreign])
AM_MAINTAINER_MODE
commit d023b78c739672894d6b8196d91129845614e369
Author: Keith Packard <keithp@keithp.com>
Date: Thu Feb 25 11:37:05 2010 -0800
Allow for missing or disabled compat_output
When the compat output is missing (I don't think this is actually
possible), or is disabled (and hence has no crtc), we would like to
avoid dereferencing NULL pointers. This patch creates inline functions
to extract the current compat output, crtc or associated RandR crtc
structure, carefully checking for NULL pointers everywhere.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit de86a3a3448f0a55c1cd99aee9ea80070a589877)
diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index edd5ae9..f60d96e 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -1001,8 +1001,7 @@ xf86ChangeGammaRamp(
CMapLinkPtr pLink;
if (xf86_crtc_supports_gamma(pScrn)) {
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
if (crtc) {
if (crtc->gammaSize != size)
@@ -1076,8 +1075,7 @@ xf86GetGammaRampSize(ScreenPtr pScreen)
CMapScreenPtr pScreenPriv;
if (xf86_crtc_supports_gamma(pScrn)) {
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
if (crtc)
return crtc->gammaSize;
@@ -1106,8 +1104,7 @@ xf86GetGammaRamp(
int shift, sigbits;
if (xf86_crtc_supports_gamma(pScrn)) {
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
if (crtc) {
if (crtc->gammaSize < size)
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 9370640..334fad4 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2571,8 +2571,8 @@ xf86SetDesiredModes (ScrnInfoPtr scrn)
if (!crtc->enabled)
continue;
- if (config->output[config->compat_output]->crtc == crtc)
- output = config->output[config->compat_output];
+ if (xf86CompatOutput(scrn) && xf86CompatCrtc(scrn) == crtc)
+ output = xf86CompatOutput(scrn);
else
{
for (o = 0; o < config->num_output; o++)
@@ -2692,14 +2692,16 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
Bool ok = TRUE;
- xf86OutputPtr compat_output = config->output[config->compat_output];
- DisplayModePtr compat_mode;
+ xf86OutputPtr compat_output;
+ DisplayModePtr compat_mode = NULL;
int c;
/*
* Let the compat output drive the final mode selection
*/
- compat_mode = xf86OutputFindClosestMode (compat_output, desired);
+ compat_output = xf86CompatOutput(pScrn);
+ if (compat_output)
+ compat_mode = xf86OutputFindClosestMode (compat_output, desired);
if (compat_mode)
desired = compat_mode;
@@ -2894,7 +2896,7 @@ xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
}
/* Set the DDC properties for the 'compat' output */
- if (output == config->output[config->compat_output])
+ if (output == xf86CompatOutput(scrn))
xf86SetDDCproperties(scrn, edid_mon);
#ifdef RANDR_12_INTERFACE
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h
index 9baa956..68a968c 100644
--- a/hw/xfree86/modes/xf86Crtc.h
+++ b/hw/xfree86/modes/xf86Crtc.h
@@ -689,6 +689,32 @@ extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
#define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
+static _X_INLINE xf86OutputPtr
+xf86CompatOutput(ScrnInfoPtr pScrn)
+{
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ return config->output[config->compat_output];
+}
+
+static _X_INLINE xf86CrtcPtr
+xf86CompatCrtc(ScrnInfoPtr pScrn)
+{
+ xf86OutputPtr compat_output = xf86CompatOutput(pScrn);
+ if (!compat_output)
+ return NULL;
+ return compat_output->crtc;
+}
+
+static _X_INLINE RRCrtcPtr
+xf86CompatRRCrtc(ScrnInfoPtr pScrn)
+{
+ xf86CrtcPtr compat_crtc = xf86CompatCrtc(pScrn);
+ if (!compat_crtc)
+ return NULL;
+ return compat_crtc->randr_crtc;
+}
+
+
/*
* Initialize xf86CrtcConfig structure
*/
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 1fc63c4..7ba09b6 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -805,9 +805,10 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
}
else
{
- xf86OutputPtr output = config->output[config->compat_output];
+ xf86OutputPtr output = xf86CompatOutput(pScrn);
- if (output->conf_monitor &&
+ if (output &&
+ output->conf_monitor &&
(output->conf_monitor->mon_width > 0 &&
output->conf_monitor->mon_height > 0))
{
@@ -1719,10 +1720,13 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
{
CARD16 *points, *red, *green, *blue;
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
- RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
- int size = max(0, crtc->gammaSize);
+ RRCrtcPtr crtc = xf86CompatRRCrtc(pScrn);
+ int size;
+ if (!crtc)
+ return Success;
+
+ size = max(0, crtc->gammaSize);
if (!size)
return Success;
commit 7def5cdf7dce0ace34e0befb3a9730e1bd607b61
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Mar 4 15:42:47 2010 +1000
configure: move SELINUX_LIBS to XSERVER_SYS_LIBS
All ddxs require linking against selinux if enabled.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 1c2abec479cfbac9aeadc121af0825d368317658)
Conflicts:
configure.ac
diff --git a/configure.ac b/configure.ac
index 562111c..0726bd2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1326,7 +1326,7 @@ PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
#
XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS} ${SHA1_CFLAGS}"
XSERVER_LIBS="$DIX_LIB $CONFIG_LIB $MI_LIB $OS_LIB"
-XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${SHA1_LIB}"
+XSERVER_SYS_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS} ${SHA1_LIB} ${SELINUX_LIBS}"
AC_SUBST([XSERVER_LIBS])
AC_SUBST([XSERVER_SYS_LIBS])
@@ -1479,7 +1479,7 @@ if test "x$XORG" = xyes; then
AC_CHECK_FUNCS([pci_device_vgaarb_init])
LIBS=$SAVE_LIBS
CFLAGS=$SAVE_CFLAGS
- XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS $SELINUX_LIBS"
+ XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS"
XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
case $host_os in
commit 402668251135b63b7329722397fe7885e065f27c
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Mar 4 15:41:53 2010 +1000
configure: move libselinux requirement up to the common section.
Let's have all version-specific requirements in one block.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
Reviewed-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit cab99b947c66a42dbf8a906bdb02e23aa7cab519)
Conflicts:
configure.ac
diff --git a/configure.ac b/configure.ac
index 558de87..562111c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -759,6 +759,7 @@ LIBXI="xi >= 1.2.99.1"
LIBXTST="xtst >= 1.0.99.2"
LIBPCIACCESS="pciaccess >= 0.8.0"
LIBGLIB="glib-2.0 >= 2.16"
+LIBSELINUX="libselinux >= 2.0.86"
dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
dnl CONFIG_DBUS_API is true if we want to enable the D-Bus config
@@ -1014,7 +1015,7 @@ if test "x$XSELINUX" = xyes; then
fi
AC_CHECK_HEADERS([libaudit.h], [], AC_MSG_ERROR([SELinux extension requires audit system headers]))
AC_CHECK_LIB(audit, audit_open, [], AC_MSG_ERROR([SELinux extension requires audit system library]))
- PKG_CHECK_MODULES([SELINUX], [libselinux >= 2.0.86])
+ PKG_CHECK_MODULES([SELINUX], $LIBSELINUX)
SELINUX_LIBS="$SELINUX_LIBS -laudit"
AC_DEFINE(XSELINUX, 1, [Build SELinux extension])
fi
commit 351d11fd466fae731df860a6ff4cf50ad565f43f
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Feb 25 12:49:21 2010 +1000
dix: Use DeliverGrabbedEvent for implicit passive grabs (#25400)
A client requesting a GrabModeSync button grab, owner-events true, with only
the ButtonRelease mask set would never receive the press event even if the
grab window had the ButtonPress mask set.
The protocol requires that if owner-events is true, then the delivery mask
is the combination of the grab mask + the window event mask.
DeliverGrabbedEvents does this already for us, checking first the delivery
based on owner_events and then based on the grab mask. AFAICT, the device
cannot enter the states FREEZE_BOTH_NEXT_EVENT or FREEZE_NEXT_EVENT that
would be handled by DGE in any possible path here.
Bonus point - CheckPassiveGrabsOnWindows suddenly becomes a lot lesss
complicated.
X.Org Bug 25400 <http://bugs.freedesktop.org/show_bug.cgi?id=25400>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit cf72b5437d2d620521279077a29c5df6d0fbb576)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/dix/events.c b/dix/events.c
index 02079be..c6aa4ab 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3462,7 +3462,6 @@ CheckPassiveGrabsOnWindow(
{
DeviceIntPtr gdev;
XkbSrvInfoPtr xkbi = NULL;
- Mask mask = 0;
gdev= grab->modifierDevice;
if (grab->grabtype == GRABTYPE_CORE)
@@ -3515,10 +3514,6 @@ CheckPassiveGrabsOnWindow(
(grab->confineTo->realized &&
BorderSizeNotEmpty(device, grab->confineTo))))
{
- int rc, count = 0;
- xEvent *xE = NULL;
- xEvent core;
-
event->corestate &= 0x1f00;
event->corestate |= tempGrab.modifiersDetail.exact & (~0x1f00);
grabinfo = &device->deviceGrab;
@@ -3565,62 +3560,8 @@ CheckPassiveGrabsOnWindow(
}
- if (match & CORE_MATCH)
- {
- rc = EventToCore((InternalEvent*)event, &core);
- if (rc != Success)
- {
- if (rc != BadMatch)
- ErrorF("[dix] %s: core conversion failed in CPGFW "
- "(%d, %d).\n", device->name, event->type, rc);
- continue;
- }
- xE = &core;
- count = 1;
- mask = grab->eventMask;
- } else if (match & XI2_MATCH)
- {
- rc = EventToXI2((InternalEvent*)event, &xE);
- if (rc != Success)
- {
- if (rc != BadMatch)
- ErrorF("[dix] %s: XI2 conversion failed in CPGFW "
- "(%d, %d).\n", device->name, event->type, rc);
- continue;
- }
- count = 1;
-
- /* FIXME: EventToXI2 returns NULL for enter events, so
- * dereferencing the event is bad. Internal event types are
- * aligned with core events, so the else clause is valid.
- * long-term we should use internal events for enter/focus
- * as well */
- if (xE)
- mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8];
- else if (event->type == XI_Enter || event->type == XI_FocusIn)
- mask = grab->xi2mask[device->id][event->type/8];
- } else
- {
- rc = EventToXI((InternalEvent*)event, &xE, &count);
- if (rc != Success)
- {
- if (rc != BadMatch)
- ErrorF("[dix] %s: XI conversion failed in CPGFW "
- "(%d, %d).\n", device->name, event->type, rc);
- continue;
- }
- mask = grab->eventMask;
- }
-
(*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
-
- if (xE)
- {
- FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
-
- TryClientEvents(rClient(grab), device, xE, count, mask,
- GetEventFilter(device, xE), grab);
- }
+ DeliverGrabbedEvent((InternalEvent*)event, device, FALSE);
if (grabinfo->sync.state == FROZEN_NO_EVENT)
{
@@ -3630,8 +3571,6 @@ CheckPassiveGrabsOnWindow(
grabinfo->sync.state = FROZEN_WITH_EVENT;
}
- if (match & (XI_MATCH | XI2_MATCH))
- xfree(xE); /* on core match xE == &core */
return TRUE;
}
}
commit 8f743f17ed0076d10d6c60fe8bdf3f54d3432ae5
Author: Alan Coopersmith <alan.coopersmith@sun.com>
Date: Mon Feb 15 17:42:11 2010 -0800
Solaris xf86OSRingBell() off-by-one error in filling iov[] array
When generating sound buffers for /dev/audio bells, insert waveform
for beep *or* silence, but not both, so we don't write one entry past
the end of the iov buffer when the final bit of soundwave ends up in
the final entry allocated in the iov array.
Fixes OpenSolaris bug 6894890:
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6894890
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
diff --git a/hw/xfree86/os-support/solaris/sun_bell.c b/hw/xfree86/os-support/solaris/sun_bell.c
index 7f146ea..05d1749 100644
--- a/hw/xfree86/os-support/solaris/sun_bell.c
+++ b/hw/xfree86/os-support/solaris/sun_bell.c
@@ -126,14 +126,15 @@ xf86OSRingBell(int loudness, int pitch, int duration)
iovcnt = 0;
for (cnt = 0; cnt <= repeats; cnt++) {
- iov[iovcnt].iov_base = (char *) samples;
- iov[iovcnt++].iov_len = sizeof(samples);
if (cnt == repeats) {
/* Insert a bit of silence so that multiple beeps are distinct and
* not compressed into a single tone.
*/
iov[iovcnt].iov_base = (char *) silence;
iov[iovcnt++].iov_len = sizeof(silence);
+ } else {
+ iov[iovcnt].iov_base = (char *) samples;
+ iov[iovcnt++].iov_len = sizeof(samples);
}
if ((iovcnt >= IOV_MAX) || (cnt == repeats)) {
written = writev(audioFD, iov, iovcnt);
commit d35e08b6db911c404d7baf680dab30e8a6831bc4
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Feb 18 16:00:15 2010 +1000
dix: remove now-erroneous comment about frozen slave devices.
A direct grab on a slave device through XI2 detaches it, regardless of
whether the grab is sync or async. So this comment doesn't apply to XI2
anyway.
For XI1, aside from your life being miserable already, it doesn't matter as
XI1 does not have a concept of attachment. You can freeze a device and if
you don't freeze _all_ other devices at the same time, the master device can
still happily send events to the client.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit c0d941913199ed251fceab62fcf65437f6f9bd31)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/dix/events.c b/dix/events.c
index 4423c16..02079be 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1414,11 +1414,6 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
thisDev->deviceGrab.sync.other = NullGrab;
}
- /*
- XXX: Direct slave grab won't freeze the paired master device.
- The correct thing to do would be to freeze all SDs attached to the
- paired master device.
- */
if (IsMaster(thisDev))
{
dev = GetPairedDevice(thisDev);
commit 11c27f261efc5b7a8594ad2de7bed4339f2a62ce
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Mon Feb 15 16:32:16 2010 +1000
dix: try to ring the bell even if the current device doesn't have one. (#24503)
Evdev devices do not have the bell proc set, but XTEST devices do. By
exiting early, the bell only rings if the last keyboard used was the XTEST
keyboard and hence the bell proc is still set on the master but not if an
evdev keyboard was used last.
The better approach here is to try to ring the bell on all devices attached
to this master device in case one or more actually do produce an audible
sound. That's also XKB's behaviour if XkbUseCoreKbd is specified as device
identifier.
X.Org Bug 24503 <http://bugs.freedesktop.org/show_bug.cgi?id=24503>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit 758f6971750ed507e64eee817d720a77181439f2)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/dix/devices.c b/dix/devices.c
index ef199b7..87b6dc7 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2019,14 +2019,6 @@ ProcBell(ClientPtr client)
return BadValue;
}
- /* Seems like no keyboard actually has the BellProc set. Returning
- * BadDevice (previous code) will make apps crash badly. The man pages
- * doesn't say anything about a BadDevice being returned either.
- * So just quietly do nothing and pretend everything has worked.
- */
- if (!keybd->kbdfeed->BellProc)
- return Success;
-
newpercent = (base * stuff->percent) / 100;
if (stuff->percent < 0)
newpercent = base + newpercent;
commit 1f96c0371845d5904b7d4c8fe71ee545b649faca
Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
Date: Wed Feb 3 15:40:47 2010 -0500
xselinux: Bump extension minor version.
Changes introduced in this version:
- 3 window-related requests now handle pixmaps also.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Reviewed-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit db4f676f25c6d8e58263d5151942be730592d444)
diff --git a/Xext/xselinux.h b/Xext/xselinux.h
index 6fa66d3..69c2437 100644
--- a/Xext/xselinux.h
+++ b/Xext/xselinux.h
@@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* Extension info */
#define SELINUX_EXTENSION_NAME "SELinux"
#define SELINUX_MAJOR_VERSION 1
-#define SELINUX_MINOR_VERSION 0
+#define SELINUX_MINOR_VERSION 1
#define SELinuxNumberEvents 0
#define SELinuxNumberErrors 0
commit dd9573d4086ca24c59a99a0a2019bf20c61b0f64
Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
Date: Wed Feb 3 15:38:57 2010 -0500
xselinux: Rename window-related requests that now support pixmaps.
Renamed requests:
SetWindowCreateContext -> SetDrawableCreateContext
GetWindowCreateContext -> GetDrawableCreateContext
GetWindowContext -> GetDrawableContext
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Reviewed-by: Keith Packard <keithp@keithp.com>
diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index a1c1b83..b6bf67c 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1355,7 +1355,7 @@ ProcSELinuxGetDeviceContext(ClientPtr client)
}
static int
-ProcSELinuxGetWindowContext(ClientPtr client)
+ProcSELinuxGetDrawableContext(ClientPtr client)
{
DrawablePtr pDraw;
PrivateRec **privatePtr;
@@ -1620,12 +1620,12 @@ ProcSELinuxDispatch(ClientPtr client)
return ProcSELinuxSetDeviceContext(client);
case X_SELinuxGetDeviceContext:
return ProcSELinuxGetDeviceContext(client);
- case X_SELinuxSetWindowCreateContext:
+ case X_SELinuxSetDrawableCreateContext:
return ProcSELinuxSetCreateContext(client, CTX_WIN);
- case X_SELinuxGetWindowCreateContext:
+ case X_SELinuxGetDrawableCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_WIN);
- case X_SELinuxGetWindowContext:
- return ProcSELinuxGetWindowContext(client);
+ case X_SELinuxGetDrawableContext:
+ return ProcSELinuxGetDrawableContext(client);
case X_SELinuxSetPropertyCreateContext:
return ProcSELinuxSetCreateContext(client, CTX_PRP);
case X_SELinuxGetPropertyCreateContext:
@@ -1708,14 +1708,14 @@ SProcSELinuxGetDeviceContext(ClientPtr client)
}
static int
-SProcSELinuxGetWindowContext(ClientPtr client)
+SProcSELinuxGetDrawableContext(ClientPtr client)
{
REQUEST(SELinuxGetContextReq);
int n;
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
swapl(&stuff->id, n);
- return ProcSELinuxGetWindowContext(client);
+ return ProcSELinuxGetDrawableContext(client);
}
static int
@@ -1782,12 +1782,12 @@ SProcSELinuxDispatch(ClientPtr client)
return SProcSELinuxSetDeviceContext(client);
case X_SELinuxGetDeviceContext:
return SProcSELinuxGetDeviceContext(client);
- case X_SELinuxSetWindowCreateContext:
+ case X_SELinuxSetDrawableCreateContext:
return SProcSELinuxSetCreateContext(client, CTX_WIN);
- case X_SELinuxGetWindowCreateContext:
+ case X_SELinuxGetDrawableCreateContext:
return ProcSELinuxGetCreateContext(client, CTX_WIN);
- case X_SELinuxGetWindowContext:
- return SProcSELinuxGetWindowContext(client);
+ case X_SELinuxGetDrawableContext:
+ return SProcSELinuxGetDrawableContext(client);
case X_SELinuxSetPropertyCreateContext:
return SProcSELinuxSetCreateContext(client, CTX_PRP);
case X_SELinuxGetPropertyCreateContext:
diff --git a/Xext/xselinux.h b/Xext/xselinux.h
index fef207a..6fa66d3 100644
--- a/Xext/xselinux.h
+++ b/Xext/xselinux.h
@@ -35,9 +35,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define X_SELinuxGetDeviceCreateContext 2
#define X_SELinuxSetDeviceContext 3
#define X_SELinuxGetDeviceContext 4
-#define X_SELinuxSetWindowCreateContext 5
-#define X_SELinuxGetWindowCreateContext 6
-#define X_SELinuxGetWindowContext 7
+#define X_SELinuxSetDrawableCreateContext 5
+#define X_SELinuxGetDrawableCreateContext 6
+#define X_SELinuxGetDrawableContext 7
#define X_SELinuxSetPropertyCreateContext 8
#define X_SELinuxGetPropertyCreateContext 9
#define X_SELinuxSetPropertyUseContext 10
commit 7cec236a03917841131941ce97bd1dfd4a027327
Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
Date: Wed Feb 3 15:08:40 2010 -0500
xselinux: Allow GetWindowContext to be used for pixmaps as well.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Reviewed-by: Keith Packard <keithp@keithp.com>
diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index 4382c21..a1c1b83 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1357,18 +1357,26 @@ ProcSELinuxGetDeviceContext(ClientPtr client)
static int
ProcSELinuxGetWindowContext(ClientPtr client)
{
- WindowPtr pWin;
+ DrawablePtr pDraw;
+ PrivateRec **privatePtr;
SELinuxObjectRec *obj;
int rc;
REQUEST(SELinuxGetContextReq);
REQUEST_SIZE_MATCH(SELinuxGetContextReq);
- rc = dixLookupWindow(&pWin, stuff->id, client, DixGetAttrAccess);
+ rc = dixLookupDrawable(&pDraw, stuff->id, client,
+ M_WINDOW | M_DRAWABLE_PIXMAP,
+ DixGetAttrAccess);
if (rc != Success)
return rc;
- obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
+ if (pDraw->type == M_DRAWABLE_PIXMAP)
+ privatePtr = &((PixmapPtr)pDraw)->devPrivates;
+ else
+ privatePtr = &((WindowPtr)pDraw)->devPrivates;
+
+ obj = dixLookupPrivate(privatePtr, objectKey);
return SELinuxSendContextReply(client, obj->sid);
}
commit 1b6f498b84de7f79de735b004b8e16b9a31d228c
Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
Date: Wed Jan 6 12:52:51 2010 -0500
xselinux: Remove reference counting calls for SID objects.
Starting with libselinux 2.0.86, SID objects are no longer
reference counted and the sidput() and sidget() calls are no-ops.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Reviewed-by: Keith Packard <keithp@keithp.com>
diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index 60a18d1..4382c21 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -112,9 +112,6 @@ typedef struct {
/* labeling handle */
static struct selabel_handle *label_hnd;
-/* whether AVC is active */
-static int avc_active;
-
/* atoms for window label properties */
static Atom atom_ctx;
static Atom atom_client_ctx;
@@ -238,20 +235,17 @@ SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec *subj,
/* Check for an override context next */
if (subj->sel_use_sid) {
- sidget(tsid = subj->sel_use_sid);
+ tsid = subj->sel_use_sid;
goto out;
}
- sidget(tsid = obj->sid);
+ tsid = obj->sid;
/* Polyinstantiate if necessary to obtain the final SID */
- if (obj->poly) {
- sidput(tsid);
- if (avc_compute_member(subj->sid, obj->sid,
- SECCLASS_X_SELECTION, &tsid) < 0) {
- ErrorF("SELinux: a compute_member call failed!\n");
- return BadValue;
- }
+ if (obj->poly && avc_compute_member(subj->sid, obj->sid,
+ SECCLASS_X_SELECTION, &tsid) < 0) {
+ ErrorF("SELinux: a compute_member call failed!\n");
+ return BadValue;
}
out:
*sid_rtn = tsid;
@@ -278,7 +272,7 @@ SELinuxPropertyToSID(Atom property, SELinuxSubjectRec *subj,
/* Check for an override context next */
if (subj->prp_use_sid) {
- sidget(tsid = subj->prp_use_sid);
+ tsid = subj->prp_use_sid;
goto out;
}
@@ -295,10 +289,8 @@ SELinuxPropertyToSID(Atom property, SELinuxSubjectRec *subj,
if (avc_compute_member(subj->sid, tsid2,
SECCLASS_X_PROPERTY, &tsid) < 0) {
ErrorF("SELinux: a compute_member call failed!\n");
- sidput(tsid2);
return BadValue;
}
- sidput(tsid2);
}
out:
*sid_rtn = tsid;
@@ -438,9 +430,7 @@ SELinuxLabelClient(ClientPtr client)
security_context_t ctx;
subj = dixLookupPrivate(&client->devPrivates, subjectKey);
- sidput(subj->sid);
obj = dixLookupPrivate(&client->devPrivates, objectKey);
- sidput(obj->sid);
/* Try to get a context from the socket */
if (fd < 0 || getpeercon_raw(fd, &ctx) < 0) {
@@ -484,7 +474,7 @@ finish:
FatalError("SELinux: client %d: context_to_sid_raw(%s) failed\n",
client->index, ctx);
- sidget(obj->sid = subj->sid);
+ obj->sid = subj->sid;
freecon(ctx);
}
@@ -505,7 +495,6 @@ SELinuxLabelInitial(void)
subj = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
obj = dixLookupPrivate(&serverClient->devPrivates, objectKey);
subj->privileged = 1;
- sidput(subj->sid);
/* Use the context of the X server process for the serverClient */
if (getcon_raw(&ctx) < 0)
@@ -515,7 +504,7 @@ SELinuxLabelInitial(void)
if (avc_context_to_sid_raw(ctx, &subj->sid) < 0)
FatalError("SELinux: serverClient: context_to_sid(%s) failed\n", ctx);
- sidget(obj->sid = subj->sid);
+ obj->sid = subj->sid;
freecon(ctx);
srec.client = serverClient;
@@ -545,7 +534,7 @@ SELinuxLabelResource(XaceResourceAccessRec *rec, SELinuxSubjectRec *subj,
/* Check for a create context */
if (rec->rtype & RC_DRAWABLE && subj->win_create_sid) {
- sidget(obj->sid = subj->win_create_sid);
+ obj->sid = subj->win_create_sid;
return Success;
}
@@ -673,17 +662,14 @@ SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
SELinuxSubjectRec *dsubj;
dsubj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
- sidput(dsubj->sid);
- sidput(obj->sid);
-
if (subj->dev_create_sid) {
/* Label the device with the create context */
- sidget(obj->sid = subj->dev_create_sid);
- sidget(dsubj->sid = subj->dev_create_sid);
+ obj->sid = subj->dev_create_sid;
+ dsubj->sid = subj->dev_create_sid;
} else {
/* Label the device directly with the process SID */
- sidget(obj->sid = subj->sid);
- sidget(dsubj->sid = subj->sid);
+ obj->sid = subj->sid;
+ dsubj->sid = subj->sid;
}
}
@@ -807,8 +793,6 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
return;
}
- sidput(obj->sid);
-
/* Perform a transition to obtain the final SID */
if (avc_compute_create(serv->sid, sid, SECCLASS_X_EXTENSION,
&obj->sid) < 0) {
@@ -846,7 +830,6 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
/* If this is a new object that needs labeling, do it now */
if (access_mode & DixCreateAccess) {
- sidput(obj->sid);
rc = SELinuxSelectionToSID(name, subj, &obj->sid, &obj->poly);
if (rc != Success)
obj->sid = unlabeled_sid;
@@ -864,7 +847,6 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
break;
obj = dixLookupPrivate(&pSel->devPrivates, objectKey);
}
- sidput(tsid);
if (pSel)
*rec->ppSel = pSel;
@@ -883,11 +865,10 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
/* Label the content (advisory only) */
if (access_mode & DixSetAttrAccess) {
data = dixLookupPrivate(&pSel->devPrivates, dataKey);
- sidput(data->sid);
if (subj->sel_create_sid)
- sidget(data->sid = subj->sel_create_sid);
+ data->sid = subj->sel_create_sid;
else
- sidget(data->sid = obj->sid);
+ data->sid = obj->sid;
}
}
@@ -912,7 +893,6 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
/* If this is a new object that needs labeling, do it now */
if (rec->access_mode & DixCreateAccess) {
- sidput(obj->sid);
rc = SELinuxPropertyToSID(name, subj, &obj->sid, &obj->poly);
if (rc != Success) {
rec->status = rc;
@@ -931,7 +911,6 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
break;
obj = dixLookupPrivate(&pProp->devPrivates, objectKey);
}
- sidput(tsid);
if (pProp)
*rec->ppProp = pProp;
@@ -950,11 +929,10 @@ SELinuxProperty(CallbackListPtr *pcbl, pointer unused, pointer calldata)
/* Label the content (advisory only) */
if (rec->access_mode & DixWriteAccess) {
data = dixLookupPrivate(&pProp->devPrivates, dataKey);
- sidput(data->sid);
if (subj->prp_create_sid)
- sidget(data->sid = subj->prp_create_sid);
+ data->sid = subj->prp_create_sid;
else
- sidget(data->sid = obj->sid);
+ data->sid = obj->sid;
}
}
@@ -1031,8 +1009,6 @@ SELinuxScreen(CallbackListPtr *pcbl, pointer is_saver, pointer calldata)
/* If this is a new object that needs labeling, do it now */
if (access_mode & DixCreateAccess) {
- sidput(obj->sid);
-
/* Perform a transition to obtain the final SID */
if (avc_compute_create(subj->sid, subj->sid, SECCLASS_X_SCREEN,
&obj->sid) < 0) {
@@ -1164,7 +1140,6 @@ SELinuxSubjectInit(CallbackListPtr *pcbl, pointer unused, pointer calldata)
PrivateCallbackRec *rec = calldata;
SELinuxSubjectRec *subj = *rec->value;
- sidget(unlabeled_sid);
subj->sid = unlabeled_sid;
avc_entry_ref_init(&subj->aeref);
@@ -1177,14 +1152,6 @@ SELinuxSubjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata)
SELinuxSubjectRec *subj = *rec->value;
xfree(subj->command);
-
- if (avc_active) {
- sidput(subj->sid);
- sidput(subj->dev_create_sid);
- sidput(subj->win_create_sid);
- sidput(subj->sel_create_sid);
- sidput(subj->prp_create_sid);
- }
}
static void
@@ -1193,20 +1160,9 @@ SELinuxObjectInit(CallbackListPtr *pcbl, pointer unused, pointer calldata)
PrivateCallbackRec *rec = calldata;
SELinuxObjectRec *obj = *rec->value;
- sidget(unlabeled_sid);
obj->sid = unlabeled_sid;
}
-static void
-SELinuxObjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata)
-{
- PrivateCallbackRec *rec = calldata;
- SELinuxObjectRec *obj = *rec->value;
-
- if (avc_active)
- sidput(obj->sid);
-}
-
/*
* Extension Dispatch
@@ -1310,7 +1266,6 @@ ProcSELinuxSetCreateContext(ClientPtr client, unsigned offset)
ptr = dixLookupPrivate(privPtr, subjectKey);
pSid = (security_id_t *)(ptr + offset);
- sidput(*pSid);
*pSid = NULL;
rc = Success;
@@ -1371,11 +1326,9 @@ ProcSELinuxSetDeviceContext(ClientPtr client)
}
subj = dixLookupPrivate(&dev->devPrivates, subjectKey);
- sidput(subj->sid);
subj->sid = sid;
obj = dixLookupPrivate(&dev->devPrivates, objectKey);
- sidput(obj->sid);
- sidget(obj->sid = sid);
+ obj->sid = sid;
rc = Success;
Reply to: