[evolution-data-server/gnome-3-28] [IMAPx] Search for whole word "Cyrus" when parsing version from the server response



commit cc5206fa6e1aad625116a50f0e341cbe7149ec29
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jul 10 12:09:38 2018 +0200

    [IMAPx] Search for whole word "Cyrus" when parsing version from the server response
    
    Related to https://gitlab.gnome.org/GNOME/evolution-data-server/issues/14

 src/camel/providers/imapx/camel-imapx-server.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/camel/providers/imapx/camel-imapx-server.c b/src/camel/providers/imapx/camel-imapx-server.c
index 66316debb..f63afefbe 100644
--- a/src/camel/providers/imapx/camel-imapx-server.c
+++ b/src/camel/providers/imapx/camel-imapx-server.c
@@ -1855,7 +1855,14 @@ imapx_server_check_is_broken_cyrus (const gchar *response_text,
                return FALSE;
 
        /* Expects "Cyrus IMAP v1.2.3", eventually "Cyrus IMAP 4.5.6" (with or without 'v' prefix) */
-       pp = camel_strstrcase (response_text, "cyrus");
+       pp = response_text;
+       while (pp = camel_strstrcase (pp, "cyrus"), pp) {
+               /* It's a whole word */
+               if ((pp == response_text || g_ascii_isspace (pp[-1])) && g_ascii_isspace (pp[5]))
+                       break;
+               pp++;
+       }
+
        if (!pp)
                return FALSE;
 
@@ -1892,7 +1899,18 @@ imapx_server_check_is_broken_cyrus (const gchar *response_text,
 
                vermajor = 0;
 
-               from = camel_strstrcase (from + 1, "cyrus");
+               pp = from + 1;
+               from = NULL;
+
+               while (pp = camel_strstrcase (pp, "cyrus"), pp) {
+                       /* It's a whole word */
+                       if (g_ascii_isspace (pp[-1]) && g_ascii_isspace (pp[5])) {
+                               from = pp;
+                               break;
+                       }
+
+                       pp++;
+               }
        }
 
        /* The 2.5.11, inclusive, has the issue fixed, thus check for that version. */


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