xserver: Branch 'xorg-server-1.5-apple' - 23 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Mon Mar 31 16:44:43 PDT 2008


 GL/glx/glxcmds.c                       |    6 +
 Makefile.am                            |    6 +
 Xext/dpms.c                            |    7 +
 Xext/xevie.c                           |  122 ++++++++++++++++++---------------
 Xext/xselinux.c                        |   96 +++++++++++++++++++++++--
 Xext/xselinux.h                        |    1 
 configure.ac                           |    7 +
 dix/getevents.c                        |    2 
 hw/kdrive/ephyr/Makefile.am            |    1 
 hw/kdrive/ephyr/XF86dri.c              |   37 +++++++---
 hw/kdrive/ephyr/ephyr.c                |   34 +++++++--
 hw/kdrive/ephyr/ephyr.h                |    1 
 hw/kdrive/ephyr/ephyrinit.c            |   19 +++++
 hw/kdrive/ephyr/hostx.c                |   31 ++++++++
 hw/kdrive/ephyr/hostx.h                |    4 +
 hw/xfree86/dixmods/Makefile.am         |    6 +
 hw/xfree86/dixmods/extmod/modinit.c    |   23 +++++-
 hw/xfree86/exa/examodule.c             |   13 +--
 hw/xfree86/loader/dixsym.c             |    3 
 hw/xfree86/loader/xf86sym.c            |    2 
 hw/xfree86/modes/xf86Cursors.c         |    3 
 hw/xfree86/modes/xf86RandR12.c         |    3 
 hw/xfree86/os-support/bsd/i386_video.c |    2 
 hw/xfree86/xaa/xaaInitAccel.c          |   57 +++++++++------
 include/globals.h                      |   10 ++
 include/xorg-config.h.in               |    3 
 mi/miinitext.c                         |    8 +-
 os/utils.c                             |    4 +
 xkb/xkbUtils.c                         |    8 +-
 29 files changed, 401 insertions(+), 118 deletions(-)

New commits:
commit d84cda5fb152ad0c54063b68b27255f0f4c9d352
Merge: ba5202d... bde2890...
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Mon Mar 31 16:44:29 2008 -0700

    Merge branch 'server-1.5-branch' into xorg-server-1.5-apple

commit bde2890148683118eaec4140c206c5f90fb44fa0
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Mon Mar 31 17:34:07 2008 -0400

    XSELinux: Add a request to get a client's context from a resource ID.
    (cherry picked from commit 9f56fc580646a519875b5a1452738d8c6e1fa860)

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index 2e059a4..1e3b4d6 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1473,6 +1473,24 @@ ProcSELinuxGetSelectionContext(ClientPtr client, pointer privKey)
 }
 
 static int
+ProcSELinuxGetClientContext(ClientPtr client)
+{
+    ClientPtr target;
+    SELinuxSubjectRec *subj;
+    int rc;
+
+    REQUEST(SELinuxGetContextReq);
+    REQUEST_SIZE_MATCH(SELinuxGetContextReq);
+
+    rc = dixLookupClient(&target, stuff->id, client, DixGetAttrAccess);
+    if (rc != Success)
+	return rc;
+
+    subj = dixLookupPrivate(&target->devPrivates, subjectKey);
+    return SELinuxSendContextReply(client, subj->sid);
+}
+
+static int
 SELinuxPopulateItem(SELinuxListItemRec *i, PrivateRec **privPtr, CARD32 id,
 		    int *size)
 {
@@ -1686,6 +1704,8 @@ ProcSELinuxDispatch(ClientPtr client)
 	return ProcSELinuxGetSelectionContext(client, dataKey);
     case X_SELinuxListSelections:
 	return ProcSELinuxListSelections(client);
+    case X_SELinuxGetClientContext:
+	return ProcSELinuxGetClientContext(client);
     default:
 	return BadRequest;
     }
@@ -1783,6 +1803,17 @@ SProcSELinuxListProperties(ClientPtr client)
 }
 
 static int
+SProcSELinuxGetClientContext(ClientPtr client)
+{
+    REQUEST(SELinuxGetContextReq);
+    int n;
+
+    REQUEST_SIZE_MATCH(SELinuxGetContextReq);
+    swapl(&stuff->id, n);
+    return ProcSELinuxGetClientContext(client);
+}
+
+static int
 SProcSELinuxDispatch(ClientPtr client)
 {
     REQUEST(xReq);
@@ -1835,6 +1866,8 @@ SProcSELinuxDispatch(ClientPtr client)
 	return SProcSELinuxGetSelectionContext(client, dataKey);
     case X_SELinuxListSelections:
 	return ProcSELinuxListSelections(client);
+    case X_SELinuxGetClientContext:
+	return SProcSELinuxGetClientContext(client);
     default:
 	return BadRequest;
     }
diff --git a/Xext/xselinux.h b/Xext/xselinux.h
index 2d0de32..7c3ffdc 100644
--- a/Xext/xselinux.h
+++ b/Xext/xselinux.h
@@ -52,6 +52,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #define X_SELinuxGetSelectionContext		19
 #define X_SELinuxGetSelectionDataContext	20
 #define X_SELinuxListSelections			21
+#define X_SELinuxGetClientContext		22
 
 typedef struct {
     CARD8   reqType;
commit c26bccf4173a037aa403c511dd08fd63cbbed87a
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Fri Mar 28 14:01:34 2008 -0400

    XSELinux: Add xorg.conf option for permissive/enforcing/disabled.
    Patch by Joe Nall.
    
    The option goes in the "extmod" subsection.
    TODO: Make it easier for extension modules to handle their own options.
    (cherry picked from commit b5f98fcea2024c67e598947782913982072cf4fb)

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index 17ce7af..2e059a4 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -37,6 +37,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include <libaudit.h>
 
 #include <X11/Xatom.h>
+#include "globals.h"
 #include "resource.h"
 #include "privates.h"
 #include "registry.h"
@@ -1891,16 +1892,36 @@ void
 SELinuxExtensionInit(INITARGS)
 {
     ExtensionEntry *extEntry;
-    struct selinux_opt options[] = { { SELABEL_OPT_VALIDATE, (char *)1 } };
+    struct selinux_opt selabel_option = { SELABEL_OPT_VALIDATE, (char *)1 };
+    struct selinux_opt avc_option = { AVC_OPT_SETENFORCE, (char *)0 };
     security_context_t con;
     int ret = TRUE;
 
-    /* Setup SELinux stuff */
+    /* Check SELinux mode on system */
     if (!is_selinux_enabled()) {
-	ErrorF("SELinux: SELinux not enabled, disabling SELinux support.\n");
+	ErrorF("SELinux: Disabled on system, not enabling in X server\n");
 	return;
     }
 
+    /* Check SELinux mode in configuration file */
+    switch(selinuxEnforcingState) {
+    case SELINUX_MODE_DISABLED:
+	LogMessage(X_INFO, "SELinux: Disabled in configuration file\n");
+	return;
+    case SELINUX_MODE_ENFORCING:
+	LogMessage(X_INFO, "SELinux: Configured in enforcing mode\n");
+	avc_option.value = (char *)1;
+	break;
+    case SELINUX_MODE_PERMISSIVE:
+	LogMessage(X_INFO, "SELinux: Configured in permissive mode\n");
+	avc_option.value = (char *)0;
+	break;
+    default:
+	avc_option.type = AVC_OPT_UNUSED;
+	break;
+    }
+
+    /* Set up SELinux stuff */
     selinux_set_callback(SELINUX_CB_LOG, (union selinux_callback)SELinuxLog);
     selinux_set_callback(SELINUX_CB_AUDIT, (union selinux_callback)SELinuxAudit);
 
@@ -1912,11 +1933,11 @@ SELinuxExtensionInit(INITARGS)
 	FatalError("SELinux: Failed to set up security class mapping\n");
     }
 
-    if (avc_open(NULL, 0) < 0)
+    if (avc_open(&avc_option, 1) < 0)
 	FatalError("SELinux: Couldn't initialize SELinux userspace AVC\n");
     avc_active = 1;
 
-    label_hnd = selabel_open(SELABEL_CTX_X, options, 1);
+    label_hnd = selabel_open(SELABEL_CTX_X, &selabel_option, 1);
     if (!label_hnd)
 	FatalError("SELinux: Failed to open x_contexts mapping in policy\n");
 
diff --git a/hw/xfree86/dixmods/extmod/modinit.c b/hw/xfree86/dixmods/extmod/modinit.c
index d0d892a..8c8a4ce 100644
--- a/hw/xfree86/dixmods/extmod/modinit.c
+++ b/hw/xfree86/dixmods/extmod/modinit.c
@@ -42,7 +42,7 @@ static ExtensionModule extensionModules[] = {
     {
 	SELinuxExtensionInit,
 	SELINUX_EXTENSION_NAME,
-	NULL,
+	&noSELinuxExtension,
 	NULL,
 	NULL
     },
@@ -258,6 +258,27 @@ extmodSetup(pointer module, pointer opts, int *errmaj, int *errmin)
 		}
 	    }
 	}
