From 854caca579339f69e71613fc2778f6f777e7271e Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 10 Aug 2010 18:45:51 +0000 Subject: [PATCH] When we disconnect because we have no supported authentication methods left to try, it's nice to have the version of that message going to the client contain the list of methods sent by the server. Saves a user having to pull it out of an SSH packet log. git-svn-id: svn://svn.tartarus.org/sgt/putty@8981 cda61777-01e9-0310-a592-d414129be87e --- ssh.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ssh.c b/ssh.c index 56ef7046..43d642dd 100644 --- a/ssh.c +++ b/ssh.c @@ -7538,6 +7538,9 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, } while (1) { + char *methods = NULL; + int methlen = 0; + /* * Wait for the result of the last authentication request. */ @@ -7587,8 +7590,6 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, * helpfully try next. */ if (pktin->type == SSH2_MSG_USERAUTH_FAILURE) { - char *methods; - int methlen; ssh_pkt_getstring(pktin, &methods, &methlen); if (!ssh2_pkt_getbool(pktin)) { /* @@ -8552,11 +8553,16 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen, sfree(s->password); } else { + char *str = dupprintf("No supported authentication methods available" + " (server sent: %.*s)", + methlen, methods); - ssh_disconnect(ssh, NULL, + ssh_disconnect(ssh, str, "No supported authentication methods available", SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE, FALSE); + sfree(str); + crStopV; } -- 2.11.0