diff options
author | Stefan Walter <stefw@src.gnome.org> | 2007-12-01 21:32:31 +0000 |
---|---|---|
committer | Stefan Walter <stefw@src.gnome.org> | 2007-12-01 21:32:31 +0000 |
commit | fc9d335ef9f3c3393a15bdf4c3e8186be621cccb (patch) | |
tree | cc4d42aa994cb4ed3642b9a09d735008f147e290 /pam | |
parent | 9d1b1c2cd4dd6ffd18c6c516401f498ac1d73607 (diff) | |
download | gnome-keyring-fc9d335ef9f3c3393a15bdf4c3e8186be621cccb.tar.gz |
Merge revisions from gnome-2-20 branch. 878 - 924
* Merge revisions from gnome-2-20 branch. 878 - 924
svn path=/trunk/; revision=926
Diffstat (limited to 'pam')
-rw-r--r-- | pam/gkr-pam-module.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/pam/gkr-pam-module.c b/pam/gkr-pam-module.c index a4e2c2a4..7dc5b088 100644 --- a/pam/gkr-pam-module.c +++ b/pam/gkr-pam-module.c @@ -269,10 +269,12 @@ cleanup_free_password (pam_handle_t *ph, void *data, int pam_end_status) static void setup_child (int inp[2], int outp[2], int errp[2], - struct passwd *pwd, const char *password) + pam_handle_t *ph, struct passwd *pwd, const char *password) { char *args[] = { GNOME_KEYRING_DAEMON, "-d", "--login", NULL}; - + const char* display; + int ret; + assert (pwd); assert (pwd->pw_dir); @@ -310,14 +312,22 @@ setup_child (int inp[2], int outp[2], int errp[2], } /* Setup environment variables */ - if (setenv ("HOME", pwd->pw_dir, 1) < 0) { + ret = setup_pam_env (ph, "HOME", pwd->pw_dir); + if (ret == PAM_SUCCESS && !pam_getenv (ph, "DISPLAY")) { + display = getenv ("DISPLAY"); + if (display) + ret = setup_pam_env (ph, "DISPLAY", display); + } + + /* Make sure that worked */ + if (ret != PAM_SUCCESS) { syslog (GKR_LOG_ERR, "gkr-pam: couldn't setup environment: %s", - strerror (errno)); - exit (EXIT_FAILURE); + pam_strerror (ph, ret)); + exit (EXIT_FAILURE); } - + /* Now actually execute the process */ - execv (args[0], args); + execve (args[0], args, pam_getenvlist (ph)); syslog (GKR_LOG_ERR, "gkr-pam: couldn't run gnome-keyring-daemon: %s", strerror (errno)); exit (EXIT_FAILURE); @@ -424,7 +434,7 @@ start_daemon (pam_handle_t *ph, struct passwd *pwd, const char *password) /* This is the child */ case 0: - setup_child (inp, outp, errp, pwd, password); + setup_child (inp, outp, errp, ph, pwd, password); /* Should never be reached */ break; |