From 5c99ec51ad000189a30ad9a19326bff7b12adbcf Mon Sep 17 00:00:00 2001
From: Ulrich Sibiller <uli42@gmx.de>
Date: Thu, 23 Apr 2020 21:10:06 +0200
Subject: Rootless.c: do not import private properties

In rootless mode some properties are private (or internal or
adminitrative). They are only required for the windows on the real X
server side that represent nxagent's windows. Those properties should
never be cloned from there to the the nxagent windows so we filter
them.

Fixes ArcticaProject/nx-libs#920
---
 nx-X11/programs/Xserver/hw/nxagent/Atoms.c    |  4 +++
 nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 36 +++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

(limited to 'nx-X11/programs')

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
index 2e144bb0c..358d46519 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c
@@ -73,6 +73,10 @@ static void nxagentPrintAtomMapInfo(char *message);
 
 Atom nxagentAtoms[NXAGENT_NUMBER_OF_ATOMS];
 
+/*
+ * Careful! Do not change indices here! Some of those are referenced
+ * at other places via nxagentAtoms[index].
+ */
 static char *nxagentAtomNames[NXAGENT_NUMBER_OF_ATOMS + 1] =
 {
   "NX_IDENTITY",                 /*  0 */
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
index b63d40802..3bd0b7c25 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c
@@ -39,6 +39,7 @@
 #include "Atoms.h"
 #include "Trap.h"
 #include "Utils.h"
+#include "Atoms.h"
 
 #include "compext/Compext.h"
 
@@ -890,6 +891,41 @@ void nxagentImportProperty(Window window,
 
     import = True;
   }
+  else if (property == nxagentAtoms[0])  /* NX_IDENTITY */
+  {
+    #ifdef WARNING
+    fprintf(stderr, "%s: not importing private [%ld][NXDARWIN].\n", __func__,
+                (long int) property);
+    #endif
+  }
+  else if (property == nxagentAtoms[5])  /* NX_CUT_BUFFER_SERVER */
+  {
+    #ifdef WARNING
+    fprintf(stderr, "%s: not importing private [%ld][NX_CUT_BUFFER_SERVER].\n", __func__,
+                (long int) property);
+    #endif
+  }
+  else if (property == nxagentAtoms[8])  /* NX_AGENT_SIGNATURE */
+  {
+    #ifdef WARNING
+    fprintf(stderr, "%s: not importing private [%ld][NX_AGENT_SIGNATURE].\n", __func__,
+                (long int) property);
+    #endif
+  }
+  else if (property == nxagentAtoms[9])  /* NXDARWIN */
+  {
+    #ifdef TEST
+    fprintf(stderr, "%s: not importing private [%ld][NXDARWIN].\n", __func__,
+                (long int) property);
+    #endif
+  }
+  else if (property == nxagentAtoms[15])  /* NX_SELTRANS_FROM_AGENT */
+  {
+    #ifdef TEST
+    fprintf(stderr, "%s: not importing private [%ld][NX_SELTRANS_FROM_AGENT].\n", __func__,
+                (long int) property);
+    #endif
+  }
   else if (strcmp(typeS, "STRING") == 0 ||
                strcmp(typeS, "UTF8_STRING") == 0 ||
                    strcmp(typeS, "CARDINAL") == 0 ||
-- 
cgit v1.2.3