emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master a5246dc: Adapt Tramp for auth-source


From: Michael Albinus
Subject: [Emacs-diffs] master a5246dc: Adapt Tramp for auth-source
Date: Wed, 2 May 2018 12:12:59 -0400 (EDT)

branch: master
commit a5246dc02b0572a611ac2169fa16962fc89926b9
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Adapt Tramp for auth-source
    
    * lisp/net/tramp.el (tramp-read-passwd): auth-source could return
    cascaded functions.
---
 lisp/net/tramp.el | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 5dda18f..e14a515 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4472,8 +4472,8 @@ Invokes `password-read' if available, `read-passwd' else."
 
     (unwind-protect
        (with-parsed-tramp-file-name key nil
-         (setq tramp-password-save-function nil)
-         (setq user
+         (setq tramp-password-save-function nil
+               user
                (or user (tramp-get-connection-property key "login-as" nil)))
          (prog1
              (or
@@ -4501,18 +4501,21 @@ Invokes `password-read' if available, `read-passwd' 
else."
                              :create t))
                            tramp-password-save-function
                            (plist-get auth-info :save-function)
-                           auth-passwd (plist-get auth-info :secret)
-                           auth-passwd (if (functionp auth-passwd)
-                                           (funcall auth-passwd)
-                                         auth-passwd))))
+                           auth-passwd (plist-get auth-info :secret)))
+                (while (functionp auth-passwd)
+                  (setq auth-passwd (funcall auth-passwd)))
+                auth-passwd)
 
               ;; Try the password cache.
-              (let ((password (password-read pw-prompt key)))
-                (setq tramp-password-save-function
-                      (lambda () (password-cache-add key password)))
-                password)
-              ;; Else, get the password interactively.
+              (progn
+                (setq auth-passwd (password-read pw-prompt key)
+                      tramp-password-save-function
+                      (lambda () (password-cache-add key auth-passwd)))
+                auth-passwd)
+
+              ;; Else, get the password interactively w/o cache.
               (read-passwd pw-prompt))
+
            (tramp-set-connection-property v "first-password-request" nil)))
 
       ;; Reenable the timers.



reply via email to

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