From f3f73ece15dba3c36428404c7271a4eea246006c Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Wed, 3 Dec 2025 08:24:25 +0100 Subject: [PATCH 1/2] reactivate IMAP AUTH=LOGIN as fallback replaced by 25402ab641246fedad7be1b7f1b38731a89356ed supporting https://github.com/Kozea/Radicale/issues/1929 --- radicale/auth/imap.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/radicale/auth/imap.py b/radicale/auth/imap.py index 18ec527b..f0d52b47 100644 --- a/radicale/auth/imap.py +++ b/radicale/auth/imap.py @@ -64,10 +64,18 @@ class Auth(auth.BaseAuth): if self._security == "starttls": connection.starttls(ssl.create_default_context()) try: - connection.authenticate( - "PLAIN", - lambda _: "{0}\x00{0}\x00{1}".format(login, password).encode(), - ) + if "AUTH=PLAIN" in connection.capabilities: + logger.debug("IMAP authentication PLAIN selected for user %r via %s:%d (security: %s)", login, self._host, self._port, self._security) + connection.authenticate( + "PLAIN", + lambda _: "{0}\x00{0}\x00{1}".format(login, password).encode(), + ) + elif "AUTH=LOGIN" in connection.capabilities: + logger.debug("IMAP authentication LOGIN selected for user %r via %s:%d (security: %s)", login, self._host, self._port, self._security) + connection.login(login, password) + else: + logger.error("IMAP server is neither supporting AUTH=PLAIN or AUTH=LOGIN: %s:%d (security: %s)", self._host, self._port, self._security) + return "" except imaplib.IMAP4.error as e: logger.warning("IMAP authentication failed for user %r: %s", login, e, exc_info=False) return "" From 0f664dcdb1b5d7503f2318ef7676c871e977b5a0 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Wed, 3 Dec 2025 08:31:52 +0100 Subject: [PATCH 2/2] Changelog for IMAP/LOGIN fallback --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d36b54d..1338b2bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 3.5.10.dev * Improve: logging of broken calendar items during PUT * Add: logging of broken contact items during PUT +* Extend: [auth] imap: add fallback support for LOGIN towards remote IMAP server (replaced in 3.5.0) ## 3.5.9 * Extend: [auth] add support for type http_remote_user