emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/mail/smtpmail.el,v


From: Teodor Zlatanov
Subject: [Emacs-diffs] Changes to emacs/lisp/mail/smtpmail.el,v
Date: Mon, 12 May 2008 12:40:17 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Teodor Zlatanov <tzz>   08/05/12 12:40:16

Index: mail/smtpmail.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/mail/smtpmail.el,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -b -r1.103 -r1.104
--- mail/smtpmail.el    6 May 2008 07:22:29 -0000       1.103
+++ mail/smtpmail.el    12 May 2008 12:40:11 -0000      1.104
@@ -78,6 +78,9 @@
 (autoload 'netrc-get "netrc")
 (autoload 'password-read "password-cache")
 
+(eval-and-compile
+  (autoload 'auth-source-user-or-password "auth-source"))
+
 ;;;
 (defgroup smtpmail nil
   "SMTP protocol for sending mail."
@@ -539,7 +542,14 @@
 (defun smtpmail-try-auth-methods (process supported-extensions host port)
   (let* ((mechs (cdr-safe (assoc 'auth supported-extensions)))
         (mech (car (smtpmail-intersection smtpmail-auth-supported mechs)))
-        (cred (if (stringp smtpmail-auth-credentials)
+        (auth-user (auth-source-user-or-password 
+                    "login" host (or port "smtp")))
+        (auth-pass (auth-source-user-or-password 
+                    "password" host (or port "smtp")))
+        (cred (if (and auth-user auth-pass) ; try user-auth-* before netrc-*
+                  (list host port auth-user auth-pass)
+                ;; else, if auth-source didn't return them...
+                (if (stringp smtpmail-auth-credentials)
                   (let* ((netrc (netrc-parse smtpmail-auth-credentials))
                           (port-name (format "%s" (or port "smtp")))
                          (hostentry (netrc-machine netrc host port-name
@@ -548,8 +558,10 @@
                        (list host port
                              (netrc-get hostentry "login")
                              (netrc-get hostentry "password"))))
+                  ;; else, try smtpmail-find-credentials since
+                  ;; smtpmail-auth-credentials is not a string
                 (smtpmail-find-credentials
-                 smtpmail-auth-credentials host port)))
+                   smtpmail-auth-credentials host port))))
         (prompt (when cred (format "SMTP password for %s:%s: "
                                    (smtpmail-cred-server cred)
                                    (smtpmail-cred-port cred))))




reply via email to

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