talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit e4274cfcd78d8039995c4f897e3f900ac3c7987e
parent ad6d9254091e1c5249d8f70f8b73d67e5a45e3e7
Author: Andrej Kacian <ticho@claws-mail.org>
Date:   Wed, 14 Mar 2018 21:35:05 +0100

Handle IMAP search failure instead of ignoring it.

Error out on protocol error during search, disconnect
the IMAP session, and display an error dialog about it.

Closes bug 3986 - IMAP quick search using non-ASCII
characters creates an infinite loop

Diffstat:
Msrc/imap.c | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/imap.c b/src/imap.c @@ -2468,7 +2468,12 @@ static gint search_msgs (Folder *folder, if (progress_cb) progress_cb(progress_data, TRUE, container->total_msgs, 0, container->total_msgs); - if (result == MAILIMAP_NO_ERROR) { + if (result == MAILIMAP_ERROR_PROTOCOL) { + debug_print("search_msgs - got protocol error, aborting\n"); + imap_handle_error(SESSION(session), NULL, result); + alertpanel_error_log(_("Search failed due to server error.")); + return -1; + } if (result == MAILIMAP_NO_ERROR) { gint result = 0; *msgs = imap_uid_list_from_lep(uidlist, &result); @@ -2489,9 +2494,12 @@ static gint search_msgs (Folder *folder, if (IMAP_FOLDER(folder)->search_charset_supported) return search_msgs(folder, container, msgs, on_server, predicate, progress_cb, progress_data); - else + else { + imap_handle_error(SESSION(session), NULL, result); return -1; + } } else { + imap_handle_error(SESSION(session), NULL, result); return -1; } }