]> git.eshelyaron.com Git - emacs.git/commitdiff
When the .authinfo file has a user name but not a password, prompt
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Wed, 22 Jun 2011 14:48:31 +0000 (16:48 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Wed, 22 Jun 2011 14:48:31 +0000 (16:48 +0200)
for the password.

lisp/ChangeLog
lisp/gnus/auth-source.el
lisp/mail/smtpmail.el

index 0c72fbf47dbf9e1f9143428fcaf2c7de600d8f3f..57f4608ab72d66968678109dbfc4f26ab45f6ed9 100644 (file)
@@ -2,6 +2,8 @@
 
        * mail/smtpmail.el (smtpmail-via-smtp): Make sure we don't send
        QUIT twice.
+       (smtpmail-try-auth-methods): Require user name and password from
+       auth-source.
 
 2011-06-22  Martin Rudalics  <rudalics@gmx.at>
 
index d3261b137b2eb7f1220bd7dd732f2f6a2a87a979..6fe033fea790ce5eea5ad40eb502ac35633a6076 100644 (file)
@@ -713,7 +713,8 @@ Returns the deleted entries."
         when (string-match (concat "^" auth-source-magic)
                            (symbol-name sym))
         ;; remove that key
-        do (password-cache-remove (symbol-name sym))))
+        do (password-cache-remove (symbol-name sym)))
+  (setq auth-source-netrc-cache nil))
 
 (defun auth-source-remember (spec found)
   "Remember FOUND search results for SPEC."
@@ -1144,6 +1145,9 @@ See `auth-source-search' for details on SPEC."
          ;; we know (because of an assertion in auth-source-search) that the
          ;; :create parameter is either t or a list (which includes nil)
          (create-extra (if (eq t create) nil create))
+        (current-data (car (auth-source-search :max 1
+                                               :host host
+                                               :port port)))
          (required (append base-required create-extra))
          (file (oref backend source))
          (add "")
@@ -1178,7 +1182,9 @@ See `auth-source-search' for details on SPEC."
     (dolist (r required)
       (let* ((data (aget valist r))
              ;; take the first element if the data is a list
-             (data (auth-source-netrc-element-or-first data))
+             (data (or (auth-source-netrc-element-or-first data)
+                      (plist-get current-data
+                                 (intern (format ":%s" r) obarray))))
              ;; this is the default to be offered
              (given-default (aget auth-source-creation-defaults r))
              ;; the default supplementals are simple:
index 58a517ba83651dfcc56100c405f3f3e24ec9e424..b1685067c0879a0e8eb21c12e6e472a9d88cbd2b 100644 (file)
@@ -483,12 +483,15 @@ The list is in preference order.")
           '((user  . "SMTP user at %h: ")
             (secret . "SMTP password for %u@%h: ")))
          (auth-info (car
-                    (auth-source-search :max 1
-                                        :host host
-                                        :port (if port
-                                                  (format "%s" port)
-                                                "smtp")
-                                        :create ask-for-password)))
+                    (auth-source-search
+                     :max 1
+                     :host host
+                     :port (if port
+                               (format "%s" port)
+                             "smtp")
+                     :require (and ask-for-password
+                                   '(:user :secret))
+                     :create ask-for-password)))
          (user (plist-get auth-info :user))
          (password (plist-get auth-info :secret))
         (save-function (and ask-for-password