+
+#ifdef XSELINUX
+	if (! strcmp(SELINUX_EXTENSION_NAME, extensionModules[i].name)) {
+	    pointer o;
+	    selinuxEnforcingState = SELINUX_MODE_DEFAULT;
+
+	    if ((o = xf86FindOption(opts, "SELinux mode disabled"))) {
+		xf86MarkOptionUsed(o);
+		selinuxEnforcingState = SELINUX_MODE_DISABLED;
+	    }
+	    if ((o = xf86FindOption(opts, "SELinux mode permissive"))) {
+		xf86MarkOptionUsed(o);
+		selinuxEnforcingState = SELINUX_MODE_PERMISSIVE;
+	    }
+	    if ((o = xf86FindOption(opts, "SELinux mode enforcing"))) {
+		xf86MarkOptionUsed(o);
+		selinuxEnforcingState = SELINUX_MODE_ENFORCING;
+	    }
+	}
+#endif
+
 	LoadExtension(&extensionModules[i], FALSE);
     }
     /* Need a non-NULL return */
diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c
index d035c76..d6d22c4 100644
--- a/hw/xfree86/loader/dixsym.c
+++ b/hw/xfree86/loader/dixsym.c
@@ -440,6 +440,9 @@ _X_HIDDEN void *dixLookupTab[] = {
 #ifdef XIDLE
     SYMVAR(noXIdleExtension)
 #endif
+#ifdef XSELINUX
+    SYMVAR(noSELinuxExtension)
+#endif
 #ifdef XV
     SYMVAR(noXvExtension)
 #endif
diff --git a/include/globals.h b/include/globals.h
index b230dfc..2ca9531 100644
--- a/include/globals.h
+++ b/include/globals.h
@@ -175,6 +175,16 @@ extern Bool noXInputExtension;
 extern Bool noXIdleExtension;
 #endif
 
+#ifdef XSELINUX
+extern Bool noSELinuxExtension;
+
+#define SELINUX_MODE_DEFAULT    0
+#define SELINUX_MODE_DISABLED   1
+#define SELINUX_MODE_PERMISSIVE 2
+#define SELINUX_MODE_ENFORCING  3
+extern int selinuxEnforcingState;
+#endif
+
 #ifdef XV
 extern Bool noXvExtension;
 #endif
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 3c55eeb..cc4c15c 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -215,6 +215,9 @@ extern Bool noXInputExtension;
 #ifdef XIDLE
 extern Bool noXIdleExtension;
 #endif
+#ifdef XSELINUX
+extern Bool noSELinuxExtension;
+#endif
 #ifdef XV
 extern Bool noXvExtension;
 #endif
@@ -488,6 +491,9 @@ static ExtensionToggle ExtensionToggleList[] =
 #ifdef XKB
     { "XKEYBOARD", &noXkbExtension },
 #endif
+#ifdef XSELINUX
+    { "SELinux", &noSELinuxExtension },
+#endif
     { "XTEST", &noTestExtensions },
 #ifdef XV
     { "XVideo", &noXvExtension },
@@ -597,7 +603,7 @@ InitExtensions(argc, argv)
     if (!noSecurityExtension) SecurityExtensionInit();
 #endif
 #ifdef XSELINUX
-    SELinuxExtensionInit();
+    if (!noSELinuxExtension) SELinuxExtensionInit();
 #endif
 #ifdef XPRINT
     XpExtensionInit(); /* server-specific extension, cannot be disabled */
diff --git a/os/utils.c b/os/utils.c
index 4041028..57293ab 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -232,6 +232,10 @@ _X_EXPORT Bool noXInputExtension = FALSE;
 #ifdef XIDLE
 _X_EXPORT Bool noXIdleExtension = FALSE;
 #endif
+#ifdef XSELINUX
+_X_EXPORT Bool noSELinuxExtension = FALSE;
+_X_EXPORT int selinuxEnforcingState = SELINUX_MODE_DEFAULT;
+#endif
 #ifdef XV
 _X_EXPORT Bool noXvExtension = FALSE;
 #endif
commit ae8edf3ee78ec1786c71b60ac0a5c9a2efb4e857
Author: Adam Jackson <ajax at redhat.com>
Date:   Tue Mar 25 12:48:22 2008 -0400

    Fix that last commit.
    
    I can apply patches, really.
    (cherry picked from commit 333e7123dc484888d79c0f5aa3977bd72f1eb341)

diff --git a/dix/getevents.c b/dix/getevents.c
index 6a2f7ba..bf9331e 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -349,7 +349,7 @@ getValuatorEvents(xEvent *events, DeviceIntPtr pDev, int first_valuator,
     for (i = first_valuator; i < final_valuator; i += 6, xv++, events++) {
         xv->type = DeviceValuator;
         xv->first_valuator = i;
-        xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (final_valuator - i);
+        xv->num_valuators = ((final_valuator - i) > 6) ? 6 : (final_valuator - i);
         xv->deviceid = pDev->id;
         switch (final_valuator - i) {
         case 6:
commit ff99a3aa2b6f3918c7692f360a3df30cf5a541ec
Author: Sascha Hlusiak <saschahlusiak at arcor.de>
Date:   Tue Mar 25 12:32:33 2008 -0400

    Fix getValuatorEvents to compute number of valuators correctly.
    (cherry picked from commit e7a364425547103a98acabfc67d16e1ae0c2967f)

diff --git a/dix/getevents.c b/dix/getevents.c
index 3e6fe5a..6a2f7ba 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -349,7 +349,7 @@ getValuatorEvents(xEvent *events, DeviceIntPtr pDev, int first_valuator,
     for (i = first_valuator; i < final_valuator; i += 6, xv++, events++) {
         xv->type = DeviceValuator;
         xv->first_valuator = i;
-        xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (num_valuators - i);
+        xv->num_valuators = ((num_valuators - i) > 6) ? 6 : (final_valuator - i);
         xv->deviceid = pDev->id;
         switch (final_valuator - i) {
         case 6:
commit 2d312eaf4f5f9cb1d8f08691125a0d91243932fa
Author: David Nusinow <dnusinow at debian.org>
Date:   Thu Feb 28 19:45:21 2008 -0500

    Bug #10016: Implement WM_CLASS hints in Xephyr.
    (cherry picked from commit f028e245a7932362656701c08fcfbfa8e8949077)

diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h
index 8ed7e23..5d58a21 100644
--- a/hw/kdrive/ephyr/ephyr.h
+++ b/hw/kdrive/ephyr/ephyr.h
@@ -28,6 +28,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <signal.h>
+#include <libgen.h>
 
 #include "os.h"  		/* for OsSignal() */
 #include "kdrive.h"
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 6196996..47ddb3d 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -109,6 +109,7 @@ ddxUseMsg (void)
   ErrorF("-nodri               do not use DRI\n");
 #endif
   ErrorF("-noxv                do not use XV\n");
+  ErrorF("-name [name]         define the name in the WM_CLASS property\n");
   ErrorF("\n");
 
   exit(1);
@@ -148,6 +149,11 @@ ddxProcessArgument (int argc, char **argv, int i)
 {
   EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] );
 
+  if (i == 1)
+    {
+      hostx_use_resname(basename(argv[0]), 0);
+    }
+
   if (!strcmp (argv[i], "-parent"))
     {
       if(i+1 < argc)
@@ -223,6 +229,19 @@ ddxProcessArgument (int argc, char **argv, int i)
        EPHYR_LOG ("no XVideo enabled\n") ;
        return 1 ;
    }
+  else if (!strcmp (argv[i], "-name"))
+   {
+       if (i+1 < argc && argv[i+1][0] != '-')
+         {
+           hostx_use_resname(argv[i+1], 1);
+           return 2;
+         }
+       else
+         {
+           UseMsg();
+           return 0;
+         }
+   }
   else if (argv[i][0] == ':')
     {
       hostx_set_display_name(argv[i]);
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index fd84ec0..1a71d06 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -107,6 +107,9 @@ extern EphyrKeySyms   ephyrKeySyms;
 
 extern int            monitorResolution;
 
+char           *ephyrResName = NULL;
+int             ephyrResNameFromCmd = 0;
+
 static void
 hostx_set_fullscreen_hint(void);
 
@@ -296,6 +299,13 @@ hostx_handle_signal (int signum)
               HostXWantDamageDebug);
 }
 
+void
+hostx_use_resname (char *name, int fromcmd)
+{
+  ephyrResName = name;
+  ephyrResNameFromCmd = fromcmd;
+}
+
 int
 hostx_init (void)
 {
@@ -304,6 +314,8 @@ hostx_init (void)
   Pixmap                cursor_pxm;
   XColor                col;
   int                   index;
+  char                  *tmpstr;
+  XClassHint            *class_hint;
 
   attr.event_mask =
     ButtonPressMask
@@ -327,6 +339,8 @@ hostx_init (void)
   HostX.depth   = DefaultDepth(HostX.dpy, HostX.screen);
   HostX.visual  = DefaultVisual(HostX.dpy, HostX.screen);
 
+  class_hint = XAllocClassHint();
+
   for (index = 0 ; index < HostX.n_screens ; index++)
     {
       struct EphyrHostScreen *host_screen = &HostX.screens[index];
@@ -389,9 +403,23 @@ hostx_init (void)
 
               hostx_set_fullscreen_hint();
             }
+
+          if (class_hint) 
+            {
+              tmpstr = getenv("RESOURCE_NAME");
+              if (tmpstr && (!ephyrResNameFromCmd))
+                ephyrResName = tmpstr;
+              class_hint->res_name = ephyrResName;
+              class_hint->res_class = "Xephyr";
+              XSetClassHint(hostx_get_display(), host_screen->win, class_hint);
+
+            }
+
         }
     }
 
+  if (class_hint)
+      XFree(class_hint);
 
   XParseColor (HostX.dpy, DefaultColormap (HostX.dpy,HostX.screen),
                "red", &col);
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index 48d3147..47ba61b 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -145,6 +145,9 @@ hostx_want_preexisting_window(EphyrScreenInfo screen);
 void
 hostx_use_preexisting_window(unsigned long win_id);
 
+void
+hostx_use_resname (char *name, int fromcmd);
+
 void 
 hostx_handle_signal(int signum);
 
commit d6ec5eaded2a645f132f84162b5ab0a9f513e38e
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Mar 24 13:37:42 2008 -0400

    Bug #11510: Fix build without RECORD.
    (cherry picked from commit 862ff9ac92037e13629329eb6ba50ff6bd2c5f71)

diff --git a/Makefile.am b/Makefile.am
index e382d58..71ba2c4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -30,6 +30,10 @@ if DBE
 DBE_DIR=dbe
 endif
 
+if RECORD
+RECORD_DIR=record
+endif
+
 SUBDIRS = \
 	doc \
 	include \
@@ -48,7 +52,7 @@ SUBDIRS = \
 	$(AFB_DIR) \
 	$(CFB_DIR) \
 	$(CFB32_DIR) \
-	record \
+	$(RECORD_DIR) \
 	xfixes \
 	damageext \
 	$(XTRAP_DIR) \
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
index efc5f4a..dad2dd3 100644
--- a/hw/xfree86/dixmods/Makefile.am
+++ b/hw/xfree86/dixmods/Makefile.am
@@ -26,6 +26,10 @@ if MFB
 MFBMOD = libmfb.la
 endif
 
+if RECORD
+RECORDMOD = librecord.la
+endif
+
 module_LTLIBRARIES = $(AFBMOD) \
                      $(CFBMOD) \
                      libfb.la \
@@ -34,7 +38,7 @@ module_LTLIBRARIES = $(AFBMOD) \
                      libshadow.la
 
 extsmoduledir = $(moduledir)/extensions
-extsmodule_LTLIBRARIES = librecord.la \
+extsmodule_LTLIBRARIES = $(RECORDMOD) \
 			 $(DBEMOD) \
                          $(GLXMODS) \
                          $(XTRAPMOD)
commit f250352d2e6676af11d734c109f8edb0231f5164
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Mar 24 13:33:38 2008 -0400

    Bug #11508: Fix build without XV.
    (cherry picked from commit 87bfd3bd96c714a1c252d42408b5a1a4ff9dab06)

diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index f86a143..24fc44c 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -68,8 +68,10 @@
 # include "xf86Xinput.h"
 #endif
 #include "xf86OSmouse.h"
+#ifdef XV
 #include "xf86xv.h"
 #include "xf86xvmc.h"
+#endif
 #include "xf86cmap.h"
 #include "xf86fbman.h"
 #include "dgaproc.h"
commit fdf927c2cdd1b92f0774f977d3195532294715d7
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Mar 24 12:22:19 2008 -0400

    Bug #13962: Re-arm the DPMS timer when re-enabling DPMS.
    (cherry picked from commit 536f2ff5382aaaace3b55481e15366bb15d87801)

diff --git a/Xext/dpms.c b/Xext/dpms.c
index 6f01fa3..e3204fe 100644
--- a/Xext/dpms.c
+++ b/Xext/dpms.c
@@ -188,12 +188,15 @@ static int
 ProcDPMSEnable(client)
     register ClientPtr client;
 {
-    /* REQUEST(xDPMSEnableReq); */
+    Bool was_enabled = DPMSEnabled;
 
     REQUEST_SIZE_MATCH(xDPMSEnableReq);
 
-    if (DPMSCapableFlag)
+    if (DPMSCapableFlag) {
 	DPMSEnabled = TRUE;
+	if (!was_enabled)
+	    SetScreenSaverTimer();
+    }
 
     return(client->noClientException);
 }
commit 80968c4a91e16533cfc42c88a3e40af4a84112c5
Author: Julien Cristau <jcristau at debian.org>
Date:   Sat Mar 22 17:31:08 2008 +0100

    xaa: use xf86ReturnOptValBool instead of xf86IsOptionSet
    
    The latter doesn't return the option's value, just whether it's present
    in the configuration.
    (cherry picked from commit 4217ba0cf0c9bbea3774760e836ab372acf3237c)

diff --git a/hw/xfree86/xaa/xaaInitAccel.c b/hw/xfree86/xaa/xaaInitAccel.c
index 1b7c154..53795f0 100644
--- a/hw/xfree86/xaa/xaaInitAccel.c
+++ b/hw/xfree86/xaa/xaaInitAccel.c
@@ -181,7 +181,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
 
     if(infoRec->SetupForScreenToScreenCopy &&
        infoRec->SubsequentScreenToScreenCopy &&
-       !xf86IsOptionSet(options, XAAOPT_SCREEN_TO_SCREEN_COPY)) {
+       !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COPY, FALSE)) {
 	HaveScreenToScreenCopy = TRUE;
     } else {
 	infoRec->ScreenToScreenCopyFlags = 0;
@@ -192,10 +192,10 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
     /**** Solid Filled Rects ****/
 
     if(infoRec->SetupForSolidFill && infoRec->SubsequentSolidFillRect &&
-       !xf86IsOptionSet(options, XAAOPT_SOLID_FILL_RECT)) {
+       !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_RECT, FALSE)) {
 		HaveSolidFillRect = TRUE;
 	if(infoRec->SubsequentSolidFillTrap &&
-	   !xf86IsOptionSet(options, XAAOPT_SOLID_FILL_TRAP))
+	   !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_TRAP, FALSE))
 		HaveSolidFillTrap = TRUE;
 	else
 		infoRec->SubsequentSolidFillTrap = NULL;
@@ -210,10 +210,11 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
 
     if(infoRec->SetupForSolidLine) {
 	if(infoRec->SubsequentSolidTwoPointLine &&
-		!xf86IsOptionSet(options, XAAOPT_SOLID_TWO_POINT_LINE))
+		!xf86ReturnOptValBool(options,
+		                      XAAOPT_SOLID_TWO_POINT_LINE, FALSE))
 	    HaveSolidTwoPointLine = TRUE;
 	if(infoRec->SubsequentSolidBresenhamLine &&
-		!xf86IsOptionSet(options, XAAOPT_SOLID_BRESENHAM_LINE)) {
+		!xf86ReturnOptValBool(options, XAAOPT_SOLID_BRESENHAM_LINE, FALSE)) {
 	    HaveSolidBresenhamLine = TRUE;
 
 	    if(infoRec->SolidBresenhamLineErrorTermBits)
@@ -222,7 +223,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
 	}
 
 	if(infoRec->SubsequentSolidHorVertLine &&
-		!xf86IsOptionSet(options, XAAOPT_SOLID_HORVERT_LINE))
+		!xf86ReturnOptValBool(options,
+		                      XAAOPT_SOLID_HORVERT_LINE, FALSE))
 	    HaveSolidHorVertLine = TRUE;
 	else if(HaveSolidTwoPointLine) {
 	    infoRec->SubsequentSolidHorVertLine = 
@@ -265,10 +267,14 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
 
    if(infoRec->SetupForMono8x8PatternFill &&
 		infoRec->SubsequentMono8x8PatternFillRect &&
-		!xf86IsOptionSet(options, XAAOPT_MONO_8x8_PATTERN_FILL_RECT)) {
+		!xf86ReturnOptValBool(options,
+		                      XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
+		                      FALSE)) {
 	HaveMono8x8PatternFillRect = TRUE;
 	if(infoRec->SubsequentMono8x8PatternFillTrap &&
-		!xf86IsOptionSet(options, XAAOPT_MONO_8x8_PATTERN_FILL_TRAP))
+		!xf86ReturnOptValBool(options,
+		                      XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
+		                      FALSE))
 		HaveMono8x8PatternFillTrap = TRUE;
 
         if(infoRec->Mono8x8PatternFillFlags & 
@@ -318,10 +324,12 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
 
     if(infoRec->SetupForDashedLine && infoRec->DashPatternMaxLength) {
 	if(infoRec->SubsequentDashedTwoPointLine &&
-		!xf86IsOptionSet(options, XAAOPT_DASHED_TWO_POINT_LINE))
+		!xf86ReturnOptValBool(options, XAAOPT_DASHED_TWO_POINT_LINE,
+		                      FALSE))
 	    HaveDashedTwoPointLine = TRUE;
 	if(infoRec->SubsequentDashedBresenhamLine &&
-		!xf86IsOptionSet(options, XAAOPT_DASHED_BRESENHAM_LINE)) {
+		!xf86ReturnOptValBool(options, XAAOPT_DASHED_BRESENHAM_LINE,
+		                      FALSE)) {
 	    HaveDashedBresenhamLine = TRUE;
 
 	    if(infoRec->DashedBresenhamLineErrorTermBits)
@@ -345,10 +353,11 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
 
    if(infoRec->SetupForColor8x8PatternFill &&
       infoRec->SubsequentColor8x8PatternFillRect &&
-      !xf86IsOptionSet(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT)) {
+      !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT, FALSE)) {
 	HaveColor8x8PatternFillRect = TRUE;
 	if(infoRec->SubsequentColor8x8PatternFillTrap &&
-	   !xf86IsOptionSet(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP))
+	   !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
+	                         FALSE))
 		HaveColor8x8PatternFillTrap = TRUE;
 	else
 		infoRec->SubsequentColor8x8PatternFillTrap = NULL;
@@ -381,7 +390,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
     if(infoRec->SetupForCPUToScreenColorExpandFill && 
 	infoRec->ColorExpandBase &&
        	infoRec->SubsequentCPUToScreenColorExpandFill &&
-        !xf86IsOptionSet(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL)) {
+        !xf86ReturnOptValBool(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
+	                      FALSE)) {
 	int dwordsNeeded = pScrn->virtualX;
 
 	infoRec->ColorExpandRange >>= 2;	/* convert to DWORDS */
@@ -406,7 +416,9 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
        infoRec->SubsequentColorExpandScanline &&
        infoRec->ScanlineColorExpandBuffers && 
        (infoRec->NumScanlineColorExpandBuffers > 0) &&
-       !xf86IsOptionSet(options, XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL)) {
+       !xf86ReturnOptValBool(options,
+                             XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
+                             FALSE)) {
 	HaveScanlineColorExpansion = TRUE;
     } else {
 	infoRec->ScanlineCPUToScreenColorExpandFillFlags = 0;
@@ -419,7 +431,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
 
     if(infoRec->SetupForScreenToScreenColorExpandFill &&
        infoRec->SubsequentScreenToScreenColorExpandFill &&
-       !xf86IsOptionSet(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL)) {
+       !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
+                             FALSE)) {
 	HaveScreenToScreenColorExpandFill = TRUE;
 	if (!infoRec->CacheColorExpandDensity)
 	    infoRec->CacheColorExpandDensity = 1;
@@ -433,7 +446,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
 
     if(infoRec->SetupForImageWrite && infoRec->ImageWriteBase &&
        infoRec->SubsequentImageWriteRect &&
-       !xf86IsOptionSet(options, XAAOPT_IMAGE_WRITE_RECT)) {
+       !xf86ReturnOptValBool(options, XAAOPT_IMAGE_WRITE_RECT, FALSE)) {
 
 	infoRec->ImageWriteRange >>= 2;	/* convert to DWORDS */
 	if(infoRec->ImageWriteFlags & CPU_TRANSFER_BASE_FIXED)
@@ -452,7 +465,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
        infoRec->SubsequentImageWriteScanline &&
        infoRec->ScanlineImageWriteBuffers && 
        (infoRec->NumScanlineImageWriteBuffers > 0) &&
-       !xf86IsOptionSet(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT)) {
+       !xf86ReturnOptValBool(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
+                             FALSE)) {
 	HaveScanlineImageWriteRect = TRUE;
     } else {
 	infoRec->ScanlineImageWriteFlags = 0;
@@ -518,7 +532,8 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
 #define XAAMSG(s) do { if (serverGeneration == 1) xf86ErrorF(s); } while (0)
 
     if((infoRec->Flags & OFFSCREEN_PIXMAPS) && HaveScreenToScreenCopy &&
-		!xf86IsOptionSet(options, XAAOPT_OFFSCREEN_PIXMAPS)) {
+		!xf86ReturnOptValBool(options, XAAOPT_OFFSCREEN_PIXMAPS,
+		                      FALSE)) {
 	XAAMSG("\tOffscreen Pixmaps\n");
     } else {
 	infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
@@ -800,7 +815,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
     /**** WriteBitmap ****/
 
     if(infoRec->WriteBitmap && 
-      !xf86IsOptionSet(options, XAAOPT_WRITE_BITMAP)) {
+      !xf86ReturnOptValBool(options, XAAOPT_WRITE_BITMAP, FALSE)) {
 	XAAMSG("\tDriver provided WriteBitmap replacement\n");
     } else if(HaveColorExpansion) {
 	if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
@@ -959,7 +974,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
     /**** WritePixmap ****/
 
     if(infoRec->WritePixmap &&
-      !xf86IsOptionSet(options, XAAOPT_WRITE_PIXMAP)) {
+      !xf86ReturnOptValBool(options, XAAOPT_WRITE_PIXMAP, FALSE)) {
 	XAAMSG("\tDriver provided WritePixmap replacement\n");
     } else if(HaveImageWriteRect) {
 	infoRec->WritePixmap = XAAWritePixmap;
@@ -1433,7 +1448,7 @@ XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
     else
 	infoRec->Flags &= ~PIXMAP_CACHE;
 
-    if (xf86IsOptionSet(options, XAAOPT_PIXMAP_CACHE))
+    if (xf86ReturnOptValBool(options, XAAOPT_PIXMAP_CACHE, FALSE))
 	infoRec->Flags &= ~PIXMAP_CACHE;
 
     if(infoRec->WriteMono8x8PatternToCache) {}
commit f40bd686e502c4b73b65dcfbc7321704dd663052
Author: Julien Cristau <jcristau at debian.org>
Date:   Sat Mar 22 17:28:48 2008 +0100

    exa: use xf86ReturnOptValBool instead of xf86IsOptionSet
    
    The latter doesn't give you the option's value, it just tells you if
    it's present in the configuration.  So using Option "EXANoComposite" "false"
    disabled composite acceleration.
    (cherry picked from commit 6b9d2bb1f7f87acbf275027af9c2982e91e5faed)

diff --git a/hw/xfree86/exa/examodule.c b/hw/xfree86/exa/examodule.c
index 086639c..e18da0a 100644
--- a/hw/xfree86/exa/examodule.c
+++ b/hw/xfree86/exa/examodule.c
@@ -148,22 +148,23 @@ exaDDXDriverInit(ScreenPtr pScreen)
 				 FALSE);
     }
 
-    if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_COMPOSITE)) {
-	xf86DrvMsg(pScreen->myNum, X_INFO,
+    if (xf86ReturnOptValBool(pScreenPriv->options,
+                             EXAOPT_NO_COMPOSITE, FALSE)) {
+	xf86DrvMsg(pScreen->myNum, X_CONFIG,
 		   "EXA: Disabling Composite operation "
 		   "(RENDER acceleration)\n");
 	pExaScr->info->CheckComposite = NULL;
 	pExaScr->info->PrepareComposite = NULL;
     }
 
-    if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_UTS)) {
-	xf86DrvMsg(pScreen->myNum, X_INFO,
+    if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_UTS, FALSE)) {
+	xf86DrvMsg(pScreen->myNum, X_CONFIG,
 		   "EXA: Disabling UploadToScreen\n");
 	pExaScr->info->UploadToScreen = NULL;
     }
 
-    if (xf86IsOptionSet(pScreenPriv->options, EXAOPT_NO_DFS)) {
-	xf86DrvMsg(pScreen->myNum, X_INFO,
+    if (xf86ReturnOptValBool(pScreenPriv->options, EXAOPT_NO_DFS, FALSE)) {
+	xf86DrvMsg(pScreen->myNum, X_CONFIG,
 		   "EXA: Disabling DownloadFromScreen\n");
 	pExaScr->info->DownloadFromScreen = NULL;
     }
commit 84a27f7a92b60c345b4f055e41e239d8ebbccc60
Author: Michel Dänzer <michel at tungstengraphics.com>
Date:   Thu Mar 20 09:18:29 2008 -0400

    Fix RandR 1.2 driver interface conversion of two colour cursors to ARGB
    
    This patch (and not setting HARDWARE_CURSOR_BIT_ORDER_MSBFIRST on big endian
    platforms) fixes it for me with the radeon driver and doesn't break intel.
    
    Correct patch this time :)
    (cherry picked from commit da973e962d09854b571320dee7dd9569060bc39e)

diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 5a4d0f6..cb93dc6 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -137,7 +137,8 @@ cursor_bitpos (int flags, int x, Bool mask)
 	mask = !mask;
     if (flags & HARDWARE_CURSOR_NIBBLE_SWAPPED)
 	x = (x & ~3) | (3 - (x & 3));
-    if (flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST)
+    if (((flags & HARDWARE_CURSOR_BIT_ORDER_MSBFIRST) == 0) ==
+	(X_BYTE_ORDER == X_BIG_ENDIAN))
 	x = (x & ~7) | (7 - (x & 7));
     if (flags & HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1)
 	x = (x << 1) + mask;
commit a65e9722c4aaba098dcf49dbcd13a13e0cadbda8
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Mar 19 16:04:16 2008 -0700

    Make Xevie private symbol names less generic
    
    Makes it easier to figure out what you're seeing in the stack trace
    instead of wondering where in the server "ProcSend" is.
    (cherry picked from commit 060a99444ee25a684b0ab9b4819bf8e855aea2d8)

diff --git a/Xext/xevie.c b/Xext/xevie.c
index f36ead4..5e20bd9 100644
--- a/Xext/xevie.c
+++ b/Xext/xevie.c
@@ -63,11 +63,13 @@ extern Bool noXkbExtension;
 #endif
 extern int    xeviegrabState;
 
-static int		ProcDispatch (register ClientPtr client), SProcDispatch (register ClientPtr client);
-static void		ResetProc (ExtensionEntry *extEntry);
+static DISPATCH_PROC(ProcXevieDispatch);
+static DISPATCH_PROC(SProcXevieDispatch);
 
-static unsigned char	ReqCode = 0;
-static int		ErrorBase;
+static void		XevieResetProc (ExtensionEntry *extEntry);
+
+static unsigned char	XevieReqCode = 0;
+static int		XevieErrorBase;
 
 int			xevieFlag = 0;
 int	 		xevieClientIndex = 0;
@@ -77,7 +79,7 @@ Mask			xevieMask = 0;
 int       		xevieEventSent = 0;
 int			xevieKBEventSent = 0;
 static DevPrivateKey    xevieDevicePrivateKey = &xevieDevicePrivateKey;
-static Bool                     xevieModifiersOn = FALSE;
+static Bool             xevieModifiersOn = FALSE;
 
 #define XEVIEINFO(dev)  ((xevieDeviceInfoPtr) \
     dixLookupPrivate(&(dev)->devPrivates, xevieDevicePrivateKey))
@@ -108,11 +110,6 @@ typedef struct {
 static xevieKeycQueueRec keycq[KEYC_QUEUE_SIZE] = {{0, NULL}};
 static int keycqHead = 0, keycqTail = 0;
 
-static int              ProcDispatch (ClientPtr), SProcDispatch (ClientPtr);
-static void             ResetProc (ExtensionEntry*);
-
-static int              ErrorBase;
-
 static Bool XevieStart(void);
 static void XevieEnd(int clientIndex);
 static void XevieClientStateCallback(CallbackListPtr *pcbl, pointer nulldata,
@@ -140,23 +137,23 @@ XevieExtensionInit (void)
     if ((extEntry = AddExtension (XEVIENAME,
 				0,
 				XevieNumberErrors,
-				ProcDispatch,
-				SProcDispatch,
-				ResetProc,
+				ProcXevieDispatch,
+				SProcXevieDispatch,
+				XevieResetProc,
 				StandardMinorOpcode))) {
-	ReqCode = (unsigned char)extEntry->base;
-	ErrorBase = extEntry->errorBase;
+	XevieReqCode = (unsigned char)extEntry->base;
+	XevieErrorBase = extEntry->errorBase;
     }
 }
 
 /*ARGSUSED*/
 static 
-void ResetProc (ExtensionEntry *extEntry)
+void XevieResetProc (ExtensionEntry *extEntry)
 {
 }
 
 static 
-int ProcQueryVersion (register ClientPtr client)
+int ProcXevieQueryVersion (register ClientPtr client)
 {
     xXevieQueryVersionReply rep;
 
@@ -171,7 +168,7 @@ int ProcQueryVersion (register ClientPtr client)
 }
 
 static
-int ProcStart (register ClientPtr client)
+int ProcXevieStart (register ClientPtr client)
 {
     xXevieStartReply rep;
 
@@ -212,7 +209,7 @@ int ProcStart (register ClientPtr client)
 }
 
 static
-int ProcEnd (register ClientPtr client)
+int ProcXevieEnd (register ClientPtr client)
 {
     xXevieEndReply rep;
 
@@ -233,7 +230,7 @@ int ProcEnd (register ClientPtr client)
 }
 
 static
-int ProcSend (register ClientPtr client)
+int ProcXevieSend (register ClientPtr client)
 {
     REQUEST (xXevieSendReq);
     xXevieSendReply rep;
@@ -281,7 +278,7 @@ int ProcSend (register ClientPtr client)
 }
 
 static
-int ProcSelectInput (register ClientPtr client)
+int ProcXevieSelectInput (register ClientPtr client)
 {
     REQUEST (xXevieSelectInputReq);
     xXevieSelectInputReply rep;
@@ -299,28 +296,28 @@ int ProcSelectInput (register ClientPtr client)
 }
 
 static 
-int ProcDispatch (register ClientPtr client)
+int ProcXevieDispatch (register ClientPtr client)
 {
     REQUEST (xReq);
     switch (stuff->data)
     {
     case X_XevieQueryVersion:
-	return ProcQueryVersion (client);
+	return ProcXevieQueryVersion (client);
     case X_XevieStart:
-	return ProcStart (client);
+	return ProcXevieStart (client);
     case X_XevieEnd:
-	return ProcEnd (client);
+	return ProcXevieEnd (client);
     case X_XevieSend:
-	return ProcSend (client);
+	return ProcXevieSend (client);
     case X_XevieSelectInput:
-	return ProcSelectInput(client);
+	return ProcXevieSelectInput(client);
     default:
 	return BadRequest;
     }
 }
 
 static 
-int SProcQueryVersion (register ClientPtr client)
+int SProcXevieQueryVersion (register ClientPtr client)
 {
     register int n;
 
@@ -329,11 +326,11 @@ int SProcQueryVersion (register ClientPtr client)
     REQUEST_SIZE_MATCH (xXevieQueryVersionReq);
     swaps (&stuff->client_major_version, n);
     swaps (&stuff->client_minor_version, n);
-    return ProcQueryVersion(client);
+    return ProcXevieQueryVersion(client);
 }
 
 static 
-int SProcStart (ClientPtr client)
+int SProcXevieStart (ClientPtr client)
 {
     register int n;
 
@@ -341,11 +338,11 @@ int SProcStart (ClientPtr client)
     swaps (&stuff->length, n);
     REQUEST_SIZE_MATCH (xXevieStartReq);
     swapl (&stuff->screen, n);
-    return ProcStart (client);
+    return ProcXevieStart (client);
 }
 
 static 
-int SProcEnd (ClientPtr client)
+int SProcXevieEnd (ClientPtr client)
 {
     register int n;
 
@@ -353,11 +350,11 @@ int SProcEnd (ClientPtr client)
     swaps (&stuff->length, n);
     REQUEST_SIZE_MATCH (xXevieEndReq);
     swapl (&stuff->cmap, n);
-    return ProcEnd (client);
+    return ProcXevieEnd (client);
 }
 
 static
-int SProcSend (ClientPtr client)
+int SProcXevieSend (ClientPtr client)
 {
     register int n;
     xEvent eventT;
@@ -375,11 +372,11 @@ int SProcSend (ClientPtr client)
     (*proc)(&stuff->event, &eventT);
     stuff->event = eventT;
     
-    return ProcSend (client);
+    return ProcXevieSend (client);
 }
 
 static
-int SProcSelectInput (ClientPtr client)
+int SProcXevieSelectInput (ClientPtr client)
 {
     register int n;
 
@@ -387,26 +384,26 @@ int SProcSelectInput (ClientPtr client)
     swaps (&stuff->length, n);
     REQUEST_SIZE_MATCH (xXevieSelectInputReq);
     swapl (&stuff->event_mask, n);
-    return ProcSelectInput (client);
+    return ProcXevieSelectInput (client);
 }
 
 
 static 
-int SProcDispatch (register ClientPtr client)
+int SProcXevieDispatch (register ClientPtr client)
 {
     REQUEST(xReq);
     switch (stuff->data)
     {
     case X_XevieQueryVersion:
-	return SProcQueryVersion (client);
+	return SProcXevieQueryVersion (client);
     case X_XevieStart:
-	return SProcStart (client);
+	return SProcXevieStart (client);
     case X_XevieEnd:
-	return SProcEnd (client);
+	return SProcXevieEnd (client);
     case X_XevieSend:
-	return SProcSend (client);
+	return SProcXevieSend (client);
     case X_XevieSelectInput:
-	return SProcSelectInput(client);
+	return SProcXevieSelectInput(client);
     default:
 	return BadRequest;
     }
commit 0aa3b971b4b0cc7b22e4e916ca77c6b673b6bb51
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Wed Mar 19 14:06:53 2008 -0700

    Xevie cleanups, byteswapping fixes & request length check fixes
    (cherry picked from commit f37046984d7839faefa4d716624e4a85ddde9634)

diff --git a/Xext/xevie.c b/Xext/xevie.c
index ea409f1..f36ead4 100644
--- a/Xext/xevie.c
+++ b/Xext/xevie.c
@@ -147,8 +147,6 @@ XevieExtensionInit (void)
 	ReqCode = (unsigned char)extEntry->base;
 	ErrorBase = extEntry->errorBase;
     }
-
-    /* PC servers initialize the desktop colors (citems) here! */
 }
 
 /*ARGSUSED*/
@@ -218,6 +216,8 @@ int ProcEnd (register ClientPtr client)
 {
     xXevieEndReply rep;
 
+    REQUEST_SIZE_MATCH (xXevieEndReq);
+    
     if (xevieFlag) {
         if (client->index != xevieClientIndex)
             return BadAccess;
@@ -240,6 +240,8 @@ int ProcSend (register ClientPtr client)
     xEvent *xE;
     static unsigned char lastDetail = 0, lastType = 0;
 
+    REQUEST_SIZE_MATCH (xXevieSendReq);
+    
     if (client->index != xevieClientIndex)
         return BadAccess;
 
@@ -284,10 +286,12 @@ int ProcSelectInput (register ClientPtr client)
     REQUEST (xXevieSelectInputReq);
     xXevieSelectInputReply rep;
 
+    REQUEST_SIZE_MATCH (xXevieSelectInputReq);
+
     if (client->index != xevieClientIndex)
         return BadAccess;
 
-    xevieMask = (long)stuff->event_mask;
+    xevieMask = stuff->event_mask;
     rep.type = X_Reply;
     rep.sequence_number = client->sequence;
     WriteToClient (client, sizeof (xXevieSelectInputReply), (char *)&rep);
@@ -321,7 +325,10 @@ int SProcQueryVersion (register ClientPtr client)
     register int n;
 
     REQUEST(xXevieQueryVersionReq);
-    swaps(&stuff->length, n);
+    swaps (&stuff->length, n);
+    REQUEST_SIZE_MATCH (xXevieQueryVersionReq);
+    swaps (&stuff->client_major_version, n);
+    swaps (&stuff->client_minor_version, n);
     return ProcQueryVersion(client);
 }
 
@@ -332,8 +339,8 @@ int SProcStart (ClientPtr client)
 
     REQUEST (xXevieStartReq);
     swaps (&stuff->length, n);
+    REQUEST_SIZE_MATCH (xXevieStartReq);
     swapl (&stuff->screen, n);
-    REQUEST_AT_LEAST_SIZE (xXevieStartReq);
     return ProcStart (client);
 }
 
@@ -344,8 +351,8 @@ int SProcEnd (ClientPtr client)
 
     REQUEST (xXevieEndReq);
     swaps (&stuff->length, n);
-    REQUEST_AT_LEAST_SIZE (xXevieEndReq);
-    swapl(&stuff->cmap, n);
+    REQUEST_SIZE_MATCH (xXevieEndReq);
+    swapl (&stuff->cmap, n);
     return ProcEnd (client);
 }
 
@@ -353,11 +360,21 @@ static
 int SProcSend (ClientPtr client)
 {
     register int n;
+    xEvent eventT;
+    EventSwapPtr proc;
 
     REQUEST (xXevieSendReq);
     swaps (&stuff->length, n);
-    REQUEST_AT_LEAST_SIZE (xXevieSendReq);
-    swapl(&stuff->event, n);
+    REQUEST_SIZE_MATCH (xXevieSendReq);
+    swapl (&stuff->dataType, n);
+
+    /* Swap event */
+    proc = EventSwapVector[stuff->event.u.u.type & 0177];
+    if (!proc ||  proc == NotImplemented) /* no swapping proc; invalid event type? */
+	return (BadValue);
+    (*proc)(&stuff->event, &eventT);
+    stuff->event = eventT;
+    
     return ProcSend (client);
 }
 
@@ -368,8 +385,8 @@ int SProcSelectInput (ClientPtr client)
 
     REQUEST (xXevieSelectInputReq);
     swaps (&stuff->length, n);
-    REQUEST_AT_LEAST_SIZE (xXevieSelectInputReq);
-    swapl(&stuff->event_mask, n);
+    REQUEST_SIZE_MATCH (xXevieSelectInputReq);
+    swapl (&stuff->event_mask, n);
     return ProcSelectInput (client);
 }
 
commit 21dc18624544c87c711b3aba63d96cbbf4637505
Author: Dodji Seketeli <dodji at seketeli.org>
Date:   Tue Mar 18 14:00:15 2008 +0100

    [Xephyr/DRI] correctly route motion events targeted at GL drawable
    (cherry picked from commit cdadd2ff9bade318caac5c1d9bcdc8a001347da9)

diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index e95001d..b02f990 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -891,9 +891,12 @@ ephyrPoll(void)
               continue;
           }
           {
-            if (ephyrCurScreen != ev.data.mouse_motion.screen)
+            if (ev.data.mouse_motion.screen >=0
+                && (ephyrCurScreen != ev.data.mouse_motion.screen))
               {
-                  EPHYR_LOG ("warping mouse cursor:%d\n", ephyrCurScreen) ;
+                  EPHYR_LOG ("warping mouse cursor. "
+                             "cur_screen%d, motion_screen:%d\n",
+                             ephyrCurScreen, ev.data.mouse_motion.screen) ;
                   if (ev.data.mouse_motion.screen >= 0)
                     {
                       ephyrWarpCursor
@@ -904,11 +907,30 @@ ephyrPoll(void)
               }
             else
               {
+                  int x=0, y=0;
+#ifdef XEPHYR_DRI
+                  EphyrWindowPair *pair = NULL;
+#endif
                   EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
-                  KdEnqueuePointerEvent(ephyrMouse, mouseState,
-                                        ev.data.mouse_motion.x,
-                                        ev.data.mouse_motion.y,
-                                        0);
+                  x = ev.data.mouse_motion.x;
+                  y = ev.data.mouse_motion.y;
+                  EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ;
+#ifdef XEPHYR_DRI
+                  EPHYR_LOG ("is this window peered by a gl drawable ?\n") ;
+                  if (findWindowPairFromRemote (ev.data.mouse_motion.window,
+                                                &pair))
+                    {
+                        EPHYR_LOG ("yes, it is peered\n") ;
+                        x += pair->local->drawable.x;
+                        y += pair->local->drawable.y;
+                    }
+                  else
+                    {
+                        EPHYR_LOG ("no, it is not peered\n") ;
+                    }
+                  EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ;
+#endif
+                  KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0);
               }
           }
           break;
diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index ae1bb4b..fd84ec0 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -914,8 +914,9 @@ hostx_get_event(EphyrHostXEvent *ev)
                 host_screen_from_window (xev.xmotion.window);
 
 	    ev->type = EPHYR_EV_MOUSE_MOTION;
-	    ev->data.mouse_motion.x = xev.xmotion.x; 
+	    ev->data.mouse_motion.x = xev.xmotion.x;
 	    ev->data.mouse_motion.y = xev.xmotion.y;
+	    ev->data.mouse_motion.window = xev.xmotion.window;
 	    ev->data.mouse_motion.screen = (host_screen ? host_screen->mynum : -1);
 	  }
 	  return 1;
diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h
index f72cfe7..48d3147 100644
--- a/hw/kdrive/ephyr/hostx.h
+++ b/hw/kdrive/ephyr/hostx.h
@@ -70,6 +70,7 @@ struct EphyrHostXEvent
       int x;
       int y;
       int screen;
+      int window;
     } mouse_motion;
 
     struct mouse_down { 	
commit 4f0755d6d41055be091d3dea477697a2617e1505
Author: Jesse Barnes <jbarnes at jbarnes-t61.(none)>
Date:   Mon Mar 17 08:33:01 2008 -0700

    Fail CRTC configuration if !vtSema
    
    Unless we check for vtSema before calling into the CRTC and output callbacks,
    we may end up trying to access video memory that no longer exists, leading to a
    crash.  So if we don't have vtSema, return FALSE to the caller, indicating that
    we didn't do anything.
    
    Fixes #14444.
    (cherry picked from commit bee2ddf35f75086cee951142098637f2c756b96b)

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 9671839..14c2d41 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -717,6 +717,9 @@ xf86RandR12CrtcSet (ScreenPtr	pScreen,
     xf86CrtcPtr		*save_crtcs;
     Bool		save_enabled = crtc->enabled;
 
+    if (!crtc->scrn->vtSema)
+	return FALSE;
+
     save_crtcs = xalloc(config->num_output * sizeof (xf86CrtcPtr));
     if ((randr_mode != NULL) != crtc->enabled)
 	changed = TRUE;
commit 727e22c8305a42987841e96b190a23a56259cd8f
Author: Matthieu Herrb <matthieu.herrb at laas.fr>
Date:   Sun Mar 16 18:46:11 2008 +0100

    test for the presence of pci_system_init_dev_mem() before calling it.
    
    This avoids creating a dependency on -current libpciaccess for
    BSD systems other than OpenBSD (which don't otherwise need it).
    (cherry picked from commit db248ffb840a0c113b6eb508a0fa1e74e752474d)

diff --git a/configure.ac b/configure.ac
index f3b238a..b8f6b61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1308,6 +1308,13 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
 	XORG_LIBS="$COMPOSITE_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $SELINUX_LIB"
 
 	PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.8.0])
+	SAVE_LIBS=$LIBS
+	SAVE_CFLAGS=$CFLAGS
+	CFLAGS=$PCIACCESS_CFLAGS
+	LIBS=$PCIACCESS_LIBS
+	AC_CHECK_FUNCS([pci_system_init_dev_mem])
+	LIBS=$SAVE_LIBS
+	CFLAGS=$SAVE_CFLAGS
 	XORG_SYS_LIBS="$XORG_SYS_LIBS $PCIACCESS_LIBS $DLOPEN_LIBS $GLX_SYS_LIBS"
 	XORG_CFLAGS="$XORG_CFLAGS $PCIACCESS_CFLAGS"
 
diff --git a/hw/xfree86/os-support/bsd/i386_video.c b/hw/xfree86/os-support/bsd/i386_video.c
index 7e4a4d2..1ebac67 100644
--- a/hw/xfree86/os-support/bsd/i386_video.c
+++ b/hw/xfree86/os-support/bsd/i386_video.c
@@ -212,8 +212,10 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
 	pVidMem->mapMem = mapVidMem;
 	pVidMem->unmapMem = unmapVidMem;
 
+#if HAVE_PCI_SYSTEM_INIT_DEV_MEM
 	if (useDevMem)
 		pci_system_init_dev_mem(devMemFd);
+#endif
 
 #ifdef HAS_MTRR_SUPPORT
 	if (useDevMem) {
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index 0603eab..5587c0a 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -115,6 +115,9 @@
 /* Have execinfo.h */
 #undef HAVE_EXECINFO_H
 
+/* Have pci_system_init_dev_mem() */
+#undef HAVE_PCI_SYSTEM_INIT_DEV_MEM
+
 /* Path to text files containing PCI IDs */
 #undef PCI_TXT_IDS_PATH
 
commit a399b77e8f1034c3b92c5b7eb3445d1e5b64a8e9
Author: Donnie Berkholz <dberkholz at gentoo.org>
Date:   Fri Mar 14 18:41:25 2008 -0700

    Xephyr: Build fix: Port across XF86dri.c changes from Mesa.
    (cherry picked from commit aa231f28d56402d7daea6cbd3002fbf760f79497)

diff --git a/hw/kdrive/ephyr/XF86dri.c b/hw/kdrive/ephyr/XF86dri.c
index 506d7be..e656ff5 100644
--- a/hw/kdrive/ephyr/XF86dri.c
+++ b/hw/kdrive/ephyr/XF86dri.c
@@ -385,9 +385,8 @@ Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
 					   context, hHWContext );
 }
 
-GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context)
+GLboolean XF86DRIDestroyContext( Display *dpy, int screen, XID context)
 {
-    Display * const dpy = (Display *) ndpy;
     XExtDisplayInfo *info = find_display (dpy);
     xXF86DRIDestroyContextReq *req;
 
@@ -407,10 +406,9 @@ GLboolean XF86DRIDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid
 }
 
 GLboolean
-XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
-                       __DRIid drawable, drm_drawable_t * hHWDrawable)
+XF86DRICreateDrawable (Display *dpy, int screen,
+                       XID drawable, drm_drawable_t * hHWDrawable)
 {
-    Display * const dpy = (Display *) ndpy;
     XExtDisplayInfo *info = find_display (dpy);
     xXF86DRICreateDrawableReply rep;
     xXF86DRICreateDrawableReq *req;
@@ -437,16 +435,36 @@ XF86DRICreateDrawable (__DRInativeDisplay * ndpy, int screen,
     return True;
 }
 
-GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
-    __DRIid drawable )
+static int noopErrorHandler(Display *dpy, XErrorEvent *xerr)
+{
+    return 0;
+}
+
+GLboolean XF86DRIDestroyDrawable( Display *dpy, int screen,
+    XID drawable )
 {
-    Display * const dpy = (Display *) ndpy;
     XExtDisplayInfo *info = find_display (dpy);
     xXF86DRIDestroyDrawableReq *req;
+    int (*oldXErrorHandler)(Display *, XErrorEvent *);
 
     TRACE("DestroyDrawable...");
     XF86DRICheckExtension (dpy, info, False);
 
+    /* This is called from the DRI driver, which used call it like this
+     *
+     *   if (windowExists(drawable))
+     *     destroyDrawable(drawable);
+     *
+     * which is a textbook race condition - the window may disappear
+     * from the server between checking for its existance and
+     * destroying it.  Instead we change the semantics of
+     * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if
+     * the windows is gone, by wrapping the destroy call in an error
+     * handler. */
+
+    XSync(dpy, GL_FALSE);
+    oldXErrorHandler = XSetErrorHandler(noopErrorHandler);
+
     LockDisplay(dpy);
     GetReq(XF86DRIDestroyDrawable, req);
     req->reqType = info->codes->major_opcode;
@@ -455,6 +473,9 @@ GLboolean XF86DRIDestroyDrawable( __DRInativeDisplay * ndpy, int screen,
     req->drawable = drawable;
     UnlockDisplay(dpy);
     SyncHandle();
+
+    XSetErrorHandler(oldXErrorHandler);
+
     TRACE("DestroyDrawable... return True");
     return True;
 }
commit c81a8c3eac7864febbef9782a35020b61daa1352
Author: Donnie Berkholz <dberkholz at gentoo.org>
Date:   Fri Mar 14 18:41:07 2008 -0700

    Xephyr: Distribute ephyrdriext.h in tarballs.
    (cherry picked from commit a955c3b587b22b8bf20cb6bedbbec4ad5fcb32ac)

diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index d025c20..81d3d69 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -35,6 +35,7 @@ if XEPHYR_HAS_DRI
 
 libxephyr_hostdri_a_SOURCES= \
 ephyrdriext.c	\
+ephyrdriext.h	\
 ephyrdri.c	\
 ephyrdri.h	\
 XF86dri.c	\
commit 6b75b44d9e19c5b94985728d30c1307ba1ba8b8c
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Fri Mar 14 21:58:27 2008 +0200

    XkbCopyKeymap: Fix broken indentation
    
    An astute observer will note that the entirety of XkbCopyKeymap is indented
    with spaces, and no tabs whatsoever, and not commit changes which break the
    otherwise consistent indentation.
    A non-astute observer will note the breakage when the commit mail comes
    through with clearly broken indentation.
    A polite, non-astute, observer will then fix it.
    
    C'est la vie.
    (cherry picked from commit 090b26db767d296e7a3452da83b136d1caa0ed01)

diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index a3ae655..8339cef 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -1796,7 +1796,7 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
                   dsection = dst->geom->sections;
                  i < src->geom->num_sections;
                  i++, ssection++, dsection++) {
-		*dsection = *ssection;
+                *dsection = *ssection;
                 if (ssection->num_rows) {
                     tmp = xcalloc(ssection->num_rows, sizeof(XkbRowRec));
                     if (!tmp)
@@ -1852,9 +1852,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies)
                     }
                     ddoodad->any.type = sdoodad->any.type;
                 }
