[BACK]Return to auth2-chall.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/auth2-chall.c between version 1.53 and 1.54

version 1.53, 2020/02/26 13:40:09 version 1.54, 2020/10/18 11:32:01
Line 73 
Line 73 
         kbdintctxt = xcalloc(1, sizeof(KbdintAuthctxt));          kbdintctxt = xcalloc(1, sizeof(KbdintAuthctxt));
         if (strcmp(devs, "") == 0) {          if (strcmp(devs, "") == 0) {
                 if ((b = sshbuf_new()) == NULL)                  if ((b = sshbuf_new()) == NULL)
                         fatal("%s: sshbuf_new failed", __func__);                          fatal_f("sshbuf_new failed");
                 for (i = 0; devices[i]; i++) {                  for (i = 0; devices[i]; i++) {
                         if ((r = sshbuf_putf(b, "%s%s",                          if ((r = sshbuf_putf(b, "%s%s",
                             sshbuf_len(b) ? "," : "", devices[i]->name)) != 0)                              sshbuf_len(b) ? "," : "", devices[i]->name)) != 0)
                                 fatal("%s: buffer error: %s",                                  fatal_fr(r, "buffer error");
                                     __func__, ssh_err(r));  
                 }                  }
                 if ((kbdintctxt->devices = sshbuf_dup_string(b)) == NULL)                  if ((kbdintctxt->devices = sshbuf_dup_string(b)) == NULL)
                         fatal("%s: sshbuf_dup_string failed", __func__);                          fatal_f("sshbuf_dup_string failed");
                 sshbuf_free(b);                  sshbuf_free(b);
         } else {          } else {
                 kbdintctxt->devices = xstrdup(devs);                  kbdintctxt->devices = xstrdup(devs);
Line 229 
Line 228 
             (r = sshpkt_put_cstring(ssh, instr)) != 0 ||              (r = sshpkt_put_cstring(ssh, instr)) != 0 ||
             (r = sshpkt_put_cstring(ssh, "")) != 0 ||   /* language not used */              (r = sshpkt_put_cstring(ssh, "")) != 0 ||   /* language not used */
             (r = sshpkt_put_u32(ssh, kbdintctxt->nreq)) != 0)              (r = sshpkt_put_u32(ssh, kbdintctxt->nreq)) != 0)
                 fatal("%s: %s", __func__, ssh_err(r));                  fatal_fr(r, "start packet");
         for (i = 0; i < kbdintctxt->nreq; i++) {          for (i = 0; i < kbdintctxt->nreq; i++) {
                 if ((r = sshpkt_put_cstring(ssh, prompts[i])) != 0 ||                  if ((r = sshpkt_put_cstring(ssh, prompts[i])) != 0 ||
                     (r = sshpkt_put_u8(ssh, echo_on[i])) != 0)                      (r = sshpkt_put_u8(ssh, echo_on[i])) != 0)
                         fatal("%s: %s", __func__, ssh_err(r));                          fatal_fr(r, "assemble packet");
         }          }
         if ((r = sshpkt_send(ssh)) != 0 ||          if ((r = sshpkt_send(ssh)) != 0 ||
             (r = ssh_packet_write_wait(ssh)) != 0)              (r = ssh_packet_write_wait(ssh)) != 0)
                 fatal("%s: %s", __func__, ssh_err(r));                  fatal_fr(r, "send packet");
   
         for (i = 0; i < kbdintctxt->nreq; i++)          for (i = 0; i < kbdintctxt->nreq; i++)
                 free(prompts[i]);                  free(prompts[i]);
Line 260 
Line 259 
         char **response = NULL;          char **response = NULL;
   
         if (authctxt == NULL)          if (authctxt == NULL)
                 fatal("input_userauth_info_response: no authctxt");                  fatal_f("no authctxt");
         kbdintctxt = authctxt->kbdintctxt;          kbdintctxt = authctxt->kbdintctxt;
         if (kbdintctxt == NULL || kbdintctxt->ctxt == NULL)          if (kbdintctxt == NULL || kbdintctxt->ctxt == NULL)
                 fatal("input_userauth_info_response: no kbdintctxt");                  fatal_f("no kbdintctxt");
         if (kbdintctxt->device == NULL)          if (kbdintctxt->device == NULL)
                 fatal("input_userauth_info_response: no device");                  fatal_f("no device");
   
         authctxt->postponed = 0;        /* reset */          authctxt->postponed = 0;        /* reset */
         if ((r = sshpkt_get_u32(ssh, &nresp)) != 0)          if ((r = sshpkt_get_u32(ssh, &nresp)) != 0)
                 fatal("%s: %s", __func__, ssh_err(r));                  fatal_fr(r, "parse packet");
         if (nresp != kbdintctxt->nreq)          if (nresp != kbdintctxt->nreq)
                 fatal("input_userauth_info_response: wrong number of replies");                  fatal_f("wrong number of replies");
         if (nresp > 100)          if (nresp > 100)
                 fatal("input_userauth_info_response: too many replies");                  fatal_f("too many replies");
         if (nresp > 0) {          if (nresp > 0) {
                 response = xcalloc(nresp, sizeof(char *));                  response = xcalloc(nresp, sizeof(char *));
                 for (i = 0; i < nresp; i++)                  for (i = 0; i < nresp; i++) {
                         if ((r = sshpkt_get_cstring(ssh, &response[i],                          if ((r = sshpkt_get_cstring(ssh, &response[i], NULL)) != 0)
                             NULL)) != 0)                                  fatal_fr(r, "parse response");
                                 fatal("%s: %s", __func__, ssh_err(r));                  }
         }          }
         if ((r = sshpkt_get_end(ssh)) != 0)          if ((r = sshpkt_get_end(ssh)) != 0)
                 fatal("%s: %s", __func__, ssh_err(r));                  fatal_fr(r, "parse packet");
   
         res = kbdintctxt->device->respond(kbdintctxt->ctxt, nresp, response);          res = kbdintctxt->device->respond(kbdintctxt->ctxt, nresp, response);
   

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54