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

Diff for /src/usr.bin/ssh/ssh-keyscan.c between version 1.109 and 1.110

version 1.109, 2017/03/10 04:26:06 version 1.110, 2017/04/30 23:10:43
Line 169 
Line 169 
         return (tok);          return (tok);
 }  }
   
 #ifdef WITH_SSH1  
 static struct sshkey *  
 keygrab_ssh1(con *c)  
 {  
         static struct sshkey *rsa;  
         static struct sshbuf *msg;  
         int r;  
         u_char type;  
   
         if (rsa == NULL) {  
                 if ((rsa = sshkey_new(KEY_RSA1)) == NULL) {  
                         error("%s: sshkey_new failed", __func__);  
                         return NULL;  
                 }  
                 if ((msg = sshbuf_new()) == NULL)  
                         fatal("%s: sshbuf_new failed", __func__);  
         }  
         if ((r = sshbuf_put(msg, c->c_data, c->c_plen)) != 0 ||  
             (r = sshbuf_consume(msg, 8 - (c->c_plen & 7))) != 0 || /* padding */  
             (r = sshbuf_get_u8(msg, &type)) != 0)  
                 goto buf_err;  
         if (type != (int) SSH_SMSG_PUBLIC_KEY) {  
                 error("%s: invalid packet type", c->c_name);  
                 sshbuf_reset(msg);  
                 return NULL;  
         }  
         if ((r = sshbuf_consume(msg, 8)) != 0 || /* cookie */  
             /* server key */  
             (r = sshbuf_get_u32(msg, NULL)) != 0 ||  
             (r = sshbuf_get_bignum1(msg, NULL)) != 0 ||  
             (r = sshbuf_get_bignum1(msg, NULL)) != 0 ||  
             /* host key */  
             (r = sshbuf_get_u32(msg, NULL)) != 0 ||  
             (r = sshbuf_get_bignum1(msg, rsa->rsa->e)) != 0 ||  
             (r = sshbuf_get_bignum1(msg, rsa->rsa->n)) != 0) {  
  buf_err:  
                 error("%s: buffer error: %s", __func__, ssh_err(r));  
                 sshbuf_reset(msg);  
                 return NULL;  
         }  
   
         sshbuf_reset(msg);  
   
         return (rsa);  
 }  
 #endif  
   
 static int  static int
 key_print_wrapper(struct sshkey *hostkey, struct ssh *ssh)  key_print_wrapper(struct sshkey *hostkey, struct ssh *ssh)
 {  {
Line 565 
Line 519 
                         c->c_data = xmalloc(c->c_len);                          c->c_data = xmalloc(c->c_len);
                         c->c_status = CS_KEYS;                          c->c_status = CS_KEYS;
                         break;                          break;
 #ifdef WITH_SSH1  
                 case CS_KEYS:  
                         keyprint(c, keygrab_ssh1(c));  
                         confree(s);  
                         return;  
 #endif  
                 default:                  default:
                         fatal("conread: invalid status %d", c->c_status);                          fatal("conread: invalid status %d", c->c_status);
                         break;                          break;
Line 734 
Line 682 
                                 int type = sshkey_type_from_name(tname);                                  int type = sshkey_type_from_name(tname);
   
                                 switch (type) {                                  switch (type) {
 #ifdef WITH_SSH1  
                                 case KEY_RSA1:  
                                         get_keytypes |= KT_RSA1;  
                                         break;  
 #endif  
                                 case KEY_DSA:                                  case KEY_DSA:
                                         get_keytypes |= KT_DSA;                                          get_keytypes |= KT_DSA;
                                         break;                                          break;

Legend:
Removed from v.1.109  
changed lines
  Added in v.1.110