mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Make {term,}get_userpass_input take a bufchain.
NFC for the moment, because the bufchain is always specially constructed to hold exactly the same data that would have been passed in to the function as a (pointer,length) pair. But this API change allows get_userpass_input to express the idea that it consumed some but not all of the data in the bufchain, which means that later on I'll be able to point the same function at a longer-lived bufchain containing the full stream of keyboard input and avoid dropping keystrokes that arrive too quickly after the end of an interactive password prompt.
This commit is contained in:
11
terminal.c
11
terminal.c
@ -6718,8 +6718,7 @@ struct term_userpass_state {
|
||||
* Process some terminal data in the course of username/password
|
||||
* input.
|
||||
*/
|
||||
int term_get_userpass_input(Terminal *term, prompts_t *p,
|
||||
const unsigned char *in, int inlen)
|
||||
int term_get_userpass_input(Terminal *term, prompts_t *p, bufchain *input)
|
||||
{
|
||||
struct term_userpass_state *s = (struct term_userpass_state *)p->data;
|
||||
if (!s) {
|
||||
@ -6766,12 +6765,12 @@ int term_get_userpass_input(Terminal *term, prompts_t *p,
|
||||
|
||||
/* Breaking out here ensures that the prompt is printed even
|
||||
* if we're now waiting for user data. */
|
||||
if (!in || !inlen) break;
|
||||
if (!input || !bufchain_size(input)) break;
|
||||
|
||||
/* FIXME: should we be using local-line-editing code instead? */
|
||||
while (!finished_prompt && inlen) {
|
||||
char c = *in++;
|
||||
inlen--;
|
||||
while (!finished_prompt && bufchain_size(input) > 0) {
|
||||
char c;
|
||||
bufchain_fetch_consume(input, &c, 1);
|
||||
switch (c) {
|
||||
case 10:
|
||||
case 13:
|
||||
|
Reference in New Issue
Block a user