From 1ac9dc7fb42f797e94f5c8c30b767b1e111fc945 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Fri, 16 Sep 2011 13:57:55 +0200 Subject: [PATCH] Implement RFC 2595 LOGINDISABLED Warn the user and abort when we attempt a plaintext login, but the server has explicitly disabled plaintext logins. Signed-off-by: Sebastian Spaeth --- Changelog.draft.rst | 9 ++++----- offlineimap/imapserver.py | 6 ++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Changelog.draft.rst b/Changelog.draft.rst index 1b1e644..632586b 100644 --- a/Changelog.draft.rst +++ b/Changelog.draft.rst @@ -20,6 +20,10 @@ New Features future. Starting with this version, OfflineImap will be forward-compatible with the per-account locking style. +* Implement RFC 2595 LOGINDISABLED. Warn the user and abort when we + attempt a plaintext login but the server has explicitly disabled + plaintext logins rather than crashing. + Changes ------- @@ -30,8 +34,3 @@ Bug Fixes * New emails are not created with "-rwxr-xr-x" but as "-rw-r--r--" anymore, fixing a regression in 6.3.4. - -Pending for the next major release -================================== - -* UIs get shorter and nicer names. (API changing) diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py index 5d2d108..506f886 100644 --- a/offlineimap/imapserver.py +++ b/offlineimap/imapserver.py @@ -262,6 +262,12 @@ class IMAPServer: except imapobj.error, val: self.plainauth(imapobj) else: + # Use plaintext login, unless + # LOGINDISABLED (RFC2595) + if 'LOGINDISABLED' in imapobj.capabilities: + raise OfflineImapError("Plaintext login " + "disabled by server. Need to use SSL?", + OfflineImapError.ERROR.REPO) self.plainauth(imapobj) # Would bail by here if there was a failure. success = 1