Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please drop bundled imaplib2 Python module #14

Closed
sunweaver opened this issue Jan 26, 2021 · 4 comments
Closed

Please drop bundled imaplib2 Python module #14

sunweaver opened this issue Jan 26, 2021 · 4 comments
Labels
wontfix This will not be worked on

Comments

@sunweaver
Copy link
Member

The application should rather require the imaplib2 Python module be available in the Linux distribution rather than embedding it as a bundled copy of code.

@tari01 tari01 added the wontfix This will not be worked on label Jan 26, 2021
@tari01
Copy link
Member

tari01 commented Jan 26, 2021

No, no, no! The imaplib2 is half-dead, abandoned and buggy as hell. We need to provide a copy that works for us. The one currently bundled has been tweaked by me.

Sad, but unavoidable right now.

@tari01 tari01 closed this as completed Jan 26, 2021
@sunweaver
Copy link
Member Author

sunweaver commented Jan 26, 2021

No, no, no! The imaplib2 is half-dead, abandoned and buggy as hell. We need to provide a copy that works for us. The one currently bundled has been tweaked by me.

Sad, but unavoidable right now.

Hmmm... when comparing your version and the imaplib2 version in Debian, there is only one improvement the Debian version has which yours has not:

$ diff -u /usr/lib/python3/dist-packages/imaplib2.py  ayatanawebmail/imaplib2.py 
--- /usr/lib/python3/dist-packages/imaplib2.py	2021-01-18 11:58:10.000000000 +0100
+++ ayatanawebmail/imaplib2.py	2021-01-25 17:16:15.392959708 +0100
@@ -492,17 +492,7 @@
 
             ssl_version =  TLS_MAP[self.tls_level][self.ssl_version]
 
-            if getattr(ssl, 'HAS_SNI', False):
-                ctx = ssl.SSLContext(ssl_version)
-                ctx.verify_mode = cert_reqs
-                if self.ca_certs is not None:
-                    ctx.load_verify_locations(self.ca_certs)
-                if self.certfile or self.keyfile:
-                    ctx.load_cert_chain(self.certfile, self.keyfile)
-                self.sock = ctx.wrap_socket(self.sock, server_hostname=self.host)
-            else:
-                self.sock = ssl.wrap_socket(self.sock, self.keyfile, self.certfile, ca_certs=self.ca_certs, cert_reqs=cert_reqs, ssl_version=ssl_version)
-
+            self.sock = ssl.wrap_socket(self.sock, self.keyfile, self.certfile, ca_certs=self.ca_certs, cert_reqs=cert_reqs, ssl_version=ssl_version)
             ssl_exc = ssl.SSLError
             self.read_fd = self.sock.fileno()
         except ImportError:
@@ -1379,7 +1369,7 @@
             self.ouq.put(rqb)
             return rqb
 
-        # Must setup continuation expectancy *before* ouq.put 
+        # Must setup continuation expectancy *before* ouq.put
         crqb = self._request_push(name=name, tag='continuation')
 
         self.ouq.put(rqb)
@@ -1395,7 +1385,7 @@
             if not ok:
                 break
 
-            if data == 'go ahead':	# Apparently not uncommon broken IMAP4 server response to AUTHENTICATE command
+            if data == 'go ahead':  # Apparently not uncommon broken IMAP4 server response to AUTHENTICATE command
                 data = ''
 
             # Send literal
@@ -2563,7 +2553,7 @@
             run('id', ())
             run('id', ("(name imaplib2)",))
             run('id', ("version", __version__, "os", os.uname()[0]))
- 
+
         for cmd,args in test_seq2:
             if (cmd,args) != ('uid', ('SEARCH', 'SUBJECT', 'IMAP4 test')):

Maybe reconsider? This is Debian package python3-imaplib2 2.57-5.2 (from Debian testing).

@sunweaver
Copy link
Member Author

sunweaver feels tempted to reopen this bug...

@tari01
Copy link
Member

tari01 commented Jan 26, 2021

It might work for Debian, but what about other distributions that get their imaplib2 from god-knows-where? If it works for you with the stock module, can you leave our version in the source tree, and simply exclude it from the Debian package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants