summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2020-12-07 10:38:24 +0100
committerMichael Albinus <michael.albinus@gmx.de>2020-12-07 10:38:24 +0100
commit09b040cb58224cc1e57ab52b429a5b9309094766 (patch)
tree89111ffffa12da866740cf2acba06cb75bc7ec00
parent300c581370073fbaad025465edc39bcbfe5e7c81 (diff)
downloademacs-09b040cb58224cc1e57ab52b429a5b9309094766.tar.gz
* 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.
-rw-r--r--lisp/net/tramp-adb.el6
-rw-r--r--lisp/net/tramp-gvfs.el8
-rw-r--r--lisp/net/tramp-sh.el6
-rw-r--r--lisp/net/tramp-smb.el6
-rw-r--r--lisp/net/tramp.el4
5 files changed, 16 insertions, 14 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 4947d161f3f..f6e89339b68 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 f3d03d0fb0a..c2028c4908c 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 137f0857f7e..79a7feae469 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 e5213713320..83c1b58a30d 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 b3853aa3d6f..6750a7ff4c6 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