]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/net/tramp.el (tramp-read-passwd): Use connection-local `auth-sources'.
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 7 Dec 2020 09:38:24 +0000 (10:38 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 7 Dec 2020 09:38:24 +0000 (10:38 +0100)
* 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
lisp/net/tramp-gvfs.el
lisp/net/tramp-sh.el
lisp/net/tramp-smb.el
lisp/net/tramp.el

index 4947d161f3fbfd9f0ee7403b28e2fd34d40951ef..f6e89339b68a0fbe1e0f17afc613a8281027512f 100644 (file)
@@ -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)))))))
 
index f3d03d0fb0ad53190a0407dea55626334cdaa0ed..c2028c4908cc48b92194b8745a66a532e2e59c71 100644 (file)
@@ -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)))))
index 137f0857f7edb7bd274c7fc007d832ac9e90ccee..79a7feae46954ac28eb51f76765298b9a480df80 100644 (file)
@@ -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
index e5213713320321e7da947a7fa78d21355128dca8..83c1b58a30dc459d928b0bb3ac57b792da7b3b31 100644 (file)
@@ -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))
 
index b3853aa3d6f72243697ab71ac5710519185c0ce0..6750a7ff4c656ca8da2621a8995fd4f6bd8a2615 100644 (file)
@@ -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