Mercurial > emacs
comparison lisp/net/tramp.el @ 101656:287ee0c13903
* net/tramp.el (tramp-process-actions, tramp-read-passwd): Allow
correction of passwords.
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Thu, 29 Jan 2009 16:22:58 +0000 |
parents | 986acdda4aac |
children | adfc49512fc6 |
comparison
equal
deleted
inserted
replaced
101655:22f27f5cbe39 | 101656:287ee0c13903 |
---|---|
5795 (setq found (funcall action proc vec))))) | 5795 (setq found (funcall action proc vec))))) |
5796 found)) | 5796 found)) |
5797 | 5797 |
5798 (defun tramp-process-actions (proc vec actions &optional timeout) | 5798 (defun tramp-process-actions (proc vec actions &optional timeout) |
5799 "Perform actions until success or TIMEOUT." | 5799 "Perform actions until success or TIMEOUT." |
5800 ;; Enable auth-sorce and password-cache. | |
5801 (tramp-set-connection-property proc "first-password-request" t) | |
5800 (let (exit) | 5802 (let (exit) |
5801 (while (not exit) | 5803 (while (not exit) |
5802 (tramp-message proc 3 "Waiting for prompts from remote shell") | 5804 (tramp-message proc 3 "Waiting for prompts from remote shell") |
5803 (setq exit | 5805 (setq exit |
5804 (catch 'tramp-action | 5806 (catch 'tramp-action |
7420 (pw-prompt | 7422 (pw-prompt |
7421 (or prompt | 7423 (or prompt |
7422 (with-current-buffer (process-buffer proc) | 7424 (with-current-buffer (process-buffer proc) |
7423 (tramp-check-for-regexp proc tramp-password-prompt-regexp) | 7425 (tramp-check-for-regexp proc tramp-password-prompt-regexp) |
7424 (format "%s for %s " (capitalize (match-string 1)) key))))) | 7426 (format "%s for %s " (capitalize (match-string 1)) key))))) |
7425 | 7427 (prog1 |
7426 (or | 7428 (or |
7427 ;; See if auth-sources contains something useful, if it's bound. | 7429 ;; See if auth-sources contains something useful, if it's bound. |
7428 (when (boundp 'auth-sources) | 7430 (and (boundp 'auth-sources) |
7429 ;; Try with Tramp's current method. | 7431 (tramp-get-connection-property proc "first-password-request" nil) |
7430 (funcall (symbol-function 'auth-source-user-or-password) | 7432 ;; Try with Tramp's current method. |
7431 "password" tramp-current-host tramp-current-method)) | 7433 (funcall (symbol-function 'auth-source-user-or-password) |
7432 ;; Else, get the password interactively. | 7434 "password" tramp-current-host tramp-current-method)) |
7433 (if (functionp 'password-read) | 7435 ;; Try the password cache. |
7434 (let ((password (funcall (symbol-function 'password-read) | 7436 (and (functionp 'password-read) |
7435 pw-prompt key))) | 7437 (tramp-get-connection-property proc "first-password-request" nil) |
7436 (funcall (symbol-function 'password-cache-add) key password) | 7438 (let ((password (funcall (symbol-function 'password-read) |
7437 password) | 7439 pw-prompt key))) |
7438 (read-passwd pw-prompt))))) | 7440 (funcall (symbol-function 'password-cache-add) key password) |
7441 password)) | |
7442 ;; Else, get the password interactively. | |
7443 (read-passwd pw-prompt)) | |
7444 (tramp-set-connection-property proc "first-password-request" nil)))) | |
7439 | 7445 |
7440 (defun tramp-clear-passwd (vec) | 7446 (defun tramp-clear-passwd (vec) |
7441 "Clear password cache for connection related to VEC." | 7447 "Clear password cache for connection related to VEC." |
7442 (when (functionp 'password-cache-remove) | 7448 (when (functionp 'password-cache-remove) |
7443 (funcall | 7449 (funcall |
7662 ;; * Don't use globbing for directories with many files, as this is | 7668 ;; * Don't use globbing for directories with many files, as this is |
7663 ;; likely to produce long command lines, and some shells choke on | 7669 ;; likely to produce long command lines, and some shells choke on |
7664 ;; long command lines. | 7670 ;; long command lines. |
7665 ;; * `vc-directory' does not work. It never displays any files, even | 7671 ;; * `vc-directory' does not work. It never displays any files, even |
7666 ;; if it does show files when run locally. | 7672 ;; if it does show files when run locally. |
7667 ;; * Allow correction of passwords, if the remote end allows this. | |
7668 ;; (Mark Hershberger) | |
7669 ;; * How to deal with MULE in `insert-file-contents' and `write-region'? | 7673 ;; * How to deal with MULE in `insert-file-contents' and `write-region'? |
7670 ;; * Grok `append' parameter for `write-region'. | 7674 ;; * Grok `append' parameter for `write-region'. |
7671 ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'? | 7675 ;; * Test remote ksh or bash for tilde expansion in `tramp-find-shell'? |
7672 ;; * abbreviate-file-name | 7676 ;; * abbreviate-file-name |
7673 ;; * better error checking. At least whenever we see something | 7677 ;; * better error checking. At least whenever we see something |