Commit af8a6440 authored by Bastien Nocera's avatar Bastien Nocera

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.
parent b682a3c6
......@@ -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! */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment