[evolution-data-server/gnome-3-22] Bug 778235 - [IMAPx] Ignore truncated COPYUID server response



commit 24697afa878fa75824d751fc84fc4a818d65c9e2
Author: Milan Crha <mcrha redhat com>
Date:   Mon Feb 20 15:25:34 2017 +0100

    Bug 778235 - [IMAPx] Ignore truncated COPYUID server response

 camel/providers/imapx/camel-imapx-utils.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 4fe0a77..46183e3 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -2134,6 +2134,9 @@ imapx_parse_uids (CamelIMAPXInputStream *stream,
 
        if (!token) {
                g_set_error (error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_IGNORE, "server response truncated");
+
+               camel_imapx_input_stream_ungettoken (stream, tok, token, len);
+
                return NULL;
        }
 
@@ -2224,8 +2227,10 @@ imapx_parse_status_copyuid (CamelIMAPXInputStream *stream,
 
        uids = imapx_parse_uids (stream, cancellable, &local_error);
        if (uids == NULL) {
-               /* Some broken servers can return truncated response, like:
+               /* Sometimes the server can return truncated response, like:
                   B00083 OK [COPYUID 4154  ] COPY completed.
+                  It's for example when moving/copying messages which are not
+                  available on the serer any more.
                   Just ignore such server error.
                */
                if (g_error_matches (local_error, CAMEL_IMAPX_ERROR, CAMEL_IMAPX_ERROR_IGNORE)) {
@@ -2601,8 +2606,10 @@ imapx_free_status (struct _status_info *sinfo)
                g_free (sinfo->u.newname.newname);
                break;
        case IMAPX_COPYUID:
-               g_array_free (sinfo->u.copyuid.uids, TRUE);
-               g_array_free (sinfo->u.copyuid.copied_uids, TRUE);
+               if (sinfo->u.copyuid.uids)
+                       g_array_free (sinfo->u.copyuid.uids, TRUE);
+               if (sinfo->u.copyuid.copied_uids)
+                       g_array_free (sinfo->u.copyuid.copied_uids, TRUE);
                break;
        case IMAPX_CAPABILITY:
                if (sinfo->u.cinfo)


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