|
|
@@ -127,6 +127,7 @@ static const struct PacketProtocolLayerVtable ssh2_userauth_vtable = {
|
|
|
ssh2_userauth_want_user_input,
|
|
|
ssh2_userauth_got_user_input,
|
|
|
ssh2_userauth_reconfigure,
|
|
|
+ ssh_ppl_default_queued_data_size,
|
|
|
"ssh-userauth",
|
|
|
};
|
|
|
|
|
|
@@ -484,7 +485,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
|
|
}
|
|
|
sfree(s->locally_allocated_username); /* for change_username */
|
|
|
s->username = s->locally_allocated_username =
|
|
|
- dupstr(s->cur_prompt->prompts[0]->result);
|
|
|
+ prompt_get_result(s->cur_prompt->prompts[0]);
|
|
|
free_prompts(s->cur_prompt);
|
|
|
} else {
|
|
|
if ((flags & FLAG_VERBOSE) || (flags & FLAG_INTERACTIVE))
|
|
|
@@ -553,9 +554,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
|
|
ptrlen data = bufchain_prefix(&s->banner);
|
|
|
seat_stderr_pl(s->ppl.seat, data);
|
|
|
display_banner(s->ppl.seat, data.ptr, data.len); // WINSCP
|
|
|
- bufchain_consume(&s->banner, data.len);
|
|
|
mid_line =
|
|
|
(((const char *)data.ptr)[data.len-1] != '\n');
|
|
|
+ bufchain_consume(&s->banner, data.len);
|
|
|
}
|
|
|
bufchain_clear(&s->banner);
|
|
|
|
|
|
@@ -665,7 +666,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
|
|
/*
|
|
|
* Save the methods string for use in error messages.
|
|
|
*/
|
|
|
- s->last_methods_string->len = 0;
|
|
|
+ strbuf_clear(s->last_methods_string);
|
|
|
put_datapl(s->last_methods_string, methods);
|
|
|
#ifdef WINSCP
|
|
|
ppl_logevent("Server offered these authentication methods: %s", s->last_methods_string->s);
|
|
|
@@ -835,7 +836,15 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
|
|
ppl_printf("Pageant failed to "
|
|
|
"provide a signature\r\n");
|
|
|
s->suppress_wait_for_response_packet = true;
|
|
|
+ ssh_free_pktout(s->pktout);
|
|
|
}
|
|
|
+ } else {
|
|
|
+ ppl_logevent("Pageant failed to respond to "
|
|
|
+ "signing request");
|
|
|
+ ppl_printf("Pageant failed to "
|
|
|
+ "respond to signing request\r\n");
|
|
|
+ s->suppress_wait_for_response_packet = true;
|
|
|
+ ssh_free_pktout(s->pktout);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -931,7 +940,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
|
|
return;
|
|
|
}
|
|
|
passphrase =
|
|
|
- dupstr(s->cur_prompt->prompts[0]->result);
|
|
|
+ prompt_get_result(s->cur_prompt->prompts[0]);
|
|
|
free_prompts(s->cur_prompt);
|
|
|
} else {
|
|
|
passphrase = NULL; /* no passphrase needed */
|
|
|
@@ -1392,6 +1401,8 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
|
|
}
|
|
|
if (sb->len)
|
|
|
s->cur_prompt->instruction = strbuf_to_str(sb);
|
|
|
+ else
|
|
|
+ strbuf_free(sb);
|
|
|
|
|
|
/*
|
|
|
* Our prompts_t is fully constructed now. Get the
|
|
|
@@ -1432,10 +1443,10 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
|
|
s->ppl.bpp, SSH2_MSG_USERAUTH_INFO_RESPONSE);
|
|
|
put_uint32(s->pktout, s->num_prompts);
|
|
|
{ // WINSCP
|
|
|
- uint32_t i;
|
|
|
- for (i=0; i < s->num_prompts; i++) {
|
|
|
- put_stringz(s->pktout,
|
|
|
- s->cur_prompt->prompts[i]->result);
|
|
|
+ uint32_t i; // WINSCP
|
|
|
+ for (i = 0; i < s->num_prompts; i++) {
|
|
|
+ put_stringz(s->pktout, prompt_get_result_ref(
|
|
|
+ s->cur_prompt->prompts[i]));
|
|
|
}
|
|
|
} // WINSCP
|
|
|
s->pktout->minlen = 256;
|
|
|
@@ -1528,7 +1539,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
|
|
* Squirrel away the password. (We may need it later if
|
|
|
* asked to change it.)
|
|
|
*/
|
|
|
- s->password = dupstr(s->cur_prompt->prompts[0]->result);
|
|
|
+ s->password = prompt_get_result(s->cur_prompt->prompts[0]);
|
|
|
free_prompts(s->cur_prompt);
|
|
|
|
|
|
/*
|
|
|
@@ -1659,20 +1670,20 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
|
|
* (A side effect is that the user doesn't have to
|
|
|
* re-enter it if they louse up the new password.)
|
|
|
*/
|
|
|
- if (s->cur_prompt->prompts[0]->result[0]) {
|
|
|
+ if (s->cur_prompt->prompts[0]->result->s[0]) {
|
|
|
smemclr(s->password, strlen(s->password));
|
|
|
/* burn the evidence */
|
|
|
sfree(s->password);
|
|
|
- s->password =
|
|
|
- dupstr(s->cur_prompt->prompts[0]->result);
|
|
|
+ s->password = prompt_get_result(
|
|
|
+ s->cur_prompt->prompts[0]);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
* Check the two new passwords match.
|
|
|
*/
|
|
|
- got_new = (strcmp(s->cur_prompt->prompts[1]->result,
|
|
|
- s->cur_prompt->prompts[2]->result)
|
|
|
- == 0);
|
|
|
+ got_new = !strcmp(
|
|
|
+ prompt_get_result_ref(s->cur_prompt->prompts[1]),
|
|
|
+ prompt_get_result_ref(s->cur_prompt->prompts[2]));
|
|
|
if (!got_new)
|
|
|
/* They don't. Silly user. */
|
|
|
ppl_printf("Passwords do not match\r\n");
|
|
|
@@ -1690,8 +1701,8 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
|
|
|
put_stringz(s->pktout, "password");
|
|
|
put_bool(s->pktout, true);
|
|
|
put_stringz(s->pktout, s->password);
|
|
|
- put_stringz(s->pktout,
|
|
|
- s->cur_prompt->prompts[1]->result);
|
|
|
+ put_stringz(s->pktout, prompt_get_result_ref(
|
|
|
+ s->cur_prompt->prompts[1]));
|
|
|
free_prompts(s->cur_prompt);
|
|
|
s->pktout->minlen = 256;
|
|
|
pq_push(s->ppl.out_pq, s->pktout);
|
|
|
@@ -1853,7 +1864,7 @@ static void ssh2_userauth_add_sigblob(
|
|
|
/* debug("modulus length is %d\n", len); */
|
|
|
/* debug("signature length is %d\n", siglen); */
|
|
|
|
|
|
- if (mod_mp.len != sig_mp.len) {
|
|
|
+ if (mod_mp.len > sig_mp.len) {
|
|
|
strbuf *substr = strbuf_new();
|
|
|
put_data(substr, sigblob.ptr, sig_prefix_len);
|
|
|
put_uint32(substr, mod_mp.len);
|