[gmime] Don't return NULL unless decryption actually fails.
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Don't return NULL unless decryption actually fails.
- Date: Wed, 13 Jun 2012 13:57:40 +0000 (UTC)
commit a352352daff547541b7caedfed05931a7b775568
Author: Jeffrey Stedfast <fejj gnome org>
Date: Wed Jun 13 09:57:04 2012 -0400
Don't return NULL unless decryption actually fails.
2012-06-13 Jeffrey Stedfast <fejj gnome org>
* gmime/gmime-gpg-context.c (gpg_ctx_parse_status): Keep track
* of
DECRYPTION_OKAY status.
(gpg_decrypt): Only return NULL if decryption failed (e.g. we
didn't get a DECRYPTION_OKAY status).
Fixes bug #677088.
ChangeLog | 9 +++++++++
gmime/gmime-gpg-context.c | 9 ++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 07e6fc8..89b6be2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2012-06-13 Jeffrey Stedfast <fejj gnome org>
+ * gmime/gmime-gpg-context.c (gpg_ctx_parse_status): Keep track of
+ DECRYPTION_OKAY status.
+ (gpg_decrypt): Only return NULL if decryption failed (e.g. we
+ didn't get a DECRYPTION_OKAY status).
+
+ Fixes bug #677088.
+
+2012-06-13 Jeffrey Stedfast <fejj gnome org>
+
* docs/reference/building.sgml: Updated docs.
Fixes bug #676341
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index 1359f29..853b553 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -324,8 +324,9 @@ struct _GpgCtx {
unsigned int armor:1;
unsigned int need_passwd:1;
unsigned int bad_passwds:2;
+ unsigned int decrypt_okay:1;
- unsigned int padding:20;
+ unsigned int padding:19;
};
static struct _GpgCtx *
@@ -339,6 +340,7 @@ gpg_ctx_new (GMimeGpgContext *ctx)
gpg->mode = GPG_CTX_MODE_SIGN;
gpg->ctx = ctx;
gpg->userid_hint = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ gpg->decrypt_okay = FALSE;
gpg->complete = FALSE;
gpg->seen_eof1 = TRUE;
gpg->seen_eof2 = FALSE;
@@ -1284,7 +1286,8 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
/* second token is the cipher algorithm */
gpg->cipher = strtoul (status, &inend, 10);
} else if (!strncmp (status, "DECRYPTION_OKAY", 15)) {
- /* nothing to do... but good to know gpg decrypted the data successfully */
+ /* decryption succeeded */
+ gpg->decrypt_okay = TRUE;
} else if (!strncmp (status, "DECRYPTION_FAILED", 17)) {
/* nothing to do... but we know gpg failed to decrypt :-( */
} else if (!strncmp (status, "END_DECRYPTION", 14)) {
@@ -2016,7 +2019,7 @@ gpg_decrypt (GMimeCryptoContext *context, GMimeStream *istream,
}
}
- if (gpg_ctx_op_wait (gpg) != 0) {
+ if (gpg_ctx_op_wait (gpg) != 0 && !gpg->decrypt_okay) {
save = errno;
diagnostics = gpg_ctx_get_diagnostics (gpg);
errno = save;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]