From: Andrej Kacian Date: Wed, 14 Mar 2018 20:35:05 +0000 (+0100) Subject: Handle IMAP search failure instead of ignoring it. X-Git-Tag: 3.17.0~176 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=2d03eb98268e11b12c698bb6f98c7fb2f3559e3b 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 --- diff --git a/src/imap.c b/src/imap.c index 5c9968816..8d0ded98b 100644 --- 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; } }