emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r104673: When the .authinfo file has


From: Lars Magne Ingebrigtsen
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104673: When the .authinfo file has a user name but not a password, prompt
Date: Wed, 22 Jun 2011 16:48:31 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104673
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2011-06-22 16:48:31 +0200
message:
  When the .authinfo file has a user name but not a password, prompt
  for the password.
modified:
  lisp/ChangeLog
  lisp/gnus/auth-source.el
  lisp/mail/smtpmail.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-06-22 09:23:31 +0000
+++ b/lisp/ChangeLog    2011-06-22 14:48:31 +0000
@@ -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  <address@hidden>
 

=== modified file 'lisp/gnus/auth-source.el'
--- a/lisp/gnus/auth-source.el  2011-06-21 20:51:45 +0000
+++ b/lisp/gnus/auth-source.el  2011-06-22 14:48:31 +0000
@@ -713,7 +713,8 @@
         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 @@
          ;; 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 @@
     (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:

=== modified file 'lisp/mail/smtpmail.el'
--- a/lisp/mail/smtpmail.el     2011-06-22 09:13:50 +0000
+++ b/lisp/mail/smtpmail.el     2011-06-22 14:48:31 +0000
@@ -483,12 +483,15 @@
           '((user  . "SMTP user at %h: ")
             (secret . "SMTP password for address@hidden: ")))
          (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


reply via email to

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