ssh-keyscan.c (181110) | ssh-keyscan.c (181111) |
---|---|
1/* $OpenBSD: ssh-keyscan.c,v 1.74 2006/10/06 02:29:19 djm Exp $ */ | 1/* $OpenBSD: ssh-keyscan.c,v 1.76 2008/04/30 10:14:03 djm Exp $ */ |
2/* 3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. 4 * 5 * Modification and redistribution in source and binary forms is 6 * permitted provided that due credit is given to the author and the 7 * OpenBSD project by leaving this copyright notice intact. 8 */ 9 --- 41 unchanged lines hidden (view full) --- 51int IPv4or6 = AF_UNSPEC; 52 53int ssh_port = SSH_DEFAULT_PORT; 54 55#define KT_RSA1 1 56#define KT_DSA 2 57#define KT_RSA 4 58 | 2/* 3 * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. 4 * 5 * Modification and redistribution in source and binary forms is 6 * permitted provided that due credit is given to the author and the 7 * OpenBSD project by leaving this copyright notice intact. 8 */ 9 --- 41 unchanged lines hidden (view full) --- 51int IPv4or6 = AF_UNSPEC; 52 53int ssh_port = SSH_DEFAULT_PORT; 54 55#define KT_RSA1 1 56#define KT_DSA 2 57#define KT_RSA 4 58 |
59int get_keytypes = KT_RSA1; /* Get only RSA1 keys by default */ | 59int get_keytypes = KT_RSA; /* Get only RSA keys by default */ |
60 61int hash_hosts = 0; /* Hash hostname on output */ 62 63#define MAXMAXFD 256 64 65/* The number of seconds after which to give up on a TCP connection */ 66int timeout = 5; 67 --- 337 unchanged lines hidden (view full) --- 405 char strport[NI_MAXSERV]; 406 int gaierr, s = -1; 407 408 snprintf(strport, sizeof strport, "%d", ssh_port); 409 memset(&hints, 0, sizeof(hints)); 410 hints.ai_family = IPv4or6; 411 hints.ai_socktype = SOCK_STREAM; 412 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) | 60 61int hash_hosts = 0; /* Hash hostname on output */ 62 63#define MAXMAXFD 256 64 65/* The number of seconds after which to give up on a TCP connection */ 66int timeout = 5; 67 --- 337 unchanged lines hidden (view full) --- 405 char strport[NI_MAXSERV]; 406 int gaierr, s = -1; 407 408 snprintf(strport, sizeof strport, "%d", ssh_port); 409 memset(&hints, 0, sizeof(hints)); 410 hints.ai_family = IPv4or6; 411 hints.ai_socktype = SOCK_STREAM; 412 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) |
413 fatal("getaddrinfo %s: %s", host, gai_strerror(gaierr)); | 413 fatal("getaddrinfo %s: %s", host, ssh_gai_strerror(gaierr)); |
414 for (ai = aitop; ai; ai = ai->ai_next) { 415 s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); 416 if (s < 0) { 417 error("socket: %s", strerror(errno)); 418 continue; 419 } 420 if (set_nonblock(s) == -1) 421 fatal("%s: set_nonblock(%d)", __func__, s); --- 229 unchanged lines hidden (view full) --- 651 seltime.tv_sec = seltime.tv_usec = 0; 652 653 r = xcalloc(read_wait_nfdset, sizeof(fd_mask)); 654 e = xcalloc(read_wait_nfdset, sizeof(fd_mask)); 655 memcpy(r, read_wait, read_wait_nfdset * sizeof(fd_mask)); 656 memcpy(e, read_wait, read_wait_nfdset * sizeof(fd_mask)); 657 658 while (select(maxfd, r, NULL, e, &seltime) == -1 && | 414 for (ai = aitop; ai; ai = ai->ai_next) { 415 s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); 416 if (s < 0) { 417 error("socket: %s", strerror(errno)); 418 continue; 419 } 420 if (set_nonblock(s) == -1) 421 fatal("%s: set_nonblock(%d)", __func__, s); --- 229 unchanged lines hidden (view full) --- 651 seltime.tv_sec = seltime.tv_usec = 0; 652 653 r = xcalloc(read_wait_nfdset, sizeof(fd_mask)); 654 e = xcalloc(read_wait_nfdset, sizeof(fd_mask)); 655 memcpy(r, read_wait, read_wait_nfdset * sizeof(fd_mask)); 656 memcpy(e, read_wait, read_wait_nfdset * sizeof(fd_mask)); 657 658 while (select(maxfd, r, NULL, e, &seltime) == -1 && |
659 (errno == EAGAIN || errno == EINTR)) | 659 (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) |
660 ; 661 662 for (i = 0; i < maxfd; i++) { 663 if (FD_ISSET(i, e)) { 664 error("%s: exception!", fdcon[i].c_name); 665 confree(i); 666 } else if (FD_ISSET(i, r)) 667 conread(i); --- 183 unchanged lines hidden --- | 660 ; 661 662 for (i = 0; i < maxfd; i++) { 663 if (FD_ISSET(i, e)) { 664 error("%s: exception!", fdcon[i].c_name); 665 confree(i); 666 } else if (FD_ISSET(i, r)) 667 conread(i); --- 183 unchanged lines hidden --- |