emacs-diffs
[Top][All Lists]
Advanced

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

master 09b040c: * lisp/net/tramp.el (tramp-read-passwd): Use connection-


From: Michael Albinus
Subject: master 09b040c: * lisp/net/tramp.el (tramp-read-passwd): Use connection-local `auth-sources'.
Date: Mon, 7 Dec 2020 04:38:32 -0500 (EST)

branch: master
commit 09b040cb58224cc1e57ab52b429a5b9309094766
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    * lisp/net/tramp.el (tramp-read-passwd): Use connection-local 
`auth-sources'.
    
    * lisp/net/tramp-adb.el (tramp-adb-maybe-open-connection):
    * lisp/net/tramp-gvfs.el (tramp-gvfs-maybe-open-connection):
    * lisp/net/tramp-sh.el (tramp-maybe-open-connection):
    * lisp/net/tramp-smb.el (tramp-smb-maybe-open-connection):
    Move setting of connection-local variables up.
---
 lisp/net/tramp-adb.el  | 6 +++---
 lisp/net/tramp-gvfs.el | 8 ++++----
 lisp/net/tramp-sh.el   | 6 +++---
 lisp/net/tramp-smb.el  | 6 +++---
 lisp/net/tramp.el      | 4 +++-
 5 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 4947d16..f6e8933 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1260,6 +1260,9 @@ connection if a previous connection has died for some 
reason."
            (process-put p 'adjust-window-size-function #'ignore)
            (set-process-query-on-exit-flag p nil)
 
+           ;; Set connection-local variables.
+           (tramp-set-connection-local-variables vec)
+
            ;; Change prompt.
            (tramp-set-connection-property
             p "prompt" (regexp-quote (format "///%s#$" prompt)))
@@ -1312,9 +1315,6 @@ connection if a previous connection has died for some 
reason."
                (tramp-error
                 vec 'file-error "Cannot switch to user `%s'" user)))
 
-           ;; Set connection-local variables.
-           (tramp-set-connection-local-variables vec)
-
            ;; Mark it as connected.
            (tramp-set-connection-property p "connected" t)))))))
 
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index f3d03d0..c2028c4 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -2112,7 +2112,10 @@ connection if a previous connection has died for some 
reason."
              :buffer (tramp-get-connection-buffer vec)
              :server t :host 'local :service t :noquery t)))
       (process-put p 'vector vec)
-      (set-process-query-on-exit-flag p nil)))
+      (set-process-query-on-exit-flag p nil)
+
+      ;; Set connection-local variables.
+      (tramp-set-connection-local-variables vec)))
 
   (unless (tramp-gvfs-connection-mounted-p vec)
     (let ((method (tramp-file-name-method vec))
@@ -2216,9 +2219,6 @@ connection if a previous connection has died for some 
reason."
          (and (functionp tramp-password-save-function)
               (funcall tramp-password-save-function)))
 
-       ;; Set connection-local variables.
-       (tramp-set-connection-local-variables vec)
-
        ;; Mark it as connected.
        (tramp-set-connection-property
         (tramp-get-connection-process vec) "connected" t)))))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 137f085..79a7fea 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -5030,6 +5030,9 @@ connection if a previous connection has died for some 
reason."
 
                (tramp-message vec 6 "%s" (string-join (process-command p) " "))
 
+               ;; Set connection-local variables.
+               (tramp-set-connection-local-variables vec)
+
                ;; Check whether process is alive.
                (tramp-barf-if-no-shell-prompt
                 p 10
@@ -5139,9 +5142,6 @@ connection if a previous connection has died for some 
reason."
                  (setq options ""
                        target-alist (cdr target-alist)))
 
-               ;; Set connection-local variables.
-               (tramp-set-connection-local-variables vec)
-
                ;; Activate session timeout.
                (when (tramp-get-connection-property p "session-timeout" nil)
                  (run-at-time
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index e521371..83c1b58 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -2040,6 +2040,9 @@ If ARGUMENT is non-nil, use it as argument for
              (process-put p 'adjust-window-size-function #'ignore)
              (set-process-query-on-exit-flag p nil)
 
+             ;; Set connection-local variables.
+             (tramp-set-connection-local-variables vec)
+
              (condition-case err
                  (let ((inhibit-message t))
                    ;; Play login scenario.
@@ -2073,9 +2076,6 @@ If ARGUMENT is non-nil, use it as argument for
                    (tramp-set-connection-property p "smb-share" share)
                    (tramp-set-connection-property p "chunksize" 1)
 
-                   ;; Set connection-local variables.
-                   (tramp-set-connection-local-variables vec)
-
                    ;; Mark it as connected.
                    (tramp-set-connection-property p "connected" t))
 
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index b3853aa..6750a7f 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5210,6 +5210,8 @@ Invokes `password-read' if available, `read-passwd' else."
                (tramp-check-for-regexp proc tramp-password-prompt-regexp)
                (format "%s for %s " (capitalize (match-string 1)) key))))
         (auth-source-creation-prompts `((secret . ,pw-prompt)))
+        ;; Use connection-local value.
+        (auth-sources (with-current-buffer (process-buffer proc) auth-sources))
         ;; We suspend the timers while reading the password.
          (stimers (with-timeout-suspend))
         auth-info auth-passwd)
@@ -5250,7 +5252,7 @@ Invokes `password-read' if available, `read-passwd' else."
                   (setq auth-passwd (funcall auth-passwd)))
                 auth-passwd)
 
-              ;; Try the password cache.
+              ;; Try the password cache.  Exists since Emacs 26.1.
               (progn
                 (setq auth-passwd (password-read pw-prompt key)
                       tramp-password-save-function



reply via email to

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