1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +00:00

`kbdint-failure': we now offer keyboard-interactive auth to the user for as

long as the server offers it, rather than only once, unless the server responds
to our initial USERAUTH_REQUEST("keyboard-interactive") with FAILURE, in which
case we give up on it entirely.

[originally from svn r5068]
[this svn revision also touched putty-wishlist]
This commit is contained in:
Jacob Nevins 2005-01-06 13:23:47 +00:00
parent 77f029cf55
commit 297ee2573e

11
ssh.c
View File

@ -5921,8 +5921,8 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
AUTH_TYPE_KEYBOARD_INTERACTIVE_QUIET AUTH_TYPE_KEYBOARD_INTERACTIVE_QUIET
} type; } type;
int gotit, need_pw, can_pubkey, can_passwd, can_keyb_inter; int gotit, need_pw, can_pubkey, can_passwd, can_keyb_inter;
int tried_pubkey_config, tried_agent, tried_keyb_inter; int tried_pubkey_config, tried_agent;
int kbd_inter_running; int kbd_inter_running, kbd_inter_refused;
int we_are_in; int we_are_in;
int num_prompts, curr_prompt, echo; int num_prompts, curr_prompt, echo;
char username[100]; char username[100];
@ -6051,8 +6051,8 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
s->tried_pubkey_config = FALSE; s->tried_pubkey_config = FALSE;
s->tried_agent = FALSE; s->tried_agent = FALSE;
s->tried_keyb_inter = FALSE;
s->kbd_inter_running = FALSE; s->kbd_inter_running = FALSE;
s->kbd_inter_refused = FALSE;
/* Load the pub half of ssh->cfg.keyfile so we notice if it's in Pageant */ /* Load the pub half of ssh->cfg.keyfile so we notice if it's in Pageant */
if (!filename_is_null(ssh->cfg.keyfile)) { if (!filename_is_null(ssh->cfg.keyfile)) {
int keytype; int keytype;
@ -6443,10 +6443,9 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
} }
} }
if (!s->method && s->can_keyb_inter && !s->tried_keyb_inter) { if (!s->method && s->can_keyb_inter && !s->kbd_inter_refused) {
s->method = AUTH_KEYBOARD_INTERACTIVE; s->method = AUTH_KEYBOARD_INTERACTIVE;
s->type = AUTH_TYPE_KEYBOARD_INTERACTIVE; s->type = AUTH_TYPE_KEYBOARD_INTERACTIVE;
s->tried_keyb_inter = TRUE;
ssh->pkt_ctx &= ~SSH2_PKTCTX_AUTH_MASK; ssh->pkt_ctx &= ~SSH2_PKTCTX_AUTH_MASK;
ssh->pkt_ctx |= SSH2_PKTCTX_KBDINTER; ssh->pkt_ctx |= SSH2_PKTCTX_KBDINTER;
@ -6465,6 +6464,7 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
s->gotit = TRUE; s->gotit = TRUE;
logevent("Keyboard-interactive authentication refused"); logevent("Keyboard-interactive authentication refused");
s->type = AUTH_TYPE_KEYBOARD_INTERACTIVE_QUIET; s->type = AUTH_TYPE_KEYBOARD_INTERACTIVE_QUIET;
s->kbd_inter_refused = TRUE; /* don't try it again */
continue; continue;
} }
@ -6475,7 +6475,6 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
if (s->kbd_inter_running) { if (s->kbd_inter_running) {
s->method = AUTH_KEYBOARD_INTERACTIVE; s->method = AUTH_KEYBOARD_INTERACTIVE;
s->type = AUTH_TYPE_KEYBOARD_INTERACTIVE; s->type = AUTH_TYPE_KEYBOARD_INTERACTIVE;
s->tried_keyb_inter = TRUE;
ssh->pkt_ctx &= ~SSH2_PKTCTX_AUTH_MASK; ssh->pkt_ctx &= ~SSH2_PKTCTX_AUTH_MASK;
ssh->pkt_ctx |= SSH2_PKTCTX_KBDINTER; ssh->pkt_ctx |= SSH2_PKTCTX_KBDINTER;