From f3e2fabf3a0fab885ec1b9d8581b0d3a4f00db66 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Mon, 27 Sep 2010 19:42:10 +0200 Subject: [PATCH] Forget credentials if the server says the password was wrong. --- lisp/ChangeLog | 2 ++ lisp/nnimap.el | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bc979a601..4b0781507 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,8 @@ * nnimap.el (nnimap-request-accept-article): Remove the "." at the end, since some servers don't like it. + (nnimap-open-connection): Forget credentials if the server says the + password was wrong. * gnus-sum.el (gnus-summary-move-article): Add comment. (gnus-summary-insert-new-articles): Copy the old-high watermark so that diff --git a/lisp/nnimap.el b/lisp/nnimap.el index bc3a0475e..830aa7daf 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -361,6 +361,14 @@ some servers.") (car credentials) (cadr credentials))) (unless (car login-result) + ;; If the login failed, then forget the credentials + ;; that are now possibly cached. + (dolist (host (list (nnoo-current-server 'nnimap) + nnimap-address)) + (dolist (port ports) + (dolist (element '("login" "password")) + (auth-source-forget-user-or-password + element host port)))) (delete-process (nnimap-process nnimap-object)) (setq nnimap-object nil)))) (when nnimap-object -- 2.25.1