kazu-yamamoto/Mew — pull request #74 by konis (2014-10-11 15:19:27+00:00)
Title: Fix continual failure of mew-passwd-load function

Gpg version 2 can decrypt an encrypted file without asking for a
passphrase if it is cached in a gpg-agent process.

When a master password is not set to mew-passwd-master variable and
gpg can get the password from gpg-agent, mew-passwd-load function
always fails outputting "Master password is wrong!" because the
decryption of mew-passwd-file succeeds without setting
mew-passwd-master variable.

This happens, for instance, in the following situation:

1. invoke mew and make an imap/smtp connection.
-> mew-passwd-load function is called, and gpg program is invoked
to decrypt existing passwords of imap and smtp.
-> gpg asks for a master password and tells it to gpg-agent.
-> mew-passwd-load saves the master password in mew-passwd-master
through mew-passwd-filter, and successfully returns the decrypted
imap/smtp passwords.
2. once exit mew
3. invoke mew again and try to make an imap/smtp connection.
-> mew-passwd-load function invokes gpg.
-> gpg gets the master password from gpg-agent and decrypts
mew-passwd-file without asking for any passwords, leading to
mew-passwd-master being nil.
-> mew-passwd-load aborts and does not return the decrypted imap/smtp
passwords.

The failure continues until user kills the gpg-agent process or the
cached passphrase will expire.

This patch fixes the issue by changing mew-passwd-load function so
that it tries to read the output of gpg program even if
mew-passwd-master is not set.