diff options
author | Stef Walter <stef@memberwebs.com> | 2010-05-23 16:19:39 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2010-05-24 17:01:25 +0000 |
commit | 28f19c9b4cdc2fa3cfc0aa25f34760aee3c3c802 (patch) | |
tree | 919bfc34a8250a21a37a1b189b5df7d950778074 /pam | |
parent | 2037fd1c7b20b1a0de761e493d59894c926b48b7 (diff) | |
download | gnome-keyring-28f19c9b4cdc2fa3cfc0aa25f34760aee3c3c802.tar.gz |
Fix broken startup when used with gdm and password-less login.
Fixes bug #611002
Diffstat (limited to 'pam')
-rw-r--r-- | pam/gkr-pam-module.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/pam/gkr-pam-module.c b/pam/gkr-pam-module.c index bf3c844d..d6fc17d6 100644 --- a/pam/gkr-pam-module.c +++ b/pam/gkr-pam-module.c @@ -318,14 +318,11 @@ 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], - pam_handle_t *ph, struct passwd *pwd, const char *password) +setup_child (int inp[2], int outp[2], int errp[2], pam_handle_t *ph, struct passwd *pwd) { const char* display; int i, ret; - /* The --login argument comes last, because of code below */ - #ifdef VALGRIND char *args[] = { VALGRIND, VALGRIND_ARG, GNOME_KEYRING_DAEMON, "--daemonize", "--login", NULL}; #else @@ -335,14 +332,6 @@ setup_child (int inp[2], int outp[2], int errp[2], assert (pwd); assert (pwd->pw_dir); - /* If no password, don't pass in --login */ - if (password == NULL) { - for (i = 0; args[i]; ++i) { - if (strcmp ("--login", args[i]) == 0) - args[i] = NULL; - } - } - /* Fix up our end of the pipes */ if (dup2 (inp[READ_END], STDIN) < 0 || dup2 (outp[WRITE_END], STDOUT) < 0 || @@ -499,7 +488,7 @@ start_daemon (pam_handle_t *ph, struct passwd *pwd, const char *password) /* This is the child */ case 0: - setup_child (inp, outp, errp, ph, pwd, password); + setup_child (inp, outp, errp, ph, pwd); /* Should never be reached */ break; @@ -507,19 +496,23 @@ start_daemon (pam_handle_t *ph, struct passwd *pwd, const char *password) default: break; }; - + /* Close our unneeded ends of the pipes */ close (inp[READ_END]); close (outp[WRITE_END]); close (errp[WRITE_END]); inp[READ_END] = outp[WRITE_END] = errp[WRITE_END] = -1; - if (password) { - /* Write the login keyring password */ + /* + * We always pass in a --login argument, even when we have a NULL password + * since this controls the startup behavior. When using --login daemon waits + * for a password. Closing input signifies password is done. + */ + + if (password) write_string (inp[WRITE_END], password); - close (inp[WRITE_END]); - } - + close (inp[WRITE_END]); + /* * Note that we're not using select() or any such. We know how the * daemon sends its data. |