gdm r6800 - in trunk: . daemon



Author: hansp
Date: Wed Apr  1 16:13:00 2009
New Revision: 6800
URL: http://svn.gnome.org/viewvc/gdm?rev=6800&view=rev

Log:
2009-04-01  Hans Petter Jansson  <hpj novell com>

        Bug 568590 - Environment doesn't get passed on to jobs, leading
        to unlocalized PAM messages.

        * daemon/gdm-session-worker-job.c
        (listify_hash): Make sure values are not NULL.
        (copy_environment_to_hash): New function.
        (get_job_environment): Actually copy the environment into the hash
        to get passed on to job.



Modified:
   trunk/ChangeLog
   trunk/daemon/gdm-session-worker-job.c

Modified: trunk/daemon/gdm-session-worker-job.c
==============================================================================
--- trunk/daemon/gdm-session-worker-job.c	(original)
+++ trunk/daemon/gdm-session-worker-job.c	Wed Apr  1 16:13:00 2009
@@ -119,10 +119,36 @@
               GPtrArray  *env)
 {
         char *str;
+
+        if (value == NULL)
+                value = "";
+
         str = g_strdup_printf ("%s=%s", key, value);
         g_ptr_array_add (env, str);
 }
 
+static void
+copy_environment_to_hash (GHashTable *hash)
+{
+        gchar **env_strv;
+        gint    i;
+
+        env_strv = g_listenv ();
+
+        for (i = 0; env_strv [i]; i++) {
+                gchar *key = env_strv [i];
+                const gchar *value;
+
+                value = g_getenv (key);
+                if (!value)
+                        continue;
+
+                g_hash_table_insert (hash, g_strdup (key), g_strdup (value));
+        }
+
+        g_strfreev (env_strv);
+}
+
 static GPtrArray *
 get_job_environment (GdmSessionWorkerJob *job)
 {
@@ -133,6 +159,7 @@
 
         /* create a hash table of current environment, then update keys has necessary */
         hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+        copy_environment_to_hash (hash);
 
         g_hash_table_insert (hash, g_strdup ("GDM_SESSION_DBUS_ADDRESS"), g_strdup (job->priv->server_address));
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]