version 1.17.2.2, 2002/10/11 14:51:52 |
version 1.18, 2002/06/19 00:27:55 |
|
|
char *devices; |
char *devices; |
void *ctxt; |
void *ctxt; |
KbdintDevice *device; |
KbdintDevice *device; |
u_int nreq; |
|
}; |
}; |
|
|
static KbdintAuthctxt * |
static KbdintAuthctxt * |
|
|
debug("kbdint_alloc: devices '%s'", kbdintctxt->devices); |
debug("kbdint_alloc: devices '%s'", kbdintctxt->devices); |
kbdintctxt->ctxt = NULL; |
kbdintctxt->ctxt = NULL; |
kbdintctxt->device = NULL; |
kbdintctxt->device = NULL; |
kbdintctxt->nreq = 0; |
|
|
|
return kbdintctxt; |
return kbdintctxt; |
} |
} |
|
|
KbdintAuthctxt *kbdintctxt; |
KbdintAuthctxt *kbdintctxt; |
char *name, *instr, **prompts; |
char *name, *instr, **prompts; |
int i; |
int i; |
u_int *echo_on; |
u_int numprompts, *echo_on; |
|
|
kbdintctxt = authctxt->kbdintctxt; |
kbdintctxt = authctxt->kbdintctxt; |
if (kbdintctxt->device->query(kbdintctxt->ctxt, |
if (kbdintctxt->device->query(kbdintctxt->ctxt, |
&name, &instr, &kbdintctxt->nreq, &prompts, &echo_on)) |
&name, &instr, &numprompts, &prompts, &echo_on)) |
return 0; |
return 0; |
|
|
packet_start(SSH2_MSG_USERAUTH_INFO_REQUEST); |
packet_start(SSH2_MSG_USERAUTH_INFO_REQUEST); |
packet_put_cstring(name); |
packet_put_cstring(name); |
packet_put_cstring(instr); |
packet_put_cstring(instr); |
packet_put_cstring(""); /* language not used */ |
packet_put_cstring(""); /* language not used */ |
packet_put_int(kbdintctxt->nreq); |
packet_put_int(numprompts); |
for (i = 0; i < kbdintctxt->nreq; i++) { |
for (i = 0; i < numprompts; i++) { |
packet_put_cstring(prompts[i]); |
packet_put_cstring(prompts[i]); |
packet_put_char(echo_on[i]); |
packet_put_char(echo_on[i]); |
} |
} |
packet_send(); |
packet_send(); |
packet_write_wait(); |
packet_write_wait(); |
|
|
for (i = 0; i < kbdintctxt->nreq; i++) |
for (i = 0; i < numprompts; i++) |
xfree(prompts[i]); |
xfree(prompts[i]); |
xfree(prompts); |
xfree(prompts); |
xfree(echo_on); |
xfree(echo_on); |
|
|
|
|
authctxt->postponed = 0; /* reset */ |
authctxt->postponed = 0; /* reset */ |
nresp = packet_get_int(); |
nresp = packet_get_int(); |
if (nresp != kbdintctxt->nreq) |
|
fatal("input_userauth_info_response: wrong number of replies"); |
|
if (nresp > 100) |
|
fatal("input_userauth_info_response: too many replies"); |
|
if (nresp > 0) { |
if (nresp > 0) { |
response = xmalloc(nresp * sizeof(char *)); |
response = xmalloc(nresp * sizeof(char*)); |
for (i = 0; i < nresp; i++) |
for (i = 0; i < nresp; i++) |
response[i] = packet_get_string(NULL); |
response[i] = packet_get_string(NULL); |
} |
} |