diff -Nru getmail-5.5/debian/changelog getmail-5.6/debian/changelog --- getmail-5.5/debian/changelog 2018-02-21 18:04:07.000000000 +0000 +++ getmail-5.6/debian/changelog 2018-07-01 03:10:43.000000000 +0000 @@ -1,3 +1,13 @@ +getmail (5.6-1) unstable; urgency=medium + + * New upstream release. + + fix references to version 4 in README. Thanks: Daniel Kahn Gillmor. + + add Gmail-specific XOAUTH2 login support for IMAP. Thanks: Stefan + Krah. + * Add recommend for --store-password-in-gnome-keyring. Closes: #892978 + + -- Osamu Aoki Sun, 01 Jul 2018 12:10:43 +0900 + getmail (5.5-3) unstable; urgency=medium * d/control: repoint Vcs-*: to use salsa.debian.org diff -Nru getmail-5.5/debian/control getmail-5.6/debian/control --- getmail-5.5/debian/control 2018-02-21 18:03:47.000000000 +0000 +++ getmail-5.6/debian/control 2018-07-01 03:10:43.000000000 +0000 @@ -3,20 +3,20 @@ Priority: optional Maintainer: Osamu Aoki Uploaders: - Daniel Kahn Gillmor , + Daniel Kahn Gillmor Build-Depends: debhelper (>= 11~), dh-python -Build-Depends-Indep: python -Standards-Version: 4.1.3 -Vcs-Git: https://salsa.debian.org/debian/getmail.git +Build-Depends-Indep: python:any | python2.7:any | python2:any +Standards-Version: 4.1.4 +Vcs-Git: https://salsa.debian.org/debian/getmail Vcs-Browser: https://salsa.debian.org/debian/getmail Homepage: http://pyropus.ca/software/getmail/ Rules-Requires-Root: no -XS-Python-Version: 2.7 Package: getmail Architecture: all Multi-Arch: foreign -Depends: ${misc:Depends}, python2.7:any (>= 2.7.5-5~) +Depends: ${misc:Depends}, python2.7:any | python2:any +Suggests: python-gnomekeyring, python-gobject Provides: getmail4 Breaks: getmail4 (<< 5.5-2) Replaces: getmail4 diff -Nru getmail-5.5/docs/CHANGELOG getmail-5.6/docs/CHANGELOG --- getmail-5.5/docs/CHANGELOG 2017-12-18 21:55:58.000000000 +0000 +++ getmail-5.6/docs/CHANGELOG 2018-04-02 21:47:38.000000000 +0000 @@ -1,3 +1,8 @@ +Version 5.6 +02 April 2018 + -fix references to version 4 in README. Thanks: Daniel Kahn Gillmor. + -add Gmail-specific XOAUTH2 login support for IMAP. Thanks: Stefan Krah. + Version 5.5 18 December 2017 -feature request: added record_mailbox configuration parameter, to allow diff -Nru getmail-5.5/docs/configuration.html getmail-5.6/docs/configuration.html --- getmail-5.5/docs/configuration.html 2017-12-18 21:56:07.000000000 +0000 +++ getmail-5.6/docs/configuration.html 2018-04-02 21:48:09.000000000 +0000 @@ -570,7 +570,7 @@ via the keychain. See this posting to the getmail users' mailing list by Alan Schmitt for details. -
  • +
  • password_command (tuple of quoted strings) — retrieve the account password by running an arbitrary external @@ -656,6 +656,24 @@ http://honk.sigxcpu.org/projects/pykerberos/" for details.
  • +
  • + use_xoauth2 + (boolean) + — whether to use XOAUTH2 for login with the IMAP server. + If not set, normal password-based authenticaion is used. This is + currently only supported with Gmail; if anyone extends this to support + other IMAP providers, please let me know so I can include such support + in getmail. Note that using XOAUTH2 is no more secure than a + regular getmail configuration with a mode 0600 getmailrc file. + You will need to set password_command + as well to tell getmail to invoke the getmail-gmail-xoauth-tokens + helper program; that script requires a positional argument to tell it + where to read the initial tokens from and where it writes the access + and refresh tokens to, and the file requires manual initial setup. + This functionality was contributed by Stefan Krah, who has + additional + information about using it here. +
  • SSL Client Parameters

    diff -Nru getmail-5.5/docs/configuration.txt getmail-5.6/docs/configuration.txt --- getmail-5.5/docs/configuration.txt 2017-12-18 21:56:08.000000000 +0000 +++ getmail-5.6/docs/configuration.txt 2018-04-02 21:48:10.000000000 +0000 @@ -418,6 +418,19 @@ pykerberos with GSS support is installed; check your OS distribution or see http://honk.sigxcpu.org/projects/pykerberos/" for details. + * use_xoauth2 (boolean) — whether to use XOAUTH2 for login with the + IMAP server. If not set, normal password-based authenticaion is + used. This is currently only supported with Gmail; if anyone + extends this to support other IMAP providers, please let me know so + I can include such support in getmail. Note that using XOAUTH2 is + no more secure than a regular getmail configuration with a mode + 0600 getmailrc file. You will need to set password_command as well + to tell getmail to invoke the getmail-gmail-xoauth-tokens helper + program; that script requires a positional argument to tell it + where to read the initial tokens from and where it writes the + access and refresh tokens to, and the file requires manual initial + setup. This functionality was contributed by Stefan Krah, who has + additional information about using it here. SSL Client Parameters diff -Nru getmail-5.5/docs/THANKS getmail-5.6/docs/THANKS --- getmail-5.5/docs/THANKS 2006-01-27 17:13:32.000000000 +0000 +++ getmail-5.6/docs/THANKS 2018-04-02 21:47:38.000000000 +0000 @@ -1,5 +1,5 @@ I would like to thank the following individuals and organizations -for their gracious contributions to the development of getmail version 4. +for their gracious contributions to the development of getmail version 4 and 5. getmail 4 sponsors ------------------ @@ -37,3 +37,5 @@ Klinikum Landsberg of Germany +Also see the CHANGELOG for thanks to individual contributors for bug reports, +bug fixes, feature patches, and other contributions. diff -Nru getmail-5.5/getmailcore/__init__.py getmail-5.6/getmailcore/__init__.py --- getmail-5.5/getmailcore/__init__.py 2017-12-18 21:55:58.000000000 +0000 +++ getmail-5.6/getmailcore/__init__.py 2018-04-02 21:47:38.000000000 +0000 @@ -16,7 +16,7 @@ raise ImportError('getmail version 4 requires Python version 2.3.3' ' or later') -__version__ = '5.5' +__version__ = '5.6' __all__ = [ 'baseclasses', diff -Nru getmail-5.5/getmailcore/_retrieverbases.py getmail-5.6/getmailcore/_retrieverbases.py --- getmail-5.5/getmailcore/_retrieverbases.py 2017-12-18 21:22:56.000000000 +0000 +++ getmail-5.6/getmailcore/_retrieverbases.py 2018-04-02 21:47:38.000000000 +0000 @@ -1695,6 +1695,11 @@ 'login_cram_md5', self.conf['username'], self.conf['password'] ) + elif self.conf['use_xoauth2']: + # octal 1 / ctrl-A used as separator + auth = 'user=%s\1auth=Bearer %s\1\1' % (self.conf['username'], + self.conf['password']) + self.conn.authenticate('XOAUTH2', lambda unused: auth) else: self._parse_imapcmdresponse('login', self.conf['username'], self.conf['password']) diff -Nru getmail-5.5/getmailcore/retrievers.py getmail-5.6/getmailcore/retrievers.py --- getmail-5.5/getmailcore/retrievers.py 2017-12-18 21:22:56.000000000 +0000 +++ getmail-5.6/getmailcore/retrievers.py 2018-04-02 21:47:38.000000000 +0000 @@ -388,6 +388,7 @@ # .authenticate(), so we can't do this yet (?). ConfBool(name='use_cram_md5', required=False, default=False), ConfBool(name='use_kerberos', required=False, default=False), + ConfBool(name='use_xoauth2', required=False, default=False), ) received_from = None received_with = 'IMAP4' @@ -437,6 +438,7 @@ # .authenticate(), so we can't do this yet (?). ConfBool(name='use_cram_md5', required=False, default=False), ConfBool(name='use_kerberos', required=False, default=False), + ConfBool(name='use_xoauth2', required=False, default=False), ConfString(name='ssl_cert_hostname', required=False, default=None), ) received_from = None @@ -479,6 +481,7 @@ # .authenticate(), so we can't do this yet (?). ConfBool(name='use_cram_md5', required=False, default=False), ConfBool(name='use_kerberos', required=False, default=False), + ConfBool(name='use_xoauth2', required=False, default=False), ConfString(name='envelope_recipient'), ) received_from = None @@ -529,6 +532,7 @@ # .authenticate(), so we can't do this yet (?). ConfBool(name='use_cram_md5', required=False, default=False), ConfBool(name='use_kerberos', required=False, default=False), + ConfBool(name='use_xoauth2', required=False, default=False), ConfString(name='envelope_recipient'), ConfString(name='ssl_cert_hostname', required=False, default=None), ) diff -Nru getmail-5.5/getmail-gmail-xoauth-tokens getmail-5.6/getmail-gmail-xoauth-tokens --- getmail-5.5/getmail-gmail-xoauth-tokens 1970-01-01 00:00:00.000000000 +0000 +++ getmail-5.6/getmail-gmail-xoauth-tokens 2018-04-02 21:47:38.000000000 +0000 @@ -0,0 +1,117 @@ +#!/usr/bin/env python + +# +# Copyright 2012 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# + # http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Derived from oauth2.py (https://github.com/google/gmail-oauth2-tools). +# Heavily modified and rewritten by Stefan Krah. +# + + +import os +import sys +import urllib +import json +import argparse +import time + + +class OAuth2(object): + + def __init__(self, token_data_path): + self.token_data_path = token_data_path + + with open(self.token_data_path) as f: + self.data = json.load(f) + + def copy(self, *keys): + data = {} + for k in keys: + data[k] = self.data[k] + return data + + def query(self, params): + lst = [] + for param in sorted(params.iteritems(), key=lambda x: x[0]): + escaped = urllib.quote(param[1], safe='~-._') + lst.append('%s=%s' % (param[0], escaped)) + return '&'.join(lst) + + def code_url(self): + params = self.copy('scope', 'client_id', 'redirect_uri') + params['response_type'] = 'code' + return '%s?%s' % (self.data['auth_uri'], self.query(params)) + + def get_response(self, url, params): + encoded = urllib.urlencode(params) + response = urllib.urlopen(url, encoded).read() + return json.loads(response) + + def update_config(self, d): + self.data['access_token'] = d['access_token'] + self.data['expires_at'] = time.time() + d['expires_in'] - 100 + + refresh_token = d.get('refresh_token') + if refresh_token is not None: + self.data['refresh_token'] = refresh_token + + with open(self.token_data_path, "w") as f: + json.dump(self.data, f) + + def init_tokens(self, code): + params = self.copy('user', 'client_id', 'client_secret', + 'redirect_uri') + params['code'] = code + params['grant_type'] = 'authorization_code' + + d = self.get_response(self.data['token_uri'], params) + self.update_config(d) + + def refresh_tokens(self): + params = self.copy('client_id', 'client_secret', 'refresh_token') + params['grant_type'] = 'refresh_token' + + d = self.get_response(self.data['token_uri'], params) + self.update_config(d) + + def token(self): + if time.time() >= self.data.get('expires_at'): + self.refresh_tokens() + + return self.data['access_token'] + + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument("-i", "--init", action="store_true", default=False, + help="initialize access and refresh tokens") + parser.add_argument('tokenfile', metavar='', + help="location of the token data file") + + args = parser.parse_args() + auth = OAuth2(args.tokenfile) + + if args.init: + print "Visit this url to obtain a verification code:" + print " %s\n" % auth.code_url() + + code = raw_input("Enter verification code: ") + response = auth.init_tokens(code) + else: + sys.stdout.write("%s" % auth.token()) + + sys.exit(0) diff -Nru getmail-5.5/getmail.spec getmail-5.6/getmail.spec --- getmail-5.5/getmail.spec 2017-12-18 21:56:08.000000000 +0000 +++ getmail-5.6/getmail.spec 2018-04-02 21:48:10.000000000 +0000 @@ -2,7 +2,7 @@ Summary: POP3 mail retriever with reliable Maildir delivery Name: getmail -Version: 5.5 +Version: 5.6 Release: 1 License: GPL Group: Applications/Internet @@ -52,6 +52,21 @@ %{python_sitelib}/getmailcore/ %changelog +* Mon Apr 02 2018 Charles Cazabon +-update to version 5.6 + +* Mon Apr 02 2018 Charles Cazabon +-update to version 5.6 + +* Mon Apr 02 2018 Charles Cazabon +-update to version 5.6 + +* Mon Apr 02 2018 Charles Cazabon +-update to version 5.6 + +* Mon Apr 02 2018 Charles Cazabon +-update to version 5.6 + * Mon Dec 18 2017 Charles Cazabon -update to version 5.5 diff -Nru getmail-5.5/PKG-INFO getmail-5.6/PKG-INFO --- getmail-5.5/PKG-INFO 2017-12-18 21:56:09.000000000 +0000 +++ getmail-5.6/PKG-INFO 2018-04-02 21:48:11.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: getmail -Version: 5.5 +Version: 5.6 Summary: a mail retrieval, sorting, and delivering system Home-page: http://pyropus.ca/software/getmail/ Author: Charles Cazabon diff -Nru getmail-5.5/README getmail-5.6/README --- getmail-5.5/README 2009-08-06 22:20:45.000000000 +0000 +++ getmail-5.6/README 2018-04-02 21:47:38.000000000 +0000 @@ -1,4 +1,4 @@ -getmail version 4 -- a flexible, extensible mail retrieval system with +getmail version 5 -- a flexible, extensible mail retrieval system with support for POP3, IMAP4, SSL variants of both, maildirs, mboxrd files, external MDAs, arbitrary message filtering, single-user and domain-mailboxes, and many other useful features. @@ -7,11 +7,11 @@ getmail is licensed for use under the GNU General Public License version 2 (only). See docs/COPYING for specific terms and distribution information. -getmail version 4 requires Python version 2.3.3 or later. You can have +getmail version 5 requires Python version 2.3.3 or later. You can have several installed versions of Python peacefully co-existing, see python.org for details. -To install: getmail v.4 uses the standard Python distutils. Do the following +To install: getmail v.5 uses the standard Python distutils. Do the following as a regular user: python setup.py build diff -Nru getmail-5.5/setup.py getmail-5.6/setup.py --- getmail-5.5/setup.py 2007-11-23 16:26:55.000000000 +0000 +++ getmail-5.6/setup.py 2018-04-02 21:47:38.000000000 +0000 @@ -92,10 +92,11 @@ 'getmailcore' ], scripts=[ - 'getmail', - 'getmail_fetch', - 'getmail_maildir', - 'getmail_mbox' + 'getmail', + 'getmail_fetch', + 'getmail_maildir', + 'getmail_mbox', + 'getmail-gmail-xoauth-tokens', ], data_files=[ (GETMAILDOCDIR, [