[gnome-control-center] user-accounts: Fix login keyring password not getting updated



commit af8a6440756ce3845b94c685918f8959968e6dd0
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Aug 22 16:31:59 2012 +0100

    user-accounts: Fix login keyring password not getting updated
    
    By passing the environment down to passwed rather than an empty one.
    This means that passwd's PAM modules will be able to access the session
    D-Bus, for the gnome-keyring PAM module to change the keyring password
    for example.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=616703

 panels/user-accounts/run-passwd.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/panels/user-accounts/run-passwd.c b/panels/user-accounts/run-passwd.c
index 6f7cfab..c6592a6 100644
--- a/panels/user-accounts/run-passwd.c
+++ b/panels/user-accounts/run-passwd.c
@@ -149,20 +149,14 @@ static gboolean
 spawn_passwd (PasswdHandler *passwd_handler, GError **error)
 {
         gchar   *argv[2];
-        gchar   *envp[1];
+        gchar  **envp;
         gint    my_stdin, my_stdout, my_stderr;
 
         argv[0] = "/usr/bin/passwd";    /* Is it safe to rely on a hard-coded path? */
         argv[1] = NULL;
 
-        envp[0] = NULL;                 /* If we pass an empty array as the environment,
-                                         * will the childs environment be empty, and the
-                                         * locales set to the C default? From the manual:
-                                         * "If envp is NULL, the child inherits its
-                                         * parent'senvironment."
-                                         * If I'm wrong here, we somehow have to set
-                                         * the locales here.
-                                         */
+        envp = g_get_environ ();
+        envp = g_environ_setenv (envp, "LC_ALL", "C", TRUE);
 
         if (!g_spawn_async_with_pipes (NULL,                            /* Working directory */
                                        argv,                            /* Argument vector */
@@ -179,9 +173,13 @@ spawn_passwd (PasswdHandler *passwd_handler, GError **error)
                 /* An error occured */
                 free_passwd_resources (passwd_handler);
 
+                g_strfreev (envp);
+
                 return FALSE;
         }
 
+        g_strfreev (envp);
+
         /* 2>&1 */
         if (dup2 (my_stderr, my_stdout) == -1) {
                 /* Failed! */



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