aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2008-05-15 21:06:59 +0000
committerMichael Albinus2008-05-15 21:06:59 +0000
commit5615d63facc03d694c9195eb8fddbb9939ae1694 (patch)
tree8450c92a2f3e723e2c3562f567fa4192497f4a98
parent67525fb9172460a5f1daa39b9cd7271ab29b67e0 (diff)
downloademacs-5615d63facc03d694c9195eb8fddbb9939ae1694.tar.gz
emacs-5615d63facc03d694c9195eb8fddbb9939ae1694.zip
* net/tramp.el: Load auth-source library.
(tramp-read-passwd): Use it for password, not login. (tramp-file-name-for-operation): Add `make-temp-name'.
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/net/tramp.el31
2 files changed, 33 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bec5c389e1c..75f578eb51c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12008-05-15 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-file-name-for-operation): Add `make-temp-name'.
4
52008-05-15 Teodor Zlatanov <tzz@lifelogs.com>
6
7 * net/tramp.el: Load auth-source library.
8 (tramp-read-passwd): Use it for password, not login.
9
12008-05-15 Shigeru Fukaya <shugeru.fukaya@gmail.com> 102008-05-15 Shigeru Fukaya <shugeru.fukaya@gmail.com>
2 11
3 * ses.el (ses-goto-print): Use move-to-column rather than 12 * ses.el (ses-goto-print): Use move-to-column rather than
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 9894c27a839..723eba0a93b 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -87,6 +87,10 @@
87(require 'shell) 87(require 'shell)
88(require 'advice) 88(require 'advice)
89 89
90(if (featurep 'xemacs)
91 (load "auth-source" 'noerror)
92 (require 'auth-source nil 'noerror))
93
90;; Requiring 'tramp-cache results in an endless loop. 94;; Requiring 'tramp-cache results in an endless loop.
91(autoload 'tramp-get-file-property "tramp-cache") 95(autoload 'tramp-get-file-property "tramp-cache")
92(autoload 'tramp-set-file-property "tramp-cache") 96(autoload 'tramp-set-file-property "tramp-cache")
@@ -4425,7 +4429,7 @@ ARGS are the arguments OPERATION has been called with."
4425 'dired-file-modtime 'dired-make-compressed-filename 4429 'dired-file-modtime 'dired-make-compressed-filename
4426 'dired-recursive-delete-directory 'dired-set-file-modtime 4430 'dired-recursive-delete-directory 'dired-set-file-modtime
4427 'dired-shell-unhandle-file-name 'dired-uucode-file 4431 'dired-shell-unhandle-file-name 'dired-uucode-file
4428 'insert-file-contents-literally 'recover-file 4432 'insert-file-contents-literally 'make-temp-name 'recover-file
4429 'vm-imap-check-mail 'vm-pop-check-mail 'vm-spool-check-mail)) 4433 'vm-imap-check-mail 'vm-pop-check-mail 'vm-spool-check-mail))
4430 (if (file-name-absolute-p (nth 0 args)) 4434 (if (file-name-absolute-p (nth 0 args))
4431 (nth 0 args) 4435 (nth 0 args)
@@ -7200,6 +7204,7 @@ ALIST is of the form ((FROM . TO) ...)."
7200 7204
7201(defun tramp-read-passwd (proc &optional prompt) 7205(defun tramp-read-passwd (proc &optional prompt)
7202 "Read a password from user (compat function). 7206 "Read a password from user (compat function).
7207Consults the auth-source package.
7203Invokes `password-read' if available, `read-passwd' else." 7208Invokes `password-read' if available, `read-passwd' else."
7204 (let* ((key (tramp-make-tramp-file-name 7209 (let* ((key (tramp-make-tramp-file-name
7205 tramp-current-method tramp-current-user 7210 tramp-current-method tramp-current-user
@@ -7209,12 +7214,24 @@ Invokes `password-read' if available, `read-passwd' else."
7209 (with-current-buffer (process-buffer proc) 7214 (with-current-buffer (process-buffer proc)
7210 (tramp-check-for-regexp proc tramp-password-prompt-regexp) 7215 (tramp-check-for-regexp proc tramp-password-prompt-regexp)
7211 (format "%s for %s " (capitalize (match-string 1)) key))))) 7216 (format "%s for %s " (capitalize (match-string 1)) key)))))
7212 (if (functionp 'password-read) 7217
7213 (let ((password (funcall (symbol-function 'password-read) 7218 (or
7214 pw-prompt key))) 7219 ;; see if auth-sources contains something useful, if it's bound
7215 (funcall (symbol-function 'password-cache-add) key password) 7220 (when (boundp 'auth-sources)
7216 password) 7221 (or
7217 (read-passwd pw-prompt)))) 7222 ;; 1. try with Tramp's current method
7223 (auth-source-user-or-password
7224 "password" tramp-current-host tramp-current-method)
7225 ;; 2. hard-code the method to be "tramp"
7226 (auth-source-user-or-password
7227 "password" tramp-current-host "tramp")))
7228 ;; 3. else, get the password interactively
7229 (if (functionp 'password-read)
7230 (let ((password (funcall (symbol-function 'password-read)
7231 pw-prompt key)))
7232 (funcall (symbol-function 'password-cache-add) key password)
7233 password)
7234 (read-passwd pw-prompt)))))
7218 7235
7219(defun tramp-clear-passwd (vec) 7236(defun tramp-clear-passwd (vec)
7220 "Clear password cache for connection related to VEC." 7237 "Clear password cache for connection related to VEC."