diff options
| author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2017-12-08 01:23:58 -0500 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2017-12-08 08:08:46 -0400 |
| commit | d137170b23f8ccd9f967445e101d6f694df1cad4 (patch) | |
| tree | a9d783de0ce8bcfcd59f49703e82adb5c8c240ff /util/crypto.c | |
| parent | 181d4091c408b8ca014ec245ecdae602942b70ce (diff) | |
crypto: record whether an actual decryption attempt happened
In our consolidation of _notmuch_crypto_decrypt, the callers lost
track a little bit of whether any actual decryption was attempted.
Now that we have the more-subtle "auto" policy, it's possible that
_notmuch_crypto_decrypt could be called without having any actual
decryption take place.
This change lets the callers be a little bit smarter about whether or
not any decryption was actually attempted.
Diffstat (limited to 'util/crypto.c')
| -rw-r--r-- | util/crypto.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/util/crypto.c b/util/crypto.c index bb587571..338f1d5d 100644 --- a/util/crypto.c +++ b/util/crypto.c @@ -140,7 +140,8 @@ void _notmuch_crypto_cleanup (unused(_notmuch_crypto_t *crypto)) #endif GMimeObject * -_notmuch_crypto_decrypt (notmuch_decryption_policy_t decrypt, +_notmuch_crypto_decrypt (bool *attempted, + notmuch_decryption_policy_t decrypt, notmuch_message_t *message, g_mime_3_unused(GMimeCryptoContext* crypto_ctx), GMimeMultipartEncrypted *part, @@ -162,6 +163,8 @@ _notmuch_crypto_decrypt (notmuch_decryption_policy_t decrypt, g_error_free (*err); *err = NULL; } + if (attempted) + *attempted = true; #if (GMIME_MAJOR_VERSION < 3) ret = g_mime_multipart_encrypted_decrypt_session (part, crypto_ctx, @@ -191,6 +194,8 @@ _notmuch_crypto_decrypt (notmuch_decryption_policy_t decrypt, if (decrypt == NOTMUCH_DECRYPT_AUTO) return ret; + if (attempted) + *attempted = true; #if (GMIME_MAJOR_VERSION < 3) ret = g_mime_multipart_encrypted_decrypt(part, crypto_ctx, decrypt_result, err); |
