Subject: bug#19047: Acknowledgement (Tramp reuses bad ssh passphrase several times without asking)

From: Stephane Chauveau <[email-masked]>
Date: Thu, 13 Nov 2014 20:37:24 +0100

I am not an elisp nor a tramp expert but after looking at tramp.el I
believe that the problem is that OpenSSH is silent when a bad passphrase
is given.

A typical OpenSSH session with bad passphrase and passwords is

Enter passphrase for key '/home/chauveau/.ssh/id_rsa':
Enter passphrase for key '/home/chauveau/.ssh/id_rsa':
Enter passphrase for key '/home/chauveau/.ssh/id_rsa':
chauveau@hobb's password:
Permission denied, please try again.
chauveau@hobb's password:
Permission denied, please try again.
chauveau@hobb's password:
Permission denied (publickey,password).

In function tramp-action-password, some codes were added to clear the
'wrong' password:

 ;; Let's check whether a wrong password has been sent already.
 ;; Sometimes, the process returns a new password request
 ;; immediately after rejecting the previous (wrong) one.
 (goto-char (point-min))
 (when (search-forward-regexp tramp-wrong-passwd-regexp nil t)
   (tramp-clear-passwd vec))

That code probably does not work because there is nothing to match with
tramp-password-prompt-regexp after the Enter passphrase prompt.