6630643 In Xinerama vertical configuration Trusted Path is covered by other applications
authorLokanath Das <Lokanath.Das@Sun.COM>
Mon, 11 Feb 2008 15:34:35 -0800
changeset 311 881fb798a4fe
parent 310 1732b3c1b136
child 312 51b557f4c86f
6630643 In Xinerama vertical configuration Trusted Path is covered by other applications 6633503 [tx] xorg server crashes on quiting firefox
open-src/xserver/xorg/sun-src/tsol/tsolextension.c
open-src/xserver/xorg/sun-src/tsol/tsolprotocol.c
--- a/open-src/xserver/xorg/sun-src/tsol/tsolextension.c	Mon Feb 11 14:26:50 2008 -0800
+++ b/open-src/xserver/xorg/sun-src/tsol/tsolextension.c	Mon Feb 11 15:34:35 2008 -0800
@@ -26,7 +26,7 @@
  * of the copyright holder.
  */ 
 
-#pragma ident   "@(#)tsolextension.c 1.21     07/04/03 SMI"
+#pragma ident   "@(#)tsolextension.c 1.28     08/02/08 SMI"
 
 #include <stdio.h>
 #include "auditwrite.h"
@@ -62,6 +62,9 @@
 #include "tsol.h"
 #include "inputstr.h"
 #include "extnsionst.h"
+#ifdef PANORAMIX
+#include "../Xext/panoramiXsrv.h"
+#endif
 #ifdef XCSECURITY
 #define _SECURITY_SERVER
 #include "security.h"
@@ -1573,26 +1576,64 @@
 	return (client->noClientException);
     }
 
