[Users] [Bug 4636] New: Handle non-ascii characters in server response

noreply at thewildbeast.co.uk noreply at thewildbeast.co.uk
Mon Oct 17 22:44:39 UTC 2022


https://www.thewildbeast.co.uk/claws-mail/bugzilla/show_bug.cgi?id=4636

            Bug ID: 4636
           Summary: Handle non-ascii characters in server response
           Product: Claws Mail
           Version: GIT
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: OAuth2
          Assignee: users at lists.claws-mail.org
          Reporter: mir at datanom.net

Create Dan N's email users list,

I've been successfully using OAuth2 (In Production, claws-mail 4.1.0, Linux)
with gmail POP for a few months, ever since gmail began requiring it.  Starting
3-4 weeks ago something changed in Google's server response causing random
failures (at least once a day) of token update and giving log message "OAuth2
access token not obtained".  Retrying "Get Mail" usually succeeds in getting an
updated token but sometimes it takes 3-4 tries before it works.

I tracked the problem down to the glib function g_regex_match failing whenever
the google server returns non-ascii characters in its response ("\247" in the
case I debugged, but I've seen other values), even though that character is
near the end and nowhere close to the strings being matched.  I confirmed this
with a test program and also confirmed a workaround.

I have no idea what the ideal fix is, but my workaround is to use G_REGEX_RAW
on all 3 of the g_regex_new calls in oauth2.c:

-       regex = g_regex_new ("\"access_token\": ?\"(.*?)\",?", 0, 0, NULL);
+       regex = g_regex_new ("\"access_token\": ?\"(.*?)\",?", G_REGEX_RAW, 0,
NULL);

-       regex = g_regex_new ("\"expires_in\": ?([0-9]*),?", 0, 0, NULL);
+       regex = g_regex_new ("\"expires_in\": ?([0-9]*),?", G_REGEX_RAW, 0,
NULL);

-       regex = g_regex_new ("\"refresh_token\": ?\"(.*?)\",?", 0, 0, NULL);
+       regex = g_regex_new ("\"refresh_token\": ?\"(.*?)\",?", G_REGEX_RAW, 0,
NULL);

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Users mailing list