emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111317: Make smtpmail forget the pas


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111317: Make smtpmail forget the password if the server says it's invalid
Date: Mon, 24 Dec 2012 13:14:04 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111317
fixes bug: http://debbugs.gnu.org/12424
committer: Lars Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Mon 2012-12-24 13:14:04 +0100
message:
  Make smtpmail forget the password if the server says it's invalid
  
  * mail/smtpmail.el (smtpmail-try-auth-method): Refactored out into
  its own function.
  (smtpmail-try-auth-methods): Forget the user name/password if the
  login is unsuccessful.
modified:
  lisp/ChangeLog
  lisp/mail/smtpmail.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-12-22 22:03:18 +0000
+++ b/lisp/ChangeLog    2012-12-24 12:14:04 +0000
@@ -1,3 +1,10 @@
+2012-12-24  Lars Ingebrigtsen  <address@hidden>
+
+       * mail/smtpmail.el (smtpmail-try-auth-method): Refactored out into
+       its own function.
+       (smtpmail-try-auth-methods): Forget the user name/password if the
+       login is unsuccessful (bug#12424).
+
 2012-12-22  Michael Albinus  <address@hidden>
 
        * notifications.el (notifications-notify): Protect body with

=== modified file 'lisp/mail/smtpmail.el'
--- a/lisp/mail/smtpmail.el     2012-09-04 16:00:10 +0000
+++ b/lisp/mail/smtpmail.el     2012-12-24 12:14:04 +0000
@@ -529,6 +529,18 @@
            password (plist-get auth-info :secret)))
     (when (functionp password)
       (setq password (funcall password)))
+    (let ((result (catch 'done
+                   (smtpmail-try-auth-method process mech user password))))
+      (if (stringp result)
+         (progn
+           (auth-source-forget+ :host host :port port)
+           (throw 'done result))
+       (when save-function
+         (funcall save-function))
+       result))))
+
+(defun smtpmail-try-auth-method (process mech user password)
+  (let (ret)
     (cond
      ((or (not mech)
          (not user)
@@ -554,16 +566,11 @@
               ;; are taken as a response to the server, and the
               ;; authentication fails.
               (encoded (base64-encode-string response t)))
-         (smtpmail-command-or-throw process encoded)
-         (when save-function
-           (funcall save-function)))))
+         (smtpmail-command-or-throw process encoded))))
      ((eq mech 'login)
       (smtpmail-command-or-throw process "AUTH LOGIN")
-      (smtpmail-command-or-throw
-       process (base64-encode-string user t))
-      (smtpmail-command-or-throw process (base64-encode-string password t))
-      (when save-function
-       (funcall save-function)))
+      (smtpmail-command-or-throw process (base64-encode-string user t))
+      (smtpmail-command-or-throw process (base64-encode-string password t)))
      ((eq mech 'plain)
       ;; We used to send an empty initial request, and wait for an
       ;; empty response, and then send the password, but this
@@ -574,9 +581,7 @@
        process
        (concat "AUTH PLAIN "
               (base64-encode-string (concat "\0" user "\0" password) t))
-       235)
-      (when save-function
-       (funcall save-function)))
+       235))
      (t
       (error "Mechanism %s not implemented" mech)))))
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]