Fix exporting of several variables into the session
upstream:
91fb196e037f6393c6a2b0a8fde3f1eda12e75a2
[PATCH 1/2] util: Blacklist some session-specific variables
c567b018b87b7885866dada76d6ffb17feeda618
[PATCH 2/2] util: Blacklist NOTIFY_SOCKET
---
 cinnamon-session/csm-util.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

--- a/cinnamon-session/csm-util.c
+++ b/cinnamon-session/csm-util.c
@@ -36,6 +36,14 @@
 
 static gchar *_saved_session_dir = NULL;
 
+static const char * const variable_blacklist[] = {
+    "NOTIFY_SOCKET",
+    "XDG_SEAT",
+    "XDG_SESSION_ID",
+    "XDG_VTNR",
+    NULL
+};
+
 char *
 csm_util_find_desktop_file_for_app_name (const char *name,
                                          gboolean    look_in_saved_session,
@@ -577,6 +585,9 @@ csm_util_export_activation_environment (
                 const char *entry_name = entry_names[i];
                 const char *entry_value = g_getenv (entry_name);
 
+                if (g_strv_contains (variable_blacklist, entry_name))
+                    continue;
+
                 if (!g_utf8_validate (entry_name, -1, NULL))
                     continue;
 
@@ -643,8 +654,13 @@ csm_util_export_user_environment (GError
                 return FALSE;
         }
 
+        entries = g_get_environ ();
+
+        for (; variable_blacklist[i] != NULL; i++)
+                entries = g_environ_unsetenv (entries, variable_blacklist[i]);
+
         g_variant_builder_init (&builder, G_VARIANT_TYPE ("as"));
-        for (entries = g_get_environ (); entries[i] != NULL; i++) {
+        for (i = 0; entries[i] != NULL; i++) {
                 const char *entry = entries[i];
 
                 if (!g_utf8_validate (entry, -1, NULL))