-		dsection->overlays = NULL;
-		dsection->sz_overlays = 0;
-		dsection->num_overlays = 0;
+                dsection->overlays = NULL;
+                dsection->sz_overlays = 0;
+                dsection->num_overlays = 0;
             }
         }
         else {
commit 98249dfa98b53a238b7d881beb5ec8b85f28ecd0
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Mar 20 20:03:02 2008 -0400

    XSELinux: Do a check for whether background "None" is allowed.
    (cherry picked from commit 3bbd77ff98478153afe3251de9ba11d757218213)

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index 3035898..17ce7af 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -1026,6 +1026,13 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     rc = SELinuxDoCheck(subj, obj, class, access_mode, &auditdata);
     if (rc != Success)
 	rec->status = rc;
+
+    /* Perform the background none check on windows */
+    if (access_mode & DixCreateAccess && rec->rtype == RT_WINDOW) {
+	rc = SELinuxDoCheck(subj, obj, class, DixBlendAccess, &auditdata);
+	if (rc != Success)
+	    ((WindowPtr)rec->res)->forcedBG = TRUE;
+    }
 }
 
 static void
commit d08bb7040cd5ba2d438dec614ff1b4dd0f9b33d5
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Mar 20 19:42:09 2008 -0400

    XSELinux: Correctly handle some permission bits that are used more than once.
    (cherry picked from commit e323bb426ce8a072d119cb2720b773241259c137)

