[PATCH] Check for SSL methods availability

nandre <[email protected]>
Newsgroups gmane.mail.getmail.user
Message-ID <[email protected]>
Hi,

It seems support for ssl methods is slowly being droped and is not
built by default on openssl version 1.1.1.

getmail, however, is not checking if these methods are actualy
available on the system before trying to use them if the config file
says so.
getmail.dump (text/plain, 1.4 KB)
  getmail version 5.6
  Python version 2.7.15+ (default, Aug 31 2018, 11:56:52)
[GCC 8.2.0]

Unhandled exception follows:
    File "/usr/local/bin/getmail", line 892, in main
    success = go(configs, options.idle)
    File "/usr/local/bin/getmail", line 157, in go
    retriever.initialize(options)
    File "/usr/local/lib/python2.7/dist-packages/getmailcore/_retrieverbases.py", line 1143, in initialize
    self._connect()
    File "/usr/local/lib/python2.7/dist-packages/getmailcore/_retrieverbases.py", line 337, in _connect
    ssl_version = check_ssl_version(self.conf)
    File "/usr/local/lib/python2.7/dist-packages/getmailcore/utilities.py", line 565, in check_ssl_version
    return ssl.PROTOCOL_SSLv3
  AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'

###################################################################

Patch:

--- getmailcore/utilities.py.new        2018-10-29 23:09:45.499754037 -0300
+++ getmailcore/utilities.py.old        2018-10-29 23:08:54.650393300 -0300
@@ -559,9 +559,9 @@
             'Python; requires Python 2.6'
         )
     ssl_version = ssl_version.lower()
-    if ssl_version == 'sslv23' and 'PROTOCOL_SSLv23' in dir(ssl):
+    if ssl_version == 'sslv23':
         return ssl.PROTOCOL_SSLv23
-    elif ssl_version == 'sslv3' and 'PROTOCOL_SSLv3' in dir(ssl):
+    elif ssl_version == 'sslv3':
         return ssl.PROTOCOL_SSLv3
     elif ssl_version == 'tlsv1':
         return ssl.PROTOCOL_TLSv1
signature.asc (application/pgp-signature, 841 B)
-----BEGIN PGP SIGNATURE-----

iQI5BAABCgAjFiEEIBdLYNLH+F+MBdSrYrJ+WmBEwoIFAlvXxCEFgwPCZwAACgkQ
YrJ+WmBEwoJzLQ//UTlRkV3nKdq/yeyCojFmU4zxYLcTIWX10KAU2xHNovTx0KkB
vzf3Jc2HjUnfIQ2csG7h3C7bSNV3fqMpti8MF320NClLfdjEinC7HGpAmLLwmv7J
bwi+DfyNhxP3QFP1zMvrzXi1GBF+NWEdrePwr77v1UrBPs5VYrNKg/Q07QUBrmoA
ove09NU27I1rxvoIAAodfPVRgYAbuwV3hiL/XvCeT6TAF+Bv4xrZGdcL175w8sVE
C5kyscZ18merwI0+NhzlImyXKUPUIbZnrRhCYN4uq+BdcrhWjZ3nhanOvC5i1cef
GkZTzpP4xll8zoFPumbKkZ+2iLbOMwquR1dCOVeW8yYNupr//Lx346Ja065mGzva
dDmHsMEvSLz5Wt0p8dlMLgmsXnhGgPVbiIimeBkcYjCE5EABkHwKBgYHVaRFIMeD
4ji6FUIOaKPpNpySKM2H92U6ERht33rPjBIvcYbvChKTVVmDs75noR42vWyuQSbU
fC56T3mDgX0WmdjcL9LGamPC6qZlmD+PahHe8zn7MCPHNNZmyK/p1tSzwn6xcOVg
2A6GOArZRv3tB27sfhC4PpyQYmi3MmNXYJqvz+9nXtBMKxPuWAa7uepp4zSWRLp5
DhdTs5ongsx/qooS8m1+4o+lJ6z8TDwZXv7guwJE4zRqsU3+gufoN6rGyNU=
=HLMm
-----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.