diff options
| author | Michael Albinus | 2018-05-02 18:12:48 +0200 |
|---|---|---|
| committer | Michael Albinus | 2018-05-02 18:12:48 +0200 |
| commit | a5246dc02b0572a611ac2169fa16962fc89926b9 (patch) | |
| tree | 18a2e40f884d53d08f19981737ac4893da441967 | |
| parent | 8ae7c424c409aa31fa52304752ba62d4b5a9a4d0 (diff) | |
| download | emacs-a5246dc02b0572a611ac2169fa16962fc89926b9.tar.gz emacs-a5246dc02b0572a611ac2169fa16962fc89926b9.zip | |
Adapt Tramp for auth-source
* lisp/net/tramp.el (tramp-read-passwd): auth-source could return
cascaded functions.
| -rw-r--r-- | lisp/net/tramp.el | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 5dda18f3a3b..e14a515b8bb 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -4472,8 +4472,8 @@ Invokes `password-read' if available, `read-passwd' else." | |||
| 4472 | 4472 | ||
| 4473 | (unwind-protect | 4473 | (unwind-protect |
| 4474 | (with-parsed-tramp-file-name key nil | 4474 | (with-parsed-tramp-file-name key nil |
| 4475 | (setq tramp-password-save-function nil) | 4475 | (setq tramp-password-save-function nil |
| 4476 | (setq user | 4476 | user |
| 4477 | (or user (tramp-get-connection-property key "login-as" nil))) | 4477 | (or user (tramp-get-connection-property key "login-as" nil))) |
| 4478 | (prog1 | 4478 | (prog1 |
| 4479 | (or | 4479 | (or |
| @@ -4501,18 +4501,21 @@ Invokes `password-read' if available, `read-passwd' else." | |||
| 4501 | :create t)) | 4501 | :create t)) |
| 4502 | tramp-password-save-function | 4502 | tramp-password-save-function |
| 4503 | (plist-get auth-info :save-function) | 4503 | (plist-get auth-info :save-function) |
| 4504 | auth-passwd (plist-get auth-info :secret) | 4504 | auth-passwd (plist-get auth-info :secret))) |
| 4505 | auth-passwd (if (functionp auth-passwd) | 4505 | (while (functionp auth-passwd) |
| 4506 | (funcall auth-passwd) | 4506 | (setq auth-passwd (funcall auth-passwd))) |
| 4507 | auth-passwd)))) | 4507 | auth-passwd) |
| 4508 | 4508 | ||
| 4509 | ;; Try the password cache. | 4509 | ;; Try the password cache. |
| 4510 | (let ((password (password-read pw-prompt key))) | 4510 | (progn |
| 4511 | (setq tramp-password-save-function | 4511 | (setq auth-passwd (password-read pw-prompt key) |
| 4512 | (lambda () (password-cache-add key password))) | 4512 | tramp-password-save-function |
| 4513 | password) | 4513 | (lambda () (password-cache-add key auth-passwd))) |
| 4514 | ;; Else, get the password interactively. | 4514 | auth-passwd) |
| 4515 | |||
| 4516 | ;; Else, get the password interactively w/o cache. | ||
| 4515 | (read-passwd pw-prompt)) | 4517 | (read-passwd pw-prompt)) |
| 4518 | |||
| 4516 | (tramp-set-connection-property v "first-password-request" nil))) | 4519 | (tramp-set-connection-property v "first-password-request" nil))) |
| 4517 | 4520 | ||
| 4518 | ;; Reenable the timers. | 4521 | ;; Reenable the timers. |