-    pWin = LookupWindow(stuff->id, client);
-
-    /* window should not be root but child of root */
-    if (!pWin || (!pWin->parent))
+#if defined(PANORAMIX) && !defined(IN_MODULE)
+    if (!noPanoramiXExtension) 
     {
-        client->errorValue = stuff->id;
-        return (BadWindow);
-    }
-    if (err_code = xtsol_policy(TSOL_RES_TPWIN, TSOL_MODIFY, pWin,
+        PanoramiXWindow     *pPanoramiXWin = PanoramiXWinRoot;
+        int         j;
+
+        PANORAMIXFIND_ID(pPanoramiXWin, stuff->id);
+        IF_RETURN(!pPanoramiXWin, BadWindow);
+
+	FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j)
+	{
+		pWin = LookupWindow(pPanoramiXWin->info[j].id, client);
+
+		/* window should not be root but child of root */
+		if (!pWin || (!pWin->parent))
+		{
+		    client->errorValue = stuff->id;
+		    return (BadWindow);
+		}
+		if (err_code = xtsol_policy(TSOL_RES_TPWIN, TSOL_MODIFY, pWin,
+					client, TSOL_ALL, (void *)MAJOROP))
+		{
+		    return (err_code);
+		}
+
+		pParent = pWin->parent;
+		if (pParent->firstChild != pWin)
+		{
+		    tpwin = (WindowPtr)NULL;
+		    ReflectStackChange(pWin, pParent->firstChild, VTStack);
+		}
+	}
+
+    } else 
+#endif
+    {
+	pWin = LookupWindow(stuff->id, client);
+
+	/* window should not be root but child of root */
+	if (!pWin || (!pWin->parent))
+	{
+            client->errorValue = stuff->id;
+            return (BadWindow);
+	}
+	if (err_code = xtsol_policy(TSOL_RES_TPWIN, TSOL_MODIFY, pWin,
                                 client, TSOL_ALL, (void *)MAJOROP))
-    {
-        return (err_code);
+	{
+            return (err_code);
+	}
+
+	pParent = pWin->parent;
+	if (pParent->firstChild != pWin)
+	{
+	    tpwin = (WindowPtr)NULL;
+	    ReflectStackChange(pWin, pParent->firstChild, VTStack);
+	}
     }
 
-    pParent = pWin->parent;
-    if (pParent->firstChild != pWin)
-    {
-        tpwin = (WindowPtr)NULL;
-        ReflectStackChange(pWin, pParent->firstChild, VTStack);
-    }
     tpwin = pWin;
 
     /*
@@ -1788,13 +1829,10 @@
 
 	bsllow(&admin_low);
 
+	/* Set reasonable defaults for remote clients */
 	namelen = sizeof (tsolinfo->saddr);
-	if (getpeername(fd, (struct sockaddr *)&tsolinfo->saddr, &namelen) != 0) {
-		return;
-	}
-
-	/* Set reasonable defaults for remote clients */
-	if (tsolinfo->client_type == CLIENT_REMOTE) {
+	if (getpeername(fd, (struct sockaddr *)&tsolinfo->saddr, &namelen) == 0
+	  && (tsolinfo->client_type == CLIENT_REMOTE)) {
 		int errcode;
 		char hostbuf[NI_MAXHOST];
 		tsol_host_type_t host_type; 
--- a/open-src/xserver/xorg/sun-src/tsol/tsolprotocol.c	Mon Feb 11 14:26:50 2008 -0800
+++ b/open-src/xserver/xorg/sun-src/tsol/tsolprotocol.c	Mon Feb 11 15:34:35 2008 -0800
@@ -1,4 +1,4 @@
-/* Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+/* Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
@@ -26,7 +26,7 @@
  * of the copyright holder.
  */ 
 
-#pragma ident	"@(#)tsolprotocol.c 1.18	07/04/03 SMI"
+#pragma ident	"@(#)tsolprotocol.c 1.23	08/02/08 SMI"
 
 #ifdef HAVE_DIX_CONFIG_H 
 #include <dix-config.h> 
@@ -1665,46 +1665,57 @@
     return (status);
 }
 
-void
-RemoveStripeWindow()
-{
-    WindowPtr pParent;
-    WindowPtr pHead;
-
-    if (!tpwin)
-	return;
-
-    pParent = tpwin->parent;
-    pHead = pParent->firstChild;
-    if (tpwin == pHead) {
-	pHead = tpwin->nextSib;
-	tpwin->nextSib->prevSib = tpwin->prevSib;
-    }
-
-    if (tpwin == pParent->lastChild) {
-	pParent->lastChild = tpwin->nextSib;
-    }
-}
-
 static void
 ResetStripeWindow(ClientPtr client)
 {
     WindowPtr pParent;
     WindowPtr pWin = NULL;
 
-    /* Validate trusted stripe window */
-    if (tpwin)
-        pWin = LookupWindow(tpwin->drawable.id, client);
-
-    if (tpwin == NullWindow || pWin == NullWindow)
-	return;
-
-    pParent = tpwin->parent;
-    /* stripe is already at head, nothing to do */
-    if (!pParent || pParent->firstChild == tpwin)
-	return;
-
-     ReflectStackChange(tpwin, pParent->firstChild, VTStack);
+#if defined(PANORAMIX) && !defined(IN_MODULE)
+    if (!noPanoramiXExtension)
+    {
+	PanoramiXWindow     *pPanoramiXWin = PanoramiXWinRoot;
+	int         j;
+
+	if (tpwin) {
+            PANORAMIXFIND_ID(pPanoramiXWin, tpwin->drawable.id);
+	    if (pPanoramiXWin == NULL)
+		return;
+	}
+
+	FOR_NSCREENS_OR_ONCE(pPanoramiXWin, j)
+	{
+	    if (pPanoramiXWin == NULL)
+		return;
+	    /* Validate trusted stripe window */
+	    pWin = LookupWindow(pPanoramiXWin->info[j].id, client);
+
+	    if (tpwin == NullWindow || pWin == NullWindow)
+		return;
+
+	    pParent = pWin->parent;
+    	    if (!pParent || pParent->firstChild == pWin)
+		return;
+
+	    ReflectStackChange(pWin, pParent->firstChild, VTStack);
+    	}
+    } else
+#endif
+    {
+	/* Validate trusted stripe window */
+	if (tpwin)
+	    pWin = LookupWindow(tpwin->drawable.id, client);
+
+	if (tpwin == NullWindow || pWin == NullWindow)
+	    return;
+
+	pParent = tpwin->parent;
+	/* stripe is already at head, nothing to do */
+	if (!pParent || pParent->firstChild == tpwin)
+	    return;
+
+	ReflectStackChange(tpwin, pParent->firstChild, VTStack);
+    }
 }
 
 int