# HG changeset patch # User Michael Albinus # Date 1233485202 0 # Node ID adfc49512fc6a6103038215673c0ecd3c8586fc5 # Parent 0e77ae8c6b4584066d7d40370e8e65bce309bb4c * net/tramp.el (tramp-read-passwd): Cached passwords shall still be used. diff -r 0e77ae8c6b45 -r adfc49512fc6 lisp/net/tramp.el --- a/lisp/net/tramp.el Sun Feb 01 10:45:30 2009 +0000 +++ b/lisp/net/tramp.el Sun Feb 01 10:46:42 2009 +0000 @@ -3664,7 +3664,7 @@ (buffer-substring (point) (tramp-compat-line-end-position))))) (setq localname (concat uname fname)))) ;; There might be a double slash, for example when "~/" - ;; expands to "/". Remove this. + ;; expands to "/". Remove this. (while (string-match "//" localname) (setq localname (replace-match "/" t t localname))) ;; No tilde characters in file name, do normal @@ -7433,12 +7433,14 @@ (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)) + (when (functionp 'password-read) + (unless (tramp-get-connection-property + proc "first-password-request" nil) + (funcall (symbol-function 'password-cache-remove) key)) + (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))))