[Users] glib regex issue is stopping OAuth2 token update
Michael Rasmussen
mir at miras.org
Mon Oct 17 20:33:24 UTC 2022
Hi Dan
On Mon, 17 Oct 2022 15:19:02 -0500
Dan N <dhn2-linux at stanfordalumni.org> wrote:
> 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 have seen this too with Microsoft Exchange and outlook.com.
> 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);
> _______________________________________________
I will try your suggested fix to see if it solves the Microsoft
problem as well.
--
Hilsen/Regards
Michael Rasmussen
Get my public GnuPG keys:
michael <at> rasmussen <dot> cc
https://pgp.key-server.io/pks/lookup?search=0xD3C9A00E
mir <at> datanom <dot> net
https://pgp.key-server.io/pks/lookup?search=0xE501F51C
mir <at> miras <dot> org
https://pgp.key-server.io/pks/lookup?search=0xE3E80917
--------------------------------------------------------------
'During times of universal deceit, telling the truth becomes a
revolutionary act.' -George Orwell
/usr/games/fortune -es says:
People who understand context would be steamed to have someone else
dictating how they can call it.
-- Larry Wall in <199710221710.KAA24242 at wall.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.claws-mail.org/pipermail/users/attachments/20221017/a0c7372f/attachment.sig>
More information about the Users
mailing list