Re: Setting Up OAUTH2 Support for Fetchmail and Postfix

Peter Pentchev <[email protected]>
Newsgroups gmane.mail.fetchmail.user
Message-ID <[email protected]>
On Sat, Oct 10, 2020 at 01:04:24AM -0500, Ranjan Maitra wrote:
> On Sat, 10 Oct 2020 01:28:02 +0200 Matthias Andree <[email protected]> wrote:
> 
> > Am 09.10.20 um 23:16 schrieb Ranjan Maitra:
> > > On Wed, 7 Oct 2020 20:33:13 +0200 Matthias Andree <[email protected]> wrote:
> > >
> > >> Am 07.10.20 um 19:00 schrieb Ranjan Maitra:
> > >>> On Wed, 7 Oct 2020 18:39:41 +0200 Matthias Andree <[email protected]> wrote:
> > >>>
> > >>>> Am 07.10.20 um 06:51 schrieb Ranjan Maitra:
> > >>>>> According to the site, that may be dated, but fetchmail has oauth2 support from fetchmail7. Will it be available soon?
> > >>>> Ranjan,
> > >>>>
> > >>>> that depends on how leniency of your definition of "soon".
> > >>>>
> > >>>> First we will have a 6.5 release branch, and that has not yet happened,
> > >>>> so I expect that 7.x will be a matter of 2021, but if you are running it
> > >>>> from the up-to-date "next" branch in Git (available on Gitlab and
> > >>>> Sourceforge), feel free to file bug reports.
> > >>>>
> > >>>> Regards,
> > >>>> Matthias
> > >>> Thanks,
> > >>>
> > >>> I have used fetchmail 7 without much of a problem (or something that I have noticed, anyway). Is it possible to backport the patch for oauth2 in the  6.x.x releases? I prefer using the rpms released by the distributions.
> > >> I am not doing that, and the purpose of the existing 6.x.y branches is
> > >> compatiblity as we update y and if possibly also when updating x. There
> > >> may be minor features in 6.5.y.
> > >>
> > >> 7.x.y is for major changes.
> > >>
> > > So, I was looking at https://sourceforge.net/projects/fetchmail/files/branch_7-alpha/ and here, there has not been an update here since about 2 years ago. Is the git version more up-to-date?
> > >
> > Yes it is, and I don't think I will be doing many releases from
> > development branches before it's release candidate time.
> > We have Git and we have autoreconf.
> >
> 
> Thanks! I was looking around git and I guess the python code to get the token file is perhaps here: https://sourceforge.net/p/fetchmail/git/ci/next/tree/contrib/fetchmail-oauth2.py#l140
> But then, I was wondering where is the code in fetchmail that makes it work (i.e. makes use of the oauth2 written in the rc file):
> 
>     poll imap.gmail.com protocol imap
>       auth oauthbearer username "[email protected]"
>       passwordfile "/home/path/to/access_token_file"
>       is LOCALUSER here sslmode wrapped sslcertck
> 
> This is for gmail, mine is for office 365 so I am wondering if there are areas in the main source code that I have to modify. (I have the python code needed to get the token.) It seems to me that fetchmail has to recognize and make use of the oauthbearer hence my question.

To answer your direct question, the code is in parts of imap.c and
pop3.c, as well as the aptly named oauth2.c and oauth2.h files, also
with configuration-related pieces sprinkled across several other files.

However, if you are thinking of backporting fetchmail OAUTH supprt to
a 6.x branch... please bear in mind that I would be very, very wary of
(in fact, I would not do it at all) trying to copy five, ten, or even
two hundred lines from a heavily-reworked codebase. There may be several
types of issues:
- the new code uses helper functions that are not present in the old
  code: you have to either backport them, too, or rewrite the code to
  not use them. This is a rabbit hole that once you start falling in,
  it takes you days and weeks to reach any kind of bottom... and then
  you find out that you have practically "backported" two-thirds of
  the rest of the new code
- the new code uses functions with new or changed arguments: you have to
  either backport them (and adapt all the other pieces in the old code
  that call them), or rewrite the code to not use them; see above about
  the rabbit hole
- the new code uses data structures that exist in the old code, *but*
  have some of the fields removed or the meaning of some of the fields
  changed: this is the most "evil" one, since the code will compile, but
  then, when you try to run it, some other function will expect this
  field to have this value or that field to have a value consistent with
  the other one, and things will break, either badly, or in subtle ways
  that will be very, very hard to detect

So... yeah. I would either try to use the 7.x version directly, or wait.

G'luck,
Peter

-- 
Peter Pentchev  [email protected] [email protected] [email protected]
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13

_______________________________________________
Fetchmail-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fetchmail-users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEELuenpRf8EkzxFcNUZR7vsCUn3xMFAl+BaQAACgkQZR7vsCUn
3xOOnA/+M06WXoFQr6sa5sskKjRCnaAtCxd63td4+fv81cMD4bjXFVfewlbqG0qe
ApVV/js5Bl2XVzZwC1havz0tm09aaTB1UwpZkGddnDzg0Crly14R8J+3IgsCWJ8R
B1KzgpYOXHQ/RuwACqgff2s5oIahGXT70om+/g/HVMDRxPvkNY/Vkz/J9s/MBm5g
x1wJirdvBqhplJH3xxJCLvjri03Ew8vqE4aaGLfFtzUxDm4UtUtKBKvhez1GsLyw
MMMvgryEtv5EbbGSsO0Uz4JBpF+cmxdXQEWELHibuq4w0ngh/WVXau+4EPsEZ8Xu
rRKzzbV3NskPgpYUHlxiN1TOkgbt1a3V9K4MU5o0uBXoYowH1ZRy9GkP4TtQkd1g
V28p9bJHkDhN5S7VGJ4ZyepvCoS+gvrB19oDwMRa8TEJa6TJ8Q6DvwCUdVzK1dCw
CaiXU9Xia8yYphjCRMpU2KAutIAy3OwpkZUkhEm/jRibUhOOFyBgeC0MLM4nR+Y0
Li/T2Thi8YUHnCIZMSvZ2gTLKHQ15c+QskJAeFbtUVaGZVHCooY0rIO1soHaDKld
JbqbhUNZ3U9tp9YFkFyG+ktnmL1vMX8toyWlnMrU0Qjdps9JmzZy5MZmfzoyuzs3
nyNpnX6Qgg2G4VW6sF86+7W0YGdKBFly3zWJZ/Mud/xwRBLpGVo=
=MJia
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.