]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix cosmetic keyboard-interactive issue: at the end of a normal k-i session,
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Tue, 3 Mar 2009 19:57:58 +0000 (19:57 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Tue, 3 Mar 2009 19:57:58 +0000 (19:57 +0000)
some servers (Debian in particular seems prone to this) send a k-i packet with
no prompts and nothing to display. We were printing an extra "Using
keyboard-interactive authentication" message in this case. (Introduced by me
in r8172, I think.)

[originally from svn r8492]
[r8172 == 211fdb9f46377b0f3052c0a29f6934cce3dbfb02]

ssh.c

diff --git a/ssh.c b/ssh.c
index 92fadd0b4fb6fe98395ab76f00a52c3ec36d4d5a..e1740f1f2ee694ff9d7a484b050f0b2029dce4d5 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -8103,23 +8103,6 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
                    ssh_pkt_getstring(pktin, &lang, &lang_len);
                    s->cur_prompt = new_prompts(ssh->frontend);
                    s->cur_prompt->to_server = TRUE;
-                   if (name_len) {
-                       /* FIXME: better prefix to distinguish from
-                        * local prompts? */
-                       s->cur_prompt->name =
-                           dupprintf("SSH server: %.*s", name_len, name);
-                       s->cur_prompt->name_reqd = TRUE;
-                   } else {
-                       s->cur_prompt->name =
-                           dupstr("SSH server authentication");
-                       s->cur_prompt->name_reqd = FALSE;
-                   }
-                   /* FIXME: ugly to print "Using..." in prompt _every_
-                    * time round. Can this be done more subtly? */
-                   s->cur_prompt->instruction =
-                       dupprintf("Using keyboard-interactive authentication.%s%.*s",
-                                 inst_len ? "\n" : "", inst_len, inst);
-                   s->cur_prompt->instr_reqd = TRUE;
 
                    /*
                     * Get any prompt(s) from the packet.
@@ -8143,6 +8126,33 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
                                   echo, SSH_MAX_PASSWORD_LEN);
                    }
 
+                   if (name_len) {
+                       /* FIXME: better prefix to distinguish from
+                        * local prompts? */
+                       s->cur_prompt->name =
+                           dupprintf("SSH server: %.*s", name_len, name);
+                       s->cur_prompt->name_reqd = TRUE;
+                   } else {
+                       s->cur_prompt->name =
+                           dupstr("SSH server authentication");
+                       s->cur_prompt->name_reqd = FALSE;
+                   }
+                   /* We add a prefix to try to make it clear that a prompt
+                    * has come from the server.
+                    * FIXME: ugly to print "Using..." in prompt _every_
+                    * time round. Can this be done more subtly? */
+                   /* Special case: for reasons best known to themselves,
+                    * some servers send k-i requests with no prompts and
+                    * nothing to display. Keep quiet in this case. */
+                   if (s->num_prompts || name_len || inst_len) {
+                       s->cur_prompt->instruction =
+                           dupprintf("Using keyboard-interactive authentication.%s%.*s",
+                                     inst_len ? "\n" : "", inst_len, inst);
+                       s->cur_prompt->instr_reqd = TRUE;
+                   } else {
+                       s->cur_prompt->instr_reqd = FALSE;
+                   }
+
                    /*
                      * Display any instructions, and get the user's
                      * response(s).