From: Michael Albinus Date: Thu, 29 Jan 2009 16:26:53 +0000 (+0000) Subject: * net/tramp.el (tramp-process-actions, tramp-read-passwd): Allow X-Git-Tag: emacs-pretest-23.0.90~74 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5c7043a24839398e73bf783fdb430cd266083dee;p=emacs.git * net/tramp.el (tramp-process-actions, tramp-read-passwd): Allow correction of passwords. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index be0878c81a9..fe7441cf11b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2009-01-29 Michael Albinus + + * net/tramp.el (tramp-process-actions, tramp-read-passwd): Allow + correction of passwords. + 2009-01-29 Chong Yidong * mail/rmail.el (rmail-toggle-header): Determine current header diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 5814810dd53..e222a01a273 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -5797,6 +5797,8 @@ The terminal type can be configured with `tramp-terminal-type'." (defun tramp-process-actions (proc vec actions &optional timeout) "Perform actions until success or TIMEOUT." + ;; Enable auth-sorce and password-cache. + (tramp-set-connection-property proc "first-password-request" t) (let (exit) (while (not exit) (tramp-message proc 3 "Waiting for prompts from remote shell") @@ -7422,20 +7424,24 @@ Invokes `password-read' if available, `read-passwd' else." (with-current-buffer (process-buffer proc) (tramp-check-for-regexp proc tramp-password-prompt-regexp) (format "%s for %s " (capitalize (match-string 1)) key))))) - - (or - ;; See if auth-sources contains something useful, if it's bound. - (when (boundp 'auth-sources) - ;; Try with Tramp's current method. - (funcall (symbol-function 'auth-source-user-or-password) - "password" tramp-current-host tramp-current-method)) - ;; Else, get the password interactively. - (if (functionp 'password-read) - (let ((password (funcall (symbol-function 'password-read) - pw-prompt key))) - (funcall (symbol-function 'password-cache-add) key password) - password) - (read-passwd pw-prompt))))) + (prog1 + (or + ;; See if auth-sources contains something useful, if it's bound. + (and (boundp 'auth-sources) + (tramp-get-connection-property proc "first-password-request" nil) + ;; Try with Tramp's current method. + (funcall (symbol-function 'auth-source-user-or-password) + "password" tramp-current-host tramp-current-method)) + ;; Try the password cache. + (and (functionp 'password-read) + (tramp-get-connection-property proc "first-password-request" nil) + (let ((password (funcall (symbol-function 'password-read) + pw-prompt key))) + (funcall (symbol-function 'password-cache-add) key password) + password)) + ;; Else, get the password interactively. + (read-passwd pw-prompt)) + (tramp-set-connection-property proc "first-password-request" nil)))) (defun tramp-clear-passwd (vec) "Clear password cache for connection related to VEC." @@ -7664,8 +7670,6 @@ Only works for Bourne-like shells." ;; long command lines. ;; * `vc-directory' does not work. It never displays any files, even ;; if it does show files when run locally. -;; * Allow correction of passwords, if the remote end allows this. -;; (Mark Hershberger) ;; * How to deal with MULE in `insert-file-contents' and `write-region'? ;; * Grok `append' parameter for `write-region'. ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'?