diff --git a/Xext/xselinux.c b/Xext/xselinux.c
index 18c6526..3035898 100644
--- a/Xext/xselinux.c
+++ b/Xext/xselinux.c
@@ -152,6 +152,12 @@ static struct security_class_mapping map[] = {
     { NULL }
 };
 
+/* x_resource "read" bits from the list above */
+#define SELinuxReadMask (DixReadAccess|DixGetAttrAccess|DixListPropAccess| \
+			 DixGetPropAccess|DixGetFocusAccess|DixListAccess| \
+			 DixShowAccess|DixBlendAccess|DixReceiveAccess| \
+			 DixUseAccess|DixDebugAccess)
+
 /* forward declarations */
 static void SELinuxScreen(CallbackListPtr *, pointer, pointer);
 
@@ -853,6 +859,7 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     SELinuxObjectRec *obj, *data;
     Selection *pSel = *rec->ppSel;
     Atom name = pSel->selection;
+    Mask access_mode = rec->access_mode;
     SELinuxAuditRec auditdata = { .client = rec->client, .selection = name };
     security_id_t tsid;
     int rc;
@@ -861,11 +868,12 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     obj = dixLookupPrivate(&pSel->devPrivates, objectKey);
 
     /* If this is a new object that needs labeling, do it now */
-    if (rec->access_mode & DixCreateAccess) {
+    if (access_mode & DixCreateAccess) {
 	sidput(obj->sid);
 	rc = SELinuxSelectionToSID(name, subj, &obj->sid, &obj->poly);
 	if (rc != Success)
 	    obj->sid = unlabeled_sid;
+	access_mode = DixSetAttrAccess;
     }
     /* If this is a polyinstantiated object, find the right instance */
     else if (obj->poly) {
@@ -890,13 +898,13 @@ SELinuxSelection(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     }
 
     /* Perform the security check */
-    rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SELECTION, rec->access_mode,
+    rc = SELinuxDoCheck(subj, obj, SECCLASS_X_SELECTION, access_mode,
 			&auditdata);
     if (rc != Success)
 	rec->status = rc;
 
     /* Label the content (advisory only) */
-    if (rec->access_mode & DixSetAttrAccess) {
+    if (access_mode & DixSetAttrAccess) {
 	data = dixLookupPrivate(&pSel->devPrivates, dataKey);
 	sidput(data->sid);
 	if (subj->sel_create_sid)
@@ -976,6 +984,7 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     SELinuxSubjectRec *subj;
     SELinuxObjectRec *obj;
     SELinuxAuditRec auditdata = { .client = rec->client };
+    Mask access_mode = rec->access_mode;
     PrivateRec **privatePtr;
     security_class_t class;
     int rc, offset;
@@ -997,7 +1006,7 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
     }
 
     /* If this is a new object that needs labeling, do it now */
-    if (rec->access_mode & DixCreateAccess && offset >= 0) {
+    if (access_mode & DixCreateAccess && offset >= 0) {
 	rc = SELinuxLabelResource(rec, subj, obj, class);
 	if (rc != Success) {
 	    rec->status = rc;
@@ -1005,10 +1014,16 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
 	}
     }
 
+    /* Collapse generic resource permissions down to read/write */
+    if (class == SECCLASS_X_RESOURCE) {
+	access_mode = !!(rec->access_mode & SELinuxReadMask); /* rd */
+	access_mode |= !!(rec->access_mode & ~SELinuxReadMask) << 1; /* wr */
+    }
+
     /* Perform the security check */
     auditdata.restype = rec->rtype;
     auditdata.id = rec->id;
-    rc = SELinuxDoCheck(subj, obj, class, rec->access_mode, &auditdata);
+    rc = SELinuxDoCheck(subj, obj, class, access_mode, &auditdata);
     if (rc != Success)
 	rec->status = rc;
 }
commit c6ac4d4f4dfe3d792c77c48b009abc6e7103fbad
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Tue Mar 18 17:51:21 2008 -0400

    Apply __glXDisp_GetVisualConfigs message patch
    From http://bugs.freedesktop.org/show_bug.cgi?id=13863
    
    Problem was that the glxcmds.c __glXDisp_GetVisualConfigs
    function left garbage in the tail end of the message used for extensions.
    (cherry picked from commit edad0a9dfebcce5c54b2f9c32bd9d45549e20c51)

diff --git a/GL/glx/glxcmds.c b/GL/glx/glxcmds.c
index 32d1bc8..3b79cca 100644
--- a/GL/glx/glxcmds.c
+++ b/GL/glx/glxcmds.c
@@ -944,6 +944,12 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc)
 	buf[p++] = modes->transparentAlpha;
 	buf[p++] = GLX_TRANSPARENT_INDEX_VALUE;
 	buf[p++] = modes->transparentIndex;
+	buf[p++] = 0;
+	buf[p++] = 0;
+	buf[p++] = 0;
+	buf[p++] = 0;
+	buf[p++] = 0;
+	buf[p++] = 0;
 
 	if (client->swapped) {
 	    __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG);


More information about the xorg-commit mailing list