OpenCoverage

ssh-keyscan.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssh/src/ssh-keyscan.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12-
13-
14-
15-
16-
17-
18-
19int IPv4or6 = -
20 0-
21 ;-
22-
23int ssh_port = 22;-
24int get_cert = 0;-
25int get_keytypes = (1<<1)|(1<<2)|(1<<3);-
26-
27int hash_hosts = 0;-
28-
29int print_sshfp = 0;-
30-
31-
32-
33-
34int timeout = 5;-
35-
36int maxfd;-
37-
38-
39extern char *__progname;-
40fd_set *read_wait;-
41size_t read_wait_nfdset;-
42int ncon;-
43-
44struct ssh *active_state = -
45 ((void *)0)-
46 ;-
47-
48-
49-
50-
51-
52typedef struct Connection {-
53 u_char c_status;-
54-
55-
56-
57-
58 int c_fd;-
59 int c_plen;-
60 int c_len;-
61 int c_off;-
62 int c_keytype;-
63 sig_atomic_t c_done;-
64 char *c_namebase;-
65 char *c_name;-
66 char *c_namelist;-
67 char *c_output_name;-
68 char *c_data;-
69 struct ssh *c_ssh;-
70 struct timeval c_tv;-
71 struct { struct Connection *tqe_next; struct Connection **tqe_prev; } c_link;-
72} con;-
73-
74struct conlist { struct Connection *tqh_first; struct Connection **tqh_last; } tq;-
75con *fdcon;-
76-
77static void keyprint(con *c, struct sshkey *key);-
78-
79static int-
80fdlim_get(int hard)-
81{-
82-
83 struct rlimit rlfd;-
84-
85 if (getrlimit(
getrlimit( RLI...E , &rlfd) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
86 RLIMIT_NOFILE
getrlimit( RLI...E , &rlfd) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
87 , &rlfd) < 0
getrlimit( RLI...E , &rlfd) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
88 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
89 if ((
(hard ? rlfd.r...(__rlim_t) -1)Description
TRUEnever evaluated
FALSEnever evaluated
hard
hardDescription
TRUEnever evaluated
FALSEnever evaluated
? rlfd.rlim_max : rlfd.rlim_cur) ==
(hard ? rlfd.r...(__rlim_t) -1)Description
TRUEnever evaluated
FALSEnever evaluated
0
90 ((__rlim_t) -1)
(hard ? rlfd.r...(__rlim_t) -1)Description
TRUEnever evaluated
FALSEnever evaluated
0
91 )-
92 return
never executed: return sysconf( _SC_OPEN_MAX );
sysconf(
never executed: return sysconf( _SC_OPEN_MAX );
0
93 _SC_OPEN_MAX
never executed: return sysconf( _SC_OPEN_MAX );
0
94 );
never executed: return sysconf( _SC_OPEN_MAX );
0
95 else-
96 return
never executed: return hard ? rlfd.rlim_max : rlfd.rlim_cur;
hard
hardDescription
TRUEnever evaluated
FALSEnever evaluated
? rlfd.rlim_max : rlfd.rlim_cur;
never executed: return hard ? rlfd.rlim_max : rlfd.rlim_cur;
0
97-
98-
99-
100}-
101-
102static int-
103fdlim_set(int lim)-
104{-
105-
106 struct rlimit rlfd;-
107-
108-
109 if (lim <= 0
lim <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
110 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
111-
112 if (getrlimit(
getrlimit( RLI...E , &rlfd) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
113 RLIMIT_NOFILE
getrlimit( RLI...E , &rlfd) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
114 , &rlfd) < 0
getrlimit( RLI...E , &rlfd) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
115 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
116 rlfd.rlim_cur = lim;-
117 if (setrlimit(
setrlimit( RLI...E , &rlfd) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
118 RLIMIT_NOFILE
setrlimit( RLI...E , &rlfd) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
119 , &rlfd) < 0
setrlimit( RLI...E , &rlfd) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
120 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
121-
122-
123-
124 return
never executed: return (0);
(0);
never executed: return (0);
0
125}-
126-
127-
128-
129-
130-
131-
132static char *-
133xstrsep(char **str, const char *delim)-
134{-
135 char *s, *e;-
136-
137 if (!**str
!**strDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
138 return
never executed: return ( ((void *)0) );
(
never executed: return ( ((void *)0) );
0
139 ((void *)0)
never executed: return ( ((void *)0) );
0
140 );
never executed: return ( ((void *)0) );
0
141-
142 s = *str;-
143 e = s + -
144 __builtin_strcspn (-
145 s-
146 , -
147 delim-
148 )-
149 ;-
150-
151 if (*
*e != '\0'Description
TRUEnever evaluated
FALSEnever evaluated
e != '\0'
*e != '\0'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
152 *
never executed: *e++ = '\0';
e++ = '\0';
never executed: *e++ = '\0';
0
153 *str = e;-
154-
155 return
never executed: return (s);
(s);
never executed: return (s);
0
156}-
157-
158-
159-
160-
161-
162static char *-
163strnnsep(char **stringp, char *delim)-
164{-
165 char *tok;-
166-
167 do {-
168 tok = xstrsep(stringp, delim);-
169 }
never executed: end of block
while (tok
tokDescription
TRUEnever evaluated
FALSEnever evaluated
&& *
*tok == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
tok == '\0'
*tok == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
);
0
170 return
never executed: return (tok);
(tok);
never executed: return (tok);
0
171}-
172-
173-
174static int-
175key_print_wrapper(struct sshkey *hostkey, struct ssh *ssh)-
176{-
177 con *c;-
178-
179 if ((
(c = ssh_get_a...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
c = ssh_get_app_data(ssh)) !=
(c = ssh_get_a...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
180 ((void *)0)
(c = ssh_get_a...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
181 )-
182 keyprint(c, hostkey);
never executed: keyprint(c, hostkey);
0
183-
184 return
never executed: return -1;
-1;
never executed: return -1;
0
185}-
186-
187static int-
188ssh2_capable(int remote_major, int remote_minor)-
189{-
190 switch (remote_major) {-
191 case
never executed: case 1:
1:
never executed: case 1:
0
192 if (remote_minor == 99
remote_minor == 99Description
TRUEnever evaluated
FALSEnever evaluated
)
0
193 return
never executed: return 1;
1;
never executed: return 1;
0
194 break;
never executed: break;
0
195 case
never executed: case 2:
2:
never executed: case 2:
0
196 return
never executed: return 1;
1;
never executed: return 1;
0
197 default
never executed: default:
:
never executed: default:
0
198 break;
never executed: break;
0
199 }-
200 return
never executed: return 0;
0;
never executed: return 0;
0
201}-
202-
203static void-
204keygrab_ssh2(con *c)-
205{-
206 char *myproposal[PROPOSAL_MAX] = { "curve25519-sha256," "curve25519-sha256@libssh.org," "ecdh-sha2-nistp256," "ecdh-sha2-nistp384," "ecdh-sha2-nistp521," "diffie-hellman-group-exchange-sha256," "diffie-hellman-group16-sha512," "diffie-hellman-group18-sha512," "diffie-hellman-group-exchange-sha1," "diffie-hellman-group14-sha256," "diffie-hellman-group14-sha1", "ecdsa-sha2-nistp256-cert-v01@openssh.com," "ecdsa-sha2-nistp384-cert-v01@openssh.com," "ecdsa-sha2-nistp521-cert-v01@openssh.com," "ssh-ed25519-cert-v01@openssh.com," "rsa-sha2-512-cert-v01@openssh.com," "rsa-sha2-256-cert-v01@openssh.com," "ssh-rsa-cert-v01@openssh.com," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "ssh-ed25519," "rsa-sha2-512," "rsa-sha2-256," "ssh-rsa", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr" ",aes128-gcm@openssh.com,aes256-gcm@openssh.com", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr" ",aes128-gcm@openssh.com,aes256-gcm@openssh.com", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "none,zlib@openssh.com", "none,zlib@openssh.com", "", "" };-
207 int r;-
208-
209 switch (c->c_keytype) {-
210 case
never executed: case (1):
(1):
never executed: case (1):
0
211 myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = get_cert
get_certDescription
TRUEnever evaluated
FALSEnever evaluated
?
0
212 "ssh-dss-cert-v01@openssh.com" : "ssh-dss";-
213 break;
never executed: break;
0
214 case
never executed: case (1<<1):
(1<<1):
never executed: case (1<<1):
0
215 myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = get_cert
get_certDescription
TRUEnever evaluated
FALSEnever evaluated
?
0
216 "ssh-rsa-cert-v01@openssh.com" : "ssh-rsa";-
217 break;
never executed: break;
0
218 case
never executed: case (1<<3):
(1<<3):
never executed: case (1<<3):
0
219 myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = get_cert
get_certDescription
TRUEnever evaluated
FALSEnever evaluated
?
0
220 "ssh-ed25519-cert-v01@openssh.com" : "ssh-ed25519";-
221 break;
never executed: break;
0
222 case
never executed: case (1<<4):
(1<<4):
never executed: case (1<<4):
0
223 myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = get_cert
get_certDescription
TRUEnever evaluated
FALSEnever evaluated
?
0
224 "ssh-xmss-cert-v01@openssh.com" : "ssh-xmss@openssh.com";-
225 break;
never executed: break;
0
226 case
never executed: case (1<<2):
(1<<2):
never executed: case (1<<2):
0
227 myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = get_cert
get_certDescription
TRUEnever evaluated
FALSEnever evaluated
?
0
228 "ecdsa-sha2-nistp256-cert-v01@openssh.com,"-
229 "ecdsa-sha2-nistp384-cert-v01@openssh.com,"-
230 "ecdsa-sha2-nistp521-cert-v01@openssh.com" :-
231 "ecdsa-sha2-nistp256,"-
232 "ecdsa-sha2-nistp384,"-
233 "ecdsa-sha2-nistp521";-
234 break;
never executed: break;
0
235 default
never executed: default:
:
never executed: default:
0
236 fatal("unknown key type %d", c->c_keytype);-
237 break;
never executed: break;
0
238 }-
239 if ((
(r = kex_setup...roposal)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = kex_setup(c->c_ssh, myproposal)) != 0
(r = kex_setup...roposal)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
240 free(c->c_ssh);-
241 fprintf(-
242 stderr-
243 , "kex_setup: %s\n", ssh_err(r));-
244 exit(1);
never executed: exit(1);
0
245 }-
246-
247 c->c_ssh->kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client;-
248 c->c_ssh->kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client;-
249 c->c_ssh->kex->kex[KEX_DH_GRP14_SHA256] = kexdh_client;-
250 c->c_ssh->kex->kex[KEX_DH_GRP16_SHA512] = kexdh_client;-
251 c->c_ssh->kex->kex[KEX_DH_GRP18_SHA512] = kexdh_client;-
252 c->c_ssh->kex->kex[KEX_DH_GEX_SHA1] = kexgex_client;-
253 c->c_ssh->kex->kex[KEX_DH_GEX_SHA256] = kexgex_client;-
254-
255 c->c_ssh->kex->kex[KEX_ECDH_SHA2] = kexecdh_client;-
256-
257-
258 c->c_ssh->kex->kex[KEX_C25519_SHA256] = kexc25519_client;-
259 ssh_set_verify_host_key_callback(c->c_ssh, key_print_wrapper);-
260-
261-
262-
263-
264 ssh_dispatch_run(c->c_ssh, DISPATCH_BLOCK, &c->c_done);-
265}
never executed: end of block
0
266-
267static void-
268keyprint_one(const char *host, struct sshkey *key)-
269{-
270 char *hostport;-
271 const char *known_host, *hashed;-
272-
273 if (print_sshfp
print_sshfpDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
274 export_dns_rr(host, key, -
275 stdout-
276 , 0);-
277 return;
never executed: return;
0
278 }-
279-
280 hostport = put_host_port(host, ssh_port);-
281 lowercase(hostport);-
282 if (hash_hosts
hash_hostsDescription
TRUEnever evaluated
FALSEnever evaluated
&& (
(hashed = host...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
hashed = host_hash(host,
(hashed = host...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
283 ((void *)0)
(hashed = host...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
284 , 0)) ==
(hashed = host...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
285 ((void *)0)
(hashed = host...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
286 )-
287 fatal("host_hash failed");
never executed: fatal("host_hash failed");
0
288 known_host = hash_hosts
hash_hostsDescription
TRUEnever evaluated
FALSEnever evaluated
? hashed : hostport;
0
289 if (!get_cert
!get_certDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
290 fprintf(
never executed: fprintf( stdout , "%s ", known_host);
0
291 stdout
never executed: fprintf( stdout , "%s ", known_host);
0
292 , "%s ", known_host);
never executed: fprintf( stdout , "%s ", known_host);
0
293 sshkey_write(key, -
294 stdout-
295 );-
296 fputs("\n", -
297 stdout-
298 );-
299 free(hostport);-
300}
never executed: end of block
0
301-
302static void-
303keyprint(con *c, struct sshkey *key)-
304{-
305 char *hosts = c->c_output_name
c->c_output_nameDescription
TRUEnever evaluated
FALSEnever evaluated
? c->c_output_name : c->c_name;
0
306 char *host, *ohosts;-
307-
308 if (key ==
key == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
309 ((void *)0)
key == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
310 )-
311 return;
never executed: return;
0
312 if (get_cert
get_certDescription
TRUEnever evaluated
FALSEnever evaluated
|| (!hash_hosts
!hash_hostsDescription
TRUEnever evaluated
FALSEnever evaluated
&& ssh_port == 22
ssh_port == 22Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
313 keyprint_one(hosts, key);-
314 return;
never executed: return;
0
315 }-
316 ohosts = hosts = xstrdup(hosts);-
317 while ((
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
host =
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
318 __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
319 ","
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
320 ) && ((size_t)(const void *)((
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
321 ","
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
322 ) + 1) - (size_t)(const void *)(
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
323 ","
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
324 ) == 1) && (__r0 = ((const char *) (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
325 ","
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
326 ))[0], ((const char *) (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
327 ","
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
328 ))[0] != '\0') ? ((__r1 = ((const char *) (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
329 ","
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
330 ))[1], ((const char *) (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
331 ","
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
332 ))[1] == '\0') ? __strsep_1c (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
333 &hosts
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
334 , __r0) : ((__r2 = ((const char *) (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
335 ","
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
336 ))[2], __r2 == '\0') ? __strsep_2c (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
337 &hosts
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
338 , __r0, __r1) : (((const char *) (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
339 ","
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
340 ))[3] == '\0' ? __strsep_3c (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
341 &hosts
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
342 , __r0, __r1, __r2) : __strsep_g (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
343 &hosts
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
344 ,
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
345 ","
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
346 )))) : __strsep_g (
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
347 &hosts
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
348 ,
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
349 ","
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
350 )); })
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
351 ) !=
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
352 ((void *)0)
(host = __exte...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
353 )-
354 keyprint_one(host, key);
never executed: keyprint_one(host, key);
0
355 free(ohosts);-
356}
never executed: end of block
0
357-
358static int-
359tcpconnect(char *host)-
360{-
361 struct addrinfo hints, *ai, *aitop;-
362 char strport[-
363 32-
364 ];-
365 int gaierr, s = -1;-
366-
367 snprintf(strport, sizeof strport, "%d", ssh_port);-
368 memset(&hints, 0, sizeof(hints));-
369 hints.ai_family = IPv4or6;-
370 hints.ai_socktype = -
371 SOCK_STREAM-
372 ;-
373 if ((
(gaierr = geta... &aitop)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0
(gaierr = geta... &aitop)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
374 error("getaddrinfo %s: %s", host, ssh_gai_strerror(gaierr));-
375 return
never executed: return -1;
-1;
never executed: return -1;
0
376 }-
377 for (ai = aitop; ai
aiDescription
TRUEnever evaluated
FALSEnever evaluated
; ai = ai->ai_next) {
0
378 s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);-
379 if (s < 0
s < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
380 error("socket: %s", strerror(-
381 (*__errno_location ())-
382 ));-
383 continue;
never executed: continue;
0
384 }-
385 if (set_nonblock(s) == -1
set_nonblock(s) == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
386 fatal("%s: set_nonblock(%d)", __func__, s);
never executed: fatal("%s: set_nonblock(%d)", __func__, s);
0
387 if (connect(s, ai->ai_addr, ai->ai_addrlen) < 0
connect(s, ai-...i_addrlen) < 0Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
388 -
389 (*
(*__errno_location ()) != 115Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) != 115Description
TRUEnever evaluated
FALSEnever evaluated
0
390 !=
(*__errno_location ()) != 115Description
TRUEnever evaluated
FALSEnever evaluated
0
391 115
(*__errno_location ()) != 115Description
TRUEnever evaluated
FALSEnever evaluated
0
392 )-
393 error("connect (`%s'): %s", host, strerror(
never executed: error("connect (`%s'): %s", host, strerror( (*__errno_location ()) ));
0
394 (*__errno_location ())
never executed: error("connect (`%s'): %s", host, strerror( (*__errno_location ()) ));
0
395 ));
never executed: error("connect (`%s'): %s", host, strerror( (*__errno_location ()) ));
0
396 else-
397 break;
never executed: break;
0
398 close(s);-
399 s = -1;-
400 }
never executed: end of block
0
401 freeaddrinfo(aitop);-
402 return
never executed: return s;
s;
never executed: return s;
0
403}-
404-
405static int-
406conalloc(char *iname, char *oname, int keytype)-
407{-
408 char *namebase, *name, *namelist;-
409 int s;-
410-
411 namebase = namelist = xstrdup(iname);-
412-
413 do {-
414 name = xstrsep(&namelist, ",");-
415 if (!name
!nameDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
416 free(namebase);-
417 return
never executed: return (-1);
(-1);
never executed: return (-1);
0
418 }-
419 }
never executed: end of block
while ((
(s = tcpconnect(name)) < 0Description
TRUEnever evaluated
FALSEnever evaluated
s = tcpconnect(name)) < 0
(s = tcpconnect(name)) < 0Description
TRUEnever evaluated
FALSEnever evaluated
);
0
420-
421 if (s >= maxfd
s >= maxfdDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
422 fatal("conalloc: fdno %d too high", s);
never executed: fatal("conalloc: fdno %d too high", s);
0
423 if (fdcon[s].c_status
fdcon[s].c_statusDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
424 fatal("conalloc: attempt to reuse fdno %d", s);
never executed: fatal("conalloc: attempt to reuse fdno %d", s);
0
425-
426 debug3("%s: oname %s kt %d", __func__, oname, keytype);-
427 fdcon[s].c_fd = s;-
428 fdcon[s].c_status = 1;-
429 fdcon[s].c_namebase = namebase;-
430 fdcon[s].c_name = name;-
431 fdcon[s].c_namelist = namelist;-
432 fdcon[s].c_output_name = xstrdup(oname);-
433 fdcon[s].c_data = (char *) &fdcon[s].c_plen;-
434 fdcon[s].c_len = 4;-
435 fdcon[s].c_off = 0;-
436 fdcon[s].c_keytype = keytype;-
437 monotime_tv(&fdcon[s].c_tv);-
438 fdcon[s].c_tv.tv_sec += timeout;-
439 do { (&fdcon[s])->c_link.tqe_next = -
440((void *)0)-
441; (&fdcon[s])->c_link.tqe_prev = (&tq)->tqh_last; *(&tq)->tqh_last = (&fdcon[s]); (&tq)->tqh_last = &(&fdcon[s])->c_link.tqe_next; } while (0);-
442 kludge_FD_SET(s, read_wait);-
443 ncon++;-
444 return
never executed: return (s);
(s);
never executed: return (s);
0
445}-
446-
447static void-
448confree(int s)-
449{-
450 if (s >= maxfd
s >= maxfdDescription
TRUEnever evaluated
FALSEnever evaluated
|| fdcon[s].c_status == 0
fdcon[s].c_status == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
451 fatal("confree: attempt to free bad fdno %d", s);
never executed: fatal("confree: attempt to free bad fdno %d", s);
0
452 free(fdcon[s].c_namebase);-
453 free(fdcon[s].c_output_name);-
454 if (fdcon[s].c_status == 3
fdcon[s].c_status == 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0
455 free(fdcon[s].c_data);
never executed: free(fdcon[s].c_data);
0
456 fdcon[s].c_status = 0;-
457 fdcon[s].c_keytype = 0;-
458 if (fdcon[s].c_ssh
fdcon[s].c_sshDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
459 ssh_packet_close(fdcon[s].c_ssh);-
460 free(fdcon[s].c_ssh);-
461 fdcon[s].c_ssh = -
462 ((void *)0)-
463 ;-
464 }
never executed: end of block
else
0
465 close(s);
never executed: close(s);
0
466 do { if (((
((&fdcon[s])->...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
&fdcon[s])->c_link.tqe_next) !=
((&fdcon[s])->...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
467((
((&fdcon[s])->...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
((&fdcon[s])->...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
void *)0)
((&fdcon[s])->...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
468) (
never executed: (&fdcon[s])->c_link.tqe_next->c_link.tqe_prev = (&fdcon[s])->c_link.tqe_prev;
&fdcon[s])->c_link.tqe_next->c_link.tqe_prev = (&fdcon[s])->c_link.tqe_prev;
never executed: (&fdcon[s])->c_link.tqe_next->c_link.tqe_prev = (&fdcon[s])->c_link.tqe_prev;
else (
never executed: (&tq)->tqh_last = (&fdcon[s])->c_link.tqe_prev;
&tq)->tqh_last = (&fdcon[s])->c_link.tqe_prev;
never executed: (&tq)->tqh_last = (&fdcon[s])->c_link.tqe_prev;
*(&fdcon[s])->c_link.tqe_prev = (&fdcon[s])->c_link.tqe_next; ; ; } while (0);
0
469 -
470((void) (((-
471read_wait-
472)->fds_bits)[__extension__ ({ long int __d = (-
473s-
474); (__builtin_constant_p (__d) ? (0 <= __d && __d < 1024 ? (__d / (8 * (int) sizeof (__fd_mask))) : __fdelt_warn (__d)) : __fdelt_chk (__d)); })] &= ~((__fd_mask) (1UL << ((-
475s-
476) % (8 * (int) sizeof (__fd_mask)))))))-
477 ;-
478 ncon--;-
479}
never executed: end of block
0
480-
481static void-
482contouch(int s)-
483{-
484 do { if (((
((&fdcon[s])->...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
&fdcon[s])->c_link.tqe_next) !=
((&fdcon[s])->...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
485((
((&fdcon[s])->...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
((&fdcon[s])->...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
void *)0)
((&fdcon[s])->...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
486) (
never executed: (&fdcon[s])->c_link.tqe_next->c_link.tqe_prev = (&fdcon[s])->c_link.tqe_prev;
&fdcon[s])->c_link.tqe_next->c_link.tqe_prev = (&fdcon[s])->c_link.tqe_prev;
never executed: (&fdcon[s])->c_link.tqe_next->c_link.tqe_prev = (&fdcon[s])->c_link.tqe_prev;
else (
never executed: (&tq)->tqh_last = (&fdcon[s])->c_link.tqe_prev;
&tq)->tqh_last = (&fdcon[s])->c_link.tqe_prev;
never executed: (&tq)->tqh_last = (&fdcon[s])->c_link.tqe_prev;
*(&fdcon[s])->c_link.tqe_prev = (&fdcon[s])->c_link.tqe_next; ; ; } while (0);
0
487 monotime_tv(&fdcon[s].c_tv);-
488 fdcon[s].c_tv.tv_sec += timeout;-
489 do { (&fdcon[s])->c_link.tqe_next = -
490((void *)0)-
491; (&fdcon[s])->c_link.tqe_prev = (&tq)->tqh_last; *(&tq)->tqh_last = (&fdcon[s]); (&tq)->tqh_last = &(&fdcon[s])->c_link.tqe_next; } while (0);-
492}
never executed: end of block
0
493-
494static int-
495conrecycle(int s)-
496{-
497 con *c = &fdcon[s];-
498 int ret;-
499-
500 ret = conalloc(c->c_namelist, c->c_output_name, c->c_keytype);-
501 confree(s);-
502 return
never executed: return (ret);
(ret);
never executed: return (ret);
0
503}-
504-
505static void-
506congreet(int s)-
507{-
508 int n = 0, remote_major = 0, remote_minor = 0;-
509 char buf[256], *cp;-
510 char remote_version[sizeof buf];-
511 size_t bufsiz;-
512 con *c = &fdcon[s];-
513-
514-
515 n = snprintf(buf, sizeof buf, "SSH-%d.%d-OpenSSH-keyscan\r\n",-
516 2, 0);-
517 if (n < 0
n < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(size_t)n >= sizeof(buf)Description
TRUEnever evaluated
FALSEnever evaluated
size_t)n >= sizeof(buf)
(size_t)n >= sizeof(buf)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
518 error("snprintf: buffer too small");-
519 confree(s);-
520 return;
never executed: return;
0
521 }-
522 if (atomicio((ssize_t (*)(int, void *, size_t))write, s, buf, n) != (size_t)n
atomicio((ssiz...) != (size_t)nDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
523 error("write (%s): %s", c->c_name, strerror(-
524 (*__errno_location ())-
525 ));-
526 confree(s);-
527 return;
never executed: return;
0
528 }-
529-
530 for (;;) {-
531 memset(buf, '\0', sizeof(buf));-
532 bufsiz = sizeof(buf);-
533 cp = buf;-
534 while (bufsiz--
bufsiz--Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
535 (
(n = atomicio(..., cp, 1)) == 1Description
TRUEnever evaluated
FALSEnever evaluated
n = atomicio(read, s, cp, 1)) == 1
(n = atomicio(..., cp, 1)) == 1Description
TRUEnever evaluated
FALSEnever evaluated
&& *
*cp != '\n'Description
TRUEnever evaluated
FALSEnever evaluated
cp != '\n'
*cp != '\n'Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
536 if (*
*cp == '\r'Description
TRUEnever evaluated
FALSEnever evaluated
cp == '\r'
*cp == '\r'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
537 *
never executed: *cp = '\n';
cp = '\n';
never executed: *cp = '\n';
0
538 cp++;-
539 }
never executed: end of block
0
540 if (n != 1
n != 1Description
TRUEnever evaluated
FALSEnever evaluated
||
0
541 (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
__extension__ (__builtin_constant_p (
__builtin_constant_p ( 4 )Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
542 4
__builtin_constant_p ( 4 )Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
543 )
__builtin_constant_p ( 4 )Description
TRUEnever evaluated
FALSEnever evaluated
&& ((__builtin_constant_p (
__builtin_constant_p ( buf )Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
544 buf
__builtin_constant_p ( buf )Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
545 )
__builtin_constant_p ( buf )Description
TRUEnever evaluated
FALSEnever evaluated
&& strlen (
strlen ( buf )...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
546 buf
strlen ( buf )...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
547 ) < ((size_t) (
strlen ( buf )...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
548 4
strlen ( buf )...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
549 ))
strlen ( buf )...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
) || (__builtin_constant_p (
__builtin_cons...t_p ( "SSH-" )Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
550 "SSH-"
__builtin_cons...t_p ( "SSH-" )Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
551 )
__builtin_cons...t_p ( "SSH-" )Description
TRUEnever evaluated
FALSEnever evaluated
&& strlen (
strlen ( "SSH-...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
552 "SSH-"
strlen ( "SSH-...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
553 ) < ((size_t) (
strlen ( "SSH-...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
554 4
strlen ( "SSH-...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
555 ))
strlen ( "SSH-...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
)) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
556 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
557 ) && __builtin_constant_p (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
558 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
559 ) && (__s1_len = __builtin_strlen (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
560 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
561 ), __s2_len = __builtin_strlen (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
562 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
563 ), (!((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
564 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
565 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
566 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
567 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
568 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
569 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
570 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
571 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
572 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
573 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
574 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
575 ) : (__builtin_constant_p (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
576 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
577 ) && ((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
578 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
579 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
580 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
581 ) == 1) && (__s1_len = __builtin_strlen (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
582 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
583 ), __s1_len < 4) ? (__builtin_constant_p (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
584 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
585 ) && ((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
586 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
587 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
588 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
589 ) == 1) ? __builtin_strcmp (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
590 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
591 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
592 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
593 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
594 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
595 ); int __result = (((const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
596 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
597 ))[0] - __s2[0]); if (__s1_len > 0
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
598 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
599 ))[1] - __s2[1]); if (__s1_len > 1
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
600 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
601 ))[2] - __s2[2]); if (__s1_len > 2
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( buf ))[3] - __s2[3]);
0
602 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( buf ))[3] - __s2[3]);
0
603 ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
604 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
605 ) && ((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
606 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
607 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
608 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
609 ) == 1) && (__s2_len = __builtin_strlen (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
610 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
611 ), __s2_len < 4) ? (__builtin_constant_p (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
612 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
613 ) && ((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
614 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
615 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
616 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
617 ) == 1) ? __builtin_strcmp (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
618 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
619 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
620 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
621 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
622 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
623 ); int __result = (((const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
624 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
625 ))[0] - __s2[0]); if (__s2_len > 0
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
626 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
627 ))[1] - __s2[1]); if (__s2_len > 1
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
628 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
629 ))[2] - __s2[2]); if (__s2_len > 2
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( "SSH-" ))[3] - __s2[3]);
0
630 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( "SSH-" ))[3] - __s2[3]);
0
631 ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
632 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
633 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
634 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
635 )))); }) : strncmp (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
636 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
637 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
638 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
639 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
640 4
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
641 )))
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
642 == 0
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
643 break;
never executed: break;
0
644 }
never executed: end of block
0
645 if (n == 0
n == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
646 switch (-
647 (*__errno_location ())-
648 ) {-
649 case
never executed: case 32 :
never executed: case 32 :
0
650 32
never executed: case 32 :
0
651 :
never executed: case 32 :
0
652 error("%s: Connection closed by remote host", c->c_name);-
653 break;
never executed: break;
0
654 case
never executed: case 111 :
never executed: case 111 :
0
655 111
never executed: case 111 :
0
656 :
never executed: case 111 :
0
657 break;
never executed: break;
0
658 default
never executed: default:
:
never executed: default:
0
659 error("read (%s): %s", c->c_name, strerror(-
660 (*__errno_location ())-
661 ));-
662 break;
never executed: break;
0
663 }-
664 conrecycle(s);-
665 return;
never executed: return;
0
666 }-
667 if (*
*cp != '\n'Description
TRUEnever evaluated
FALSEnever evaluated
cp != '\n'
*cp != '\n'Description
TRUEnever evaluated
FALSEnever evaluated
&& *
*cp != '\r'Description
TRUEnever evaluated
FALSEnever evaluated
cp != '\r'
*cp != '\r'Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
668 error("%s: bad greeting", c->c_name);-
669 confree(s);-
670 return;
never executed: return;
0
671 }-
672 *cp = '\0';-
673 if ((
(c->c_ssh = ss...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
c->c_ssh = ssh_packet_set_connection(
(c->c_ssh = ss...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
674 ((void *)0)
(c->c_ssh = ss...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
675 , s, s)) ==
(c->c_ssh = ss...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
676 ((void *)0)
(c->c_ssh = ss...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
677 )-
678 fatal("ssh_packet_set_connection failed");
never executed: fatal("ssh_packet_set_connection failed");
0
679 ssh_packet_set_timeout(c->c_ssh, timeout, 1);-
680 ssh_set_app_data(c->c_ssh, c);-
681 if (sscanf(buf, "SSH-%d.%d-%[^\n]\n",
sscanf(buf, "S..._version) == 3Description
TRUEnever evaluated
FALSEnever evaluated
0
682 &remote_major, &remote_minor, remote_version) == 3
sscanf(buf, "S..._version) == 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0
683 c->c_ssh->compat = compat_datafellows(remote_version);
never executed: c->c_ssh->compat = compat_datafellows(remote_version);
0
684 else-
685 c->c_ssh->compat = 0;
never executed: c->c_ssh->compat = 0;
0
686 if (!ssh2_capable(remote_major, remote_minor)
!ssh2_capable(... remote_minor)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
687 debug("%s doesn't support ssh2", c->c_name);-
688 confree(s);-
689 return;
never executed: return;
0
690 }-
691 fprintf(-
692 stderr-
693 , "%c %s:%d %s\n", print_sshfp ? ';' : '#',-
694 c->c_name, ssh_port, chop(buf));-
695 keygrab_ssh2(c);-
696 confree(s);-
697}
never executed: end of block
0
698-
699static void-
700conread(int s)-
701{-
702 con *c = &fdcon[s];-
703 size_t n;-
704-
705 if (c->c_status == 1
c->c_status == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
706 congreet(s);-
707 return;
never executed: return;
0
708 }-
709 n = atomicio(read, s, c->c_data + c->c_off, c->c_len - c->c_off);-
710 if (n == 0
n == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
711 error("read (%s): %s", c->c_name, strerror(-
712 (*__errno_location ())-
713 ));-
714 confree(s);-
715 return;
never executed: return;
0
716 }-
717 c->c_off += n;-
718-
719 if (c->c_off == c->c_len
c->c_off == c->c_lenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
720 switch (c->c_status) {-
721 case
never executed: case 2:
2:
never executed: case 2:
0
722 c->c_plen = -
723 __bswap_32 (-
724 c->c_plen-
725 )-
726 ;-
727 c->c_len = c->c_plen + 8 - (c->c_plen & 7);-
728 c->c_off = 0;-
729 c->c_data = xmalloc(c->c_len);-
730 c->c_status = 3;-
731 break;
never executed: break;
0
732 default
never executed: default:
:
never executed: default:
0
733 fatal("conread: invalid status %d", c->c_status);-
734 break;
never executed: break;
0
735 }-
736-
737 contouch(s);-
738}
never executed: end of block
0
739-
740static void-
741conloop(void)-
742{-
743 struct timeval seltime, now;-
744 fd_set *r, *e;-
745 con *c;-
746 int i;-
747-
748 monotime_tv(&now);-
749 c = ((&tq)->tqh_first);-
750-
751 if (c
cDescription
TRUEnever evaluated
FALSEnever evaluated
&& (c->c_tv.tv_sec > now.tv_sec
c->c_tv.tv_sec > now.tv_secDescription
TRUEnever evaluated
FALSEnever evaluated
||
0
752 (c->c_tv.tv_sec == now.tv_sec
c->c_tv.tv_sec == now.tv_secDescription
TRUEnever evaluated
FALSEnever evaluated
&& c->c_tv.tv_usec > now.tv_usec
c->c_tv.tv_usec > now.tv_usecDescription
TRUEnever evaluated
FALSEnever evaluated
))) {
0
753 seltime = c->c_tv;-
754 seltime.tv_sec -= now.tv_sec;-
755 seltime.tv_usec -= now.tv_usec;-
756 if (seltime.tv_usec < 0
seltime.tv_usec < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
757 seltime.tv_usec += 1000000;-
758 seltime.tv_sec--;-
759 }
never executed: end of block
0
760 }
never executed: end of block
else
0
761 -
762 ((
never executed: (( &seltime )->tv_sec = ( &seltime )->tv_usec = 0) ;
0
763 &seltime
never executed: (( &seltime )->tv_sec = ( &seltime )->tv_usec = 0) ;
0
764 )->tv_sec = (
never executed: (( &seltime )->tv_sec = ( &seltime )->tv_usec = 0) ;
0
765 &seltime
never executed: (( &seltime )->tv_sec = ( &seltime )->tv_usec = 0) ;
0
766 )->tv_usec = 0)
never executed: (( &seltime )->tv_sec = ( &seltime )->tv_usec = 0) ;
0
767 ;
never executed: (( &seltime )->tv_sec = ( &seltime )->tv_usec = 0) ;
0
768-
769 r = xcalloc(read_wait_nfdset, sizeof(fd_mask));-
770 e = xcalloc(read_wait_nfdset, sizeof(fd_mask));-
771 memcpy(r, read_wait, read_wait_nfdset * sizeof(fd_mask));-
772 memcpy(e, read_wait, read_wait_nfdset * sizeof(fd_mask));-
773-
774 while (select(maxfd, r,
select(maxfd, ...seltime) == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
775 ((void *)0)
select(maxfd, ...seltime) == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
776 , e, &seltime) == -1
select(maxfd, ...seltime) == -1Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
777 (-
778 (*
(*__errno_location ()) == 11Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 11Description
TRUEnever evaluated
FALSEnever evaluated
0
779 ==
(*__errno_location ()) == 11Description
TRUEnever evaluated
FALSEnever evaluated
0
780 11
(*__errno_location ()) == 11Description
TRUEnever evaluated
FALSEnever evaluated
0
781 || -
782 (*
(*__errno_location ()) == 4Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 4Description
TRUEnever evaluated
FALSEnever evaluated
0
783 ==
(*__errno_location ()) == 4Description
TRUEnever evaluated
FALSEnever evaluated
0
784 4
(*__errno_location ()) == 4Description
TRUEnever evaluated
FALSEnever evaluated
0
785 || -
786 (*
(*__errno_location ()) == 11Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 11Description
TRUEnever evaluated
FALSEnever evaluated
0
787 ==
(*__errno_location ()) == 11Description
TRUEnever evaluated
FALSEnever evaluated
0
788 11
(*__errno_location ()) == 11Description
TRUEnever evaluated
FALSEnever evaluated
0
789 ))-
790 ;
never executed: ;
0
791-
792 for (i = 0; i < maxfd
i < maxfdDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
793 if (kludge_FD_ISSET(i, e)
kludge_FD_ISSET(i, e)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
794 error("%s: exception!", fdcon[i].c_name);-
795 confree(i);-
796 }
never executed: end of block
else if (kludge_FD_ISSET(i, r)
kludge_FD_ISSET(i, r)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
797 conread(i);
never executed: conread(i);
0
798 }
never executed: end of block
0
799 free(r);-
800 free(e);-
801-
802 c = ((&tq)->tqh_first);-
803 while (c
cDescription
TRUEnever evaluated
FALSEnever evaluated
&& (c->c_tv.tv_sec < now.tv_sec
c->c_tv.tv_sec < now.tv_secDescription
TRUEnever evaluated
FALSEnever evaluated
||
0
804 (c->c_tv.tv_sec == now.tv_sec
c->c_tv.tv_sec == now.tv_secDescription
TRUEnever evaluated
FALSEnever evaluated
&& c->c_tv.tv_usec < now.tv_usec
c->c_tv.tv_usec < now.tv_usecDescription
TRUEnever evaluated
FALSEnever evaluated
))) {
0
805 int s = c->c_fd;-
806-
807 c = ((c)->c_link.tqe_next);-
808 conrecycle(s);-
809 }
never executed: end of block
0
810}
never executed: end of block
0
811-
812static void-
813do_host(char *host)-
814{-
815 char *name = strnnsep(&host, " \t\n");-
816 int j;-
817-
818 if (name ==
name == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
819 ((void *)0)
name == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
820 )-
821 return;
never executed: return;
0
822 for (j = (1); j <= (1<<4)
j <= (1<<4)Description
TRUEnever evaluated
FALSEnever evaluated
; j *= 2) {
0
823 if (get_keytypes & j
get_keytypes & jDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
824 while (ncon >= (maxfd - 10)
ncon >= (maxfd - 10)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
825 conloop();
never executed: conloop();
0
826 conalloc(name, *host ? host : name, j);-
827 }
never executed: end of block
0
828 }
never executed: end of block
0
829}
never executed: end of block
0
830-
831void-
832fatal(const char *fmt,...)-
833{-
834 va_list args;-
835-
836 -
837__builtin_va_start(-
838args-
839,-
840fmt-
841)-
842 ;-
843 do_log(SYSLOG_LEVEL_FATAL, fmt, args);-
844 -
845__builtin_va_end(-
846args-
847)-
848 ;-
849 exit(255);
never executed: exit(255);
0
850}-
851-
852static void-
853usage(void)-
854{-
855 fprintf(-
856 stderr-
857 ,-
858 "usage: %s [-46cDHv] [-f file] [-p port] [-T timeout] [-t type]\n"-
859 "\t\t [host | addrlist namelist]\n",-
860 __progname);-
861 exit(1);
never executed: exit(1);
0
862}-
863-
864int-
865main(int argc, char **argv)-
866{-
867 int debug_flag = 0, log_level = SYSLOG_LEVEL_INFO;-
868 int opt, fopt_count = 0, j;-
869 char *tname, *cp, *line = -
870 ((void *)0)-
871 ;-
872 size_t linesize = 0;-
873 FILE *fp;-
874-
875 extern int BSDoptind;-
876 extern char *BSDoptarg;-
877-
878 ssh_malloc_init();-
879 __progname = ssh_get_progname(argv[0]);-
880 seed_rng();-
881 do { (&tq)->tqh_first = -
882((void *)0)-
883; (&tq)->tqh_last = &(&tq)->tqh_first; } while (0);-
884-
885-
886 sanitise_stdfd();-
887-
888 if (argc <= 1
argc <= 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
889 usage();
never executed: usage();
0
890-
891 while ((
(opt = BSDgeto...:t:f:")) != -1Description
TRUEnever evaluated
FALSEnever evaluated
opt = BSDgetopt(argc, argv, "cDHv46p:T:t:f:")) != -1
(opt = BSDgeto...:t:f:")) != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
892 switch (opt) {-
893 case
never executed: case 'H':
'H':
never executed: case 'H':
0
894 hash_hosts = 1;-
895 break;
never executed: break;
0
896 case
never executed: case 'c':
'c':
never executed: case 'c':
0
897 get_cert = 1;-
898 break;
never executed: break;
0
899 case
never executed: case 'D':
'D':
never executed: case 'D':
0
900 print_sshfp = 1;-
901 break;
never executed: break;
0
902 case
never executed: case 'p':
'p':
never executed: case 'p':
0
903 ssh_port = a2port(BSDoptarg);-
904 if (ssh_port <= 0
ssh_port <= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
905 fprintf(-
906 stderr-
907 , "Bad port '%s'\n", BSDoptarg);-
908 exit(1);
never executed: exit(1);
0
909 }-
910 break;
never executed: break;
0
911 case
never executed: case 'T':
'T':
never executed: case 'T':
0
912 timeout = convtime(BSDoptarg);-
913 if (timeout == -1
timeout == -1Description
TRUEnever evaluated
FALSEnever evaluated
|| timeout == 0
timeout == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
914 fprintf(-
915 stderr-
916 , "Bad timeout '%s'\n", BSDoptarg);-
917 usage();-
918 }
never executed: end of block
0
919 break;
never executed: break;
0
920 case
never executed: case 'v':
'v':
never executed: case 'v':
0
921 if (!debug_flag
!debug_flagDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
922 debug_flag = 1;-
923 log_level = SYSLOG_LEVEL_DEBUG1;-
924 }
never executed: end of block
0
925 else if (log_level < SYSLOG_LEVEL_DEBUG3
log_level < SY...G_LEVEL_DEBUG3Description
TRUEnever evaluated
FALSEnever evaluated
)
0
926 log_level++;
never executed: log_level++;
0
927 else-
928 fatal("Too high debugging level.");
never executed: fatal("Too high debugging level.");
0
929 break;
never executed: break;
0
930 case
never executed: case 'f':
'f':
never executed: case 'f':
0
931 if (-
932 __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
933 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
934 ) && __builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
935 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
936 ) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
937 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
938 ), __s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
939 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
940 ), (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
941 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
942 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
943 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
944 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
945 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
946 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
947 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
948 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
949 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
950 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
951 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
952 ) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
953 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
954 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
955 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
956 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
957 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
958 ) == 1) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
959 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
960 ), __s1_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
961 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
962 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
963 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
964 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
965 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
966 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
967 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
968 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
969 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
970 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
971 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
972 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
973 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
974 ))[0] - __s2[0]); if (__s1_len > 0
__s1_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
975 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
976 ))[1] - __s2[1]); if (__s1_len > 1
__s1_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
977 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
978 ))[2] - __s2[2]); if (__s1_len > 2
__s1_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( BSDoptarg ))[3] - __s2[3]);
0
979 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( BSDoptarg ))[3] - __s2[3]);
0
980 ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
981 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
982 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
983 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
984 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
985 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
986 ) == 1) && (__s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
987 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
988 ), __s2_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
989 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
990 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
991 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
992 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
993 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
994 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
995 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
996 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
997 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
998 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
999 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1000 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1001 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1002 ))[0] - __s2[0]); if (__s2_len > 0
__s2_len > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1003 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1004 ))[1] - __s2[1]); if (__s2_len > 1
__s2_len > 1Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) { __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1005 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1006 ))[2] - __s2[2]); if (__s2_len > 2
__s2_len > 2Description
TRUEnever evaluated
FALSEnever evaluated
&& __result == 0
__result == 0Description
TRUEnever evaluated
FALSEnever evaluated
) __result = (((const unsigned char *) (const char *) (
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]);
0
1007 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]);
0
1008 ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1009 BSDoptarg
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1010 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1011 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1012 )))); })
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1013 == 0
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1014 BSDoptarg =
never executed: BSDoptarg = ((void *)0) ;
0
1015 ((void *)0)
never executed: BSDoptarg = ((void *)0) ;
0
1016 ;
never executed: BSDoptarg = ((void *)0) ;
0
1017 argv[fopt_count++] = BSDoptarg;-
1018 break;
never executed: break;
0
1019 case
never executed: case 't':
't':
never executed: case 't':
0
1020 get_keytypes = 0;-
1021 tname = strtok(BSDoptarg, ",");-
1022 while (tname
tnameDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1023 int type = sshkey_type_from_name(tname);-
1024-
1025 switch (type) {-
1026 case
never executed: case KEY_DSA:
KEY_DSA:
never executed: case KEY_DSA:
0
1027 get_keytypes |= (1);-
1028 break;
never executed: break;
0
1029 case
never executed: case KEY_ECDSA:
KEY_ECDSA:
never executed: case KEY_ECDSA:
0
1030 get_keytypes |= (1<<2);-
1031 break;
never executed: break;
0
1032 case
never executed: case KEY_RSA:
KEY_RSA:
never executed: case KEY_RSA:
0
1033 get_keytypes |= (1<<1);-
1034 break;
never executed: break;
0
1035 case
never executed: case KEY_ED25519:
KEY_ED25519:
never executed: case KEY_ED25519:
0
1036 get_keytypes |= (1<<3);-
1037 break;
never executed: break;
0
1038 case
never executed: case KEY_XMSS:
KEY_XMSS:
never executed: case KEY_XMSS:
0
1039 get_keytypes |= (1<<4);-
1040 break;
never executed: break;
0
1041 case
never executed: case KEY_UNSPEC:
KEY_UNSPEC:
never executed: case KEY_UNSPEC:
0
1042 default
never executed: default:
:
never executed: default:
0
1043 fatal("Unknown key type \"%s\"", tname);-
1044 }
never executed: end of block
0
1045 tname = strtok(-
1046 ((void *)0)-
1047 , ",");-
1048 }
never executed: end of block
0
1049 break;
never executed: break;
0
1050 case
never executed: case '4':
'4':
never executed: case '4':
0
1051 IPv4or6 = -
1052 2-
1053 ;-
1054 break;
never executed: break;
0
1055 case
never executed: case '6':
'6':
never executed: case '6':
0
1056 IPv4or6 = -
1057 10-
1058 ;-
1059 break;
never executed: break;
0
1060 case
never executed: case '?':
'?':
never executed: case '?':
0
1061 default
never executed: default:
:
never executed: default:
0
1062 usage();-
1063 }
never executed: end of block
0
1064 }-
1065 if (BSDoptind == argc
BSDoptind == argcDescription
TRUEnever evaluated
FALSEnever evaluated
&& !fopt_count
!fopt_countDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1066 usage();
never executed: usage();
0
1067-
1068 log_init("ssh-keyscan", log_level, SYSLOG_FACILITY_USER, 1);-
1069-
1070 maxfd = fdlim_get(1);-
1071 if (maxfd < 0
maxfd < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1072 fatal("%s: fdlim_get: bad value", __progname);
never executed: fatal("%s: fdlim_get: bad value", __progname);
0
1073 if (maxfd > 256
maxfd > 256Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1074 maxfd = 256;
never executed: maxfd = 256;
0
1075 if ((
(maxfd - 10) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
maxfd - 10) <= 0
(maxfd - 10) <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1076 fatal("%s: not enough file descriptors", __progname);
never executed: fatal("%s: not enough file descriptors", __progname);
0
1077 if (maxfd > fdlim_get(0)
maxfd > fdlim_get(0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1078 fdlim_set(maxfd);
never executed: fdlim_set(maxfd);
0
1079 fdcon = xcalloc(maxfd, sizeof(con));-
1080-
1081 read_wait_nfdset = -
1082 (((-
1083 maxfd-
1084 ) + (((8 * (int) sizeof (__fd_mask))) - 1)) / ((8 * (int) sizeof (__fd_mask))))-
1085 ;-
1086 read_wait = xcalloc(read_wait_nfdset, sizeof(fd_mask));-
1087-
1088 for (j = 0; j < fopt_count
j < fopt_countDescription
TRUEnever evaluated
FALSEnever evaluated
; j++) {
0
1089 if (argv[j] ==
argv[j] == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1090 ((void *)0)
argv[j] == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1091 )-
1092 fp =
never executed: fp = stdin ;
0
1093 stdin
never executed: fp = stdin ;
0
1094 ;
never executed: fp = stdin ;
0
1095 else if ((
(fp = fopen(ar...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
fp = fopen(argv[j], "r")) ==
(fp = fopen(ar...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1096 ((void *)0)
(fp = fopen(ar...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1097 )-
1098 fatal("%s: %s: %s", __progname, argv[j],
never executed: fatal("%s: %s: %s", __progname, argv[j], strerror( (*__errno_location ()) ));
0
1099 strerror(
never executed: fatal("%s: %s: %s", __progname, argv[j], strerror( (*__errno_location ()) ));
0
1100 (*__errno_location ())
never executed: fatal("%s: %s: %s", __progname, argv[j], strerror( (*__errno_location ()) ));
0
1101 ));
never executed: fatal("%s: %s: %s", __progname, argv[j], strerror( (*__errno_location ()) ));
0
1102-
1103 while (getline(&line, &linesize, fp) != -1
getline(&line,...ize, fp) != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1104-
1105 if ((
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
cp =
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1106 (__extension__ (__builtin_constant_p (
__builtin_constant_p ( '#' )Description
TRUEnever evaluated
FALSEnever evaluated
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1107 '#'
__builtin_constant_p ( '#' )Description
TRUEnever evaluated
FALSEnever evaluated
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1108 )
__builtin_constant_p ( '#' )Description
TRUEnever evaluated
FALSEnever evaluated
&& !__builtin_constant_p (
!__builtin_constant_p ( line )Description
TRUEnever evaluated
FALSEnever evaluated
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1109 line
!__builtin_constant_p ( line )Description
TRUEnever evaluated
FALSEnever evaluated
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1110 )
!__builtin_constant_p ( line )Description
TRUEnever evaluated
FALSEnever evaluated
&& (
( '#' ) == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1111 '#'
( '#' ) == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1112 ) == '\0'
( '#' ) == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
? (char *) __rawmemchr (
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1113 line
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1114 ,
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1115 '#'
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1116 ) : __builtin_strchr (
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1117 line
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1118 ,
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1119 '#'
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1120 )))
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1121 ) ==
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1122 ((void *)0)
(cp = (__exten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1123 )-
1124 cp = line + strlen(line) - 1;
never executed: cp = line + strlen(line) - 1;
0
1125 while (cp >= line
cp >= lineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1126 if (*
*cp == ' 'Description
TRUEnever evaluated
FALSEnever evaluated
cp == ' '
*cp == ' 'Description
TRUEnever evaluated
FALSEnever evaluated
|| *
*cp == '\t'Description
TRUEnever evaluated
FALSEnever evaluated
cp == '\t'
*cp == '\t'Description
TRUEnever evaluated
FALSEnever evaluated
||
0
1127 *
*cp == '\n'Description
TRUEnever evaluated
FALSEnever evaluated
cp == '\n'
*cp == '\n'Description
TRUEnever evaluated
FALSEnever evaluated
|| *
*cp == '#'Description
TRUEnever evaluated
FALSEnever evaluated
cp == '#'
*cp == '#'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1128 *
never executed: *cp-- = '\0';
cp-- = '\0';
never executed: *cp-- = '\0';
0
1129 else-
1130 break;
never executed: break;
0
1131 }-
1132-
1133-
1134 if (*
*line == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
line == '\0'
*line == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1135 continue;
never executed: continue;
0
1136-
1137 do_host(line);-
1138 }
never executed: end of block
0
1139-
1140 if (ferror(fp)
ferror(fp)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1141 fatal("%s: %s: %s", __progname, argv[j],
never executed: fatal("%s: %s: %s", __progname, argv[j], strerror( (*__errno_location ()) ));
0
1142 strerror(
never executed: fatal("%s: %s: %s", __progname, argv[j], strerror( (*__errno_location ()) ));
0
1143 (*__errno_location ())
never executed: fatal("%s: %s: %s", __progname, argv[j], strerror( (*__errno_location ()) ));
0
1144 ));
never executed: fatal("%s: %s: %s", __progname, argv[j], strerror( (*__errno_location ()) ));
0
1145-
1146 fclose(fp);-
1147 }
never executed: end of block
0
1148 free(line);-
1149-
1150 while (BSDoptind < argc
BSDoptind < argcDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1151 do_host(argv[BSDoptind++]);
never executed: do_host(argv[BSDoptind++]);
0
1152-
1153 while (ncon > 0
ncon > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1154 conloop();
never executed: conloop();
0
1155-
1156 return
never executed: return (0);
(0);
never executed: return (0);
0
1157}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.2