[evolution-data-server/gnome-3-30] I#3 - [GPG] Mails that are not encrypted look encrypted ][



commit 7c3b64e60731915ed5eb573a3ea5a442330c0222
Author: Milan Crha <mcrha redhat com>
Date:   Thu Sep 13 15:31:21 2018 +0200

    I#3 - [GPG] Mails that are not encrypted look encrypted ][
    
    One change, when the status stream ends an ongoing decrypt_state,
    still read the stdout data as valid decrypted data, otherwise
    the real output could be truncated.
    
    Related to https://gitlab.gnome.org/GNOME/evolution-data-server/issues/3

 src/camel/camel-gpg-context.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/camel/camel-gpg-context.c b/src/camel/camel-gpg-context.c
index 5b97b0ddb..27214cdd3 100644
--- a/src/camel/camel-gpg-context.c
+++ b/src/camel/camel-gpg-context.c
@@ -1422,6 +1422,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg,
        GPollFD polls[6];
        gint status, i;
        gboolean read_data = FALSE, wrote_data = FALSE;
+       gboolean was_in_decrypt_stage;
 
        for (i = 0; i < 6; i++) {
                polls[i].fd = -1;
@@ -1474,6 +1475,8 @@ gpg_ctx_op_step (struct _GpgCtx *gpg,
         * can to all of them. If one fails along the way, return
         * -1. */
 
+       was_in_decrypt_stage = gpg->in_decrypt_stage;
+
        if (polls[2].revents & (G_IO_IN | G_IO_HUP)) {
                /* read the status message and decide what to do... */
                gchar buffer[4096];
@@ -1513,7 +1516,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg,
 
                if (nread > 0) {
                        if (gpg->mode != GPG_CTX_MODE_DECRYPT ||
-                           gpg->in_decrypt_stage) {
+                           gpg->in_decrypt_stage || was_in_decrypt_stage) {
                                gsize written = camel_stream_write (
                                        gpg->ostream, buffer, (gsize)
                                        nread, cancellable, error);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]