diff options
| author | Michael Albinus | 2016-11-29 15:51:38 +0100 |
|---|---|---|
| committer | Michael Albinus | 2016-11-29 15:51:38 +0100 |
| commit | bb4212d10b7023bb52d3acd141f785b75ffa2f2c (patch) | |
| tree | 3095aecfc14d6de0e3bc41bcb9c43bedfb8d8b25 | |
| parent | e42b964c1246562a7c2345e528bd0a2fe5448015 (diff) | |
| download | emacs-bb4212d10b7023bb52d3acd141f785b75ffa2f2c.tar.gz emacs-bb4212d10b7023bb52d3acd141f785b75ffa2f2c.zip | |
Improve user retrieval from auth-source in Tramp
* lisp/net/tramp.el (tramp-read-passwd, tramp-clear-passwd):
Use user for auth-source request only in case it exists.
| -rw-r--r-- | lisp/net/tramp.el | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 52a4be863c7..af08cf7e13a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -4218,7 +4218,8 @@ Invokes `password-read' if available, `read-passwd' else." | |||
| 4218 | (setq auth-info | 4218 | (setq auth-info |
| 4219 | (auth-source-search | 4219 | (auth-source-search |
| 4220 | :max 1 | 4220 | :max 1 |
| 4221 | :user (or tramp-current-user t) | 4221 | (and tramp-current-user :user) |
| 4222 | tramp-current-user | ||
| 4222 | :host tramp-current-host | 4223 | :host tramp-current-host |
| 4223 | :port tramp-current-method | 4224 | :port tramp-current-method |
| 4224 | :require | 4225 | :require |
| @@ -4262,7 +4263,7 @@ Invokes `password-read' if available, `read-passwd' else." | |||
| 4262 | ;; since Emacs 24.1, it has been replaced by `auth-source-forget'. | 4263 | ;; since Emacs 24.1, it has been replaced by `auth-source-forget'. |
| 4263 | (if (fboundp 'auth-source-forget) | 4264 | (if (fboundp 'auth-source-forget) |
| 4264 | (auth-source-forget | 4265 | (auth-source-forget |
| 4265 | `(:max 1 :user ,(or user t) :host ,host :port ,method)) | 4266 | `(:max 1 ,(and user :user) ,user :host ,host :port ,method)) |
| 4266 | (tramp-compat-funcall | 4267 | (tramp-compat-funcall |
| 4267 | 'auth-source-forget-user-or-password "password" host method)) | 4268 | 'auth-source-forget-user-or-password "password" host method)) |
| 4268 | (password-cache-remove (tramp-make-tramp-file-name method user host "")))) | 4269 | (password-cache-remove (tramp-make-tramp-file-name method user host "")))) |