diff options
author | Iain Lane <[email protected]> | 2019-08-15 11:21:49 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2023-04-22 11:20:15 +0200 |
commit | 137b0d74ae23261221ca720a9dc6c31ae7feff19 (patch) | |
tree | eac8fe04405ed1470894488aadeb891024af14e8 | |
parent | da643512befc61c0846bb399856e658630c5306d (diff) | |
download | mate-session-manager-137b0d74ae23261221ca720a9dc6c31ae7feff19.tar.bz2 mate-session-manager-137b0d74ae23261221ca720a9dc6c31ae7feff19.tar.xz |
util: Blacklist some session-specific variablessession-var
-rw-r--r-- | mate-session/gsm-util.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/mate-session/gsm-util.c b/mate-session/gsm-util.c index a760fc3..5c812c2 100644 --- a/mate-session/gsm-util.c +++ b/mate-session/gsm-util.c @@ -39,6 +39,13 @@ static gchar *_saved_session_dir = NULL; +static const char * const variable_blacklist[] = { + "XDG_SEAT", + "XDG_SESSION_ID", + "XDG_VTNR", + NULL +}; + gchar ** gsm_get_screen_locker_command (void) { @@ -536,6 +543,9 @@ gsm_util_export_activation_environment (GError **error) 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; @@ -603,8 +613,13 @@ gsm_util_export_user_environment (GError **error) 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)) |