[PATCH] Always return the empty string if decryption tries to demand a password

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Jun 3 16:37:49 PDT 2011


On 06/03/2011 07:15 PM, Carl Worth wrote:
> On Fri,  3 Jun 2011 19:03:08 -0400, Daniel Kahn Gillmor <dkg at fifthhorseman.net> wrote:
>> The notmuch binary is not in the business of doing interactive
>> prompting with the user.  If credentials are needed for decryption,
>> they should be supplied to the decrypting processes some other way
>> (e.g. gpg-agent).
>>
>> Previously, we returned a NULL function pointer for the
>> request_passwd() function, which may have cause segmentation faults
>> with some versions of gmime.
> 
> Cool. This fixes my segfaults, so thanks!
> 
>> +    return g_strdup ("");
> 
> Is the above correct? Or is it a memory leak? (If it's not a leak, then
> GMime really has some bizarre ownership semantics.)

yes, this corner of gmime has some really bizarre ownership semantics;
twisty handoffs and callbacks abound :(

Hm, actually, we should just be returning NULL to indicate a failure; i
think that would be preferable, and apparently is documented to be
acceptable:

 http://developer.gnome.org/gmime/stable/GMimeSession.html#g-mime-session-request-passwd

Would you mind amending that patch to just return NULL ?

fwiw, i've just filed https://bugzilla.gnome.org/show_bug.cgi?id=651826
to ask gmime for a hook to let us always request the use of gpg-agent if
it is available.

	--dkg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1030 bytes
Desc: OpenPGP digital signature
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110603/e67b8379/attachment.pgp>


More information about the notmuch mailing list