OpenCoverage

sshconnect.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssh/src/sshconnect.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-
19-
20-
21-
22-
23-
24-
25-
26char *client_version_string = -
27 ((void *)0)-
28 ;-
29char *server_version_string = -
30 ((void *)0)-
31 ;-
32struct sshkey *previous_host_key = -
33 ((void *)0)-
34 ;-
35-
36static int matching_host_key_dns = 0;-
37-
38static pid_t proxy_command_pid = 0;-
39-
40-
41extern Options options;-
42extern char *__progname;-
43-
44static int show_other_keys(struct hostkeys *, struct sshkey *);-
45static void warn_changed_key(struct sshkey *);-
46-
47-
48static char *-
49expand_proxy_command(const char *proxy_command, const char *user,-
50 const char *host, int port)-
51{-
52 char *tmp, *ret, strport[-
53 32-
54 ];-
55-
56 snprintf(strport, sizeof strport, "%d", port);-
57 xasprintf(&tmp, "exec %s", proxy_command);-
58 ret = percent_expand(tmp, "h", host, "p", strport,-
59 "r", options.user, (char *)-
60 ((void *)0)-
61 );-
62 free(tmp);-
63 return
never executed: return ret;
ret;
never executed: return ret;
0
64}-
65-
66-
67-
68-
69-
70static int-
71ssh_proxy_fdpass_connect(struct ssh *ssh, const char *host, u_short port,-
72 const char *proxy_command)-
73{-
74 char *command_string;-
75 int sp[2], sock;-
76 pid_t pid;-
77 char *shell;-
78-
79 if ((
(shell = geten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
shell = getenv("SHELL")) ==
(shell = geten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
80 ((void *)0)
(shell = geten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
81 )-
82 shell =
never executed: shell = "/bin/sh" ;
0
83 "/bin/sh"
never executed: shell = "/bin/sh" ;
0
84 ;
never executed: shell = "/bin/sh" ;
0
85-
86 if (socketpair(
socketpair( 1 ...M , 0, sp) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
87 1
socketpair( 1 ...M , 0, sp) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
88 ,
socketpair( 1 ...M , 0, sp) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
89 SOCK_STREAM
socketpair( 1 ...M , 0, sp) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
90 , 0, sp) < 0
socketpair( 1 ...M , 0, sp) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
91 fatal("Could not create socketpair to communicate with "
never executed: fatal("Could not create socketpair to communicate with " "proxy dialer: %.100s", strerror( (*__errno_location ()) ));
0
92 "proxy dialer: %.100s", strerror(
never executed: fatal("Could not create socketpair to communicate with " "proxy dialer: %.100s", strerror( (*__errno_location ()) ));
0
93 (*__errno_location ())
never executed: fatal("Could not create socketpair to communicate with " "proxy dialer: %.100s", strerror( (*__errno_location ()) ));
0
94 ));
never executed: fatal("Could not create socketpair to communicate with " "proxy dialer: %.100s", strerror( (*__errno_location ()) ));
0
95-
96 command_string = expand_proxy_command(proxy_command, options.user,-
97 host, port);-
98 debug("Executing proxy dialer command: %.500s", command_string);-
99-
100-
101 if ((
(pid = fork()) == 0Description
TRUEnever evaluated
FALSEnever evaluated
pid = fork()) == 0
(pid = fork()) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
102 char *argv[10];-
103-
104 close(sp[1]);-
105-
106 if (sp[0] != 0
sp[0] != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
107 if (dup2(sp[0], 0) < 0
dup2(sp[0], 0) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
108 perror("dup2 stdin");
never executed: perror("dup2 stdin");
0
109 }
never executed: end of block
0
110 if (sp[0] != 1
sp[0] != 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
111 if (dup2(sp[0], 1) < 0
dup2(sp[0], 1) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
112 perror("dup2 stdout");
never executed: perror("dup2 stdout");
0
113 }
never executed: end of block
0
114 if (sp[0] >= 2
sp[0] >= 2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
115 close(sp[0]);
never executed: close(sp[0]);
0
116-
117-
118-
119-
120-
121 argv[0] = shell;-
122 argv[1] = "-c";-
123 argv[2] = command_string;-
124 argv[3] = -
125 ((void *)0)-
126 ;-
127-
128-
129-
130-
131-
132 execv(argv[0], argv);-
133 perror(argv[0]);-
134 exit(1);
never executed: exit(1);
0
135 }-
136-
137 if (pid < 0
pid < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
138 fatal("fork failed: %.100s", strerror(
never executed: fatal("fork failed: %.100s", strerror( (*__errno_location ()) ));
0
139 (*__errno_location ())
never executed: fatal("fork failed: %.100s", strerror( (*__errno_location ()) ));
0
140 ));
never executed: fatal("fork failed: %.100s", strerror( (*__errno_location ()) ));
0
141 close(sp[0]);-
142 free(command_string);-
143-
144 if ((
(sock = mm_rec...(sp[1])) == -1Description
TRUEnever evaluated
FALSEnever evaluated
sock = mm_receive_fd(sp[1])) == -1
(sock = mm_rec...(sp[1])) == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
145 fatal("proxy dialer did not pass back a connection");
never executed: fatal("proxy dialer did not pass back a connection");
0
146 close(sp[1]);-
147-
148 while (waitpid(pid,
waitpid(pid, (...)0) , 0) == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
149 ((void *)0)
waitpid(pid, (...)0) , 0) == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
150 , 0) == -1
waitpid(pid, (...)0) , 0) == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
151 if (-
152 (*
(*__errno_location ()) != 4Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) != 4Description
TRUEnever evaluated
FALSEnever evaluated
0
153 !=
(*__errno_location ()) != 4Description
TRUEnever evaluated
FALSEnever evaluated
0
154 4
(*__errno_location ()) != 4Description
TRUEnever evaluated
FALSEnever evaluated
0
155 )-
156 fatal("Couldn't wait for child: %s", strerror(
never executed: fatal("Couldn't wait for child: %s", strerror( (*__errno_location ()) ));
0
157 (*__errno_location ())
never executed: fatal("Couldn't wait for child: %s", strerror( (*__errno_location ()) ));
0
158 ));
never executed: fatal("Couldn't wait for child: %s", strerror( (*__errno_location ()) ));
0
159-
160-
161 if (ssh_packet_set_connection(ssh, sock, sock) ==
ssh_packet_set...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
162 ((void *)0)
ssh_packet_set...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
163 )-
164 return
never executed: return -1;
-1;
never executed: return -1;
0
165-
166 return
never executed: return 0;
0;
never executed: return 0;
0
167}-
168-
169-
170-
171-
172static int-
173ssh_proxy_connect(struct ssh *ssh, const char *host, u_short port,-
174 const char *proxy_command)-
175{-
176 char *command_string;-
177 int pin[2], pout[2];-
178 pid_t pid;-
179 char *shell;-
180-
181 if ((
(shell = geten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
shell = getenv("SHELL")) ==
(shell = geten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
182 ((void *)0)
(shell = geten...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
183 || *
*shell == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
shell == '\0'
*shell == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
)
0
184 shell =
never executed: shell = "/bin/sh" ;
0
185 "/bin/sh"
never executed: shell = "/bin/sh" ;
0
186 ;
never executed: shell = "/bin/sh" ;
0
187-
188-
189 if (pipe(pin) < 0
pipe(pin) < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| pipe(pout) < 0
pipe(pout) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
190 fatal("Could not create pipes to communicate with the proxy: %.100s",
never executed: fatal("Could not create pipes to communicate with the proxy: %.100s", strerror( (*__errno_location ()) ));
0
191 strerror(
never executed: fatal("Could not create pipes to communicate with the proxy: %.100s", strerror( (*__errno_location ()) ));
0
192 (*__errno_location ())
never executed: fatal("Could not create pipes to communicate with the proxy: %.100s", strerror( (*__errno_location ()) ));
0
193 ));
never executed: fatal("Could not create pipes to communicate with the proxy: %.100s", strerror( (*__errno_location ()) ));
0
194-
195 command_string = expand_proxy_command(proxy_command, options.user,-
196 host, port);-
197 debug("Executing proxy command: %.500s", command_string);-
198-
199-
200 if ((
(pid = fork()) == 0Description
TRUEnever evaluated
FALSEnever evaluated
pid = fork()) == 0
(pid = fork()) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
201 char *argv[10];-
202-
203-
204 close(pin[1]);-
205 if (pin[0] != 0
pin[0] != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
206 if (dup2(pin[0], 0) < 0
dup2(pin[0], 0) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
207 perror("dup2 stdin");
never executed: perror("dup2 stdin");
0
208 close(pin[0]);-
209 }
never executed: end of block
0
210 close(pout[0]);-
211 if (dup2(pout[1], 1) < 0
dup2(pout[1], 1) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
212 perror("dup2 stdout");
never executed: perror("dup2 stdout");
0
213-
214 close(pout[1]);-
215-
216-
217-
218 argv[0] = shell;-
219 argv[1] = "-c";-
220 argv[2] = command_string;-
221 argv[3] = -
222 ((void *)0)-
223 ;-
224-
225-
226-
227 mysignal(-
228 13-
229 ,-
230 ((__sighandler_t) 0)-
231 );-
232 execv(argv[0], argv);-
233 perror(argv[0]);-
234 exit(1);
never executed: exit(1);
0
235 }-
236-
237 if (pid < 0
pid < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
238 fatal("fork failed: %.100s", strerror(
never executed: fatal("fork failed: %.100s", strerror( (*__errno_location ()) ));
0
239 (*__errno_location ())
never executed: fatal("fork failed: %.100s", strerror( (*__errno_location ()) ));
0
240 ));
never executed: fatal("fork failed: %.100s", strerror( (*__errno_location ()) ));
0
241 else-
242 proxy_command_pid = pid;
never executed: proxy_command_pid = pid;
0
243-
244-
245 close(pin[0]);-
246 close(pout[1]);-
247-
248-
249 free(command_string);-
250-
251-
252 if (ssh_packet_set_connection(ssh, pout[0], pin[1]) ==
ssh_packet_set...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
253 ((void *)0)
ssh_packet_set...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
254 )-
255 return
never executed: return -1;
-1;
never executed: return -1;
0
256-
257 return
never executed: return 0;
0;
never executed: return 0;
0
258}-
259-
260void-
261ssh_kill_proxy_command(void)-
262{-
263-
264-
265-
266-
267 if (proxy_command_pid > 1
proxy_command_pid > 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
268 kill(proxy_command_pid,
never executed: kill(proxy_command_pid, 1 );
0
269 1
never executed: kill(proxy_command_pid, 1 );
0
270 );
never executed: kill(proxy_command_pid, 1 );
0
271}
never executed: end of block
0
272-
273-
274-
275-
276-
277-
278-
279static int-
280check_ifaddrs(const char *ifname, int af, const struct ifaddrs *ifaddrs,-
281 struct sockaddr_storage *resultp, socklen_t *rlenp)-
282{-
283 struct sockaddr_in6 *sa6;-
284 struct sockaddr_in *sa;-
285 struct in6_addr *v6addr;-
286 const struct ifaddrs *ifa;-
287 int allow_local;-
288-
289-
290-
291-
292-
293 for (allow_local = 0; allow_local < 2
allow_local < 2Description
TRUEnever evaluated
FALSEnever evaluated
; allow_local++) {
0
294 for (ifa = ifaddrs; ifa !=
ifa != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
295 ((void *)0)
ifa != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
296 ; ifa = ifa->ifa_next) {-
297 if (ifa->ifa_addr ==
ifa->ifa_addr == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
298 ((void *)0)
ifa->ifa_addr == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
299 || ifa->ifa_name ==
ifa->ifa_name == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
300 ((void *)0)
ifa->ifa_name == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
301 ||-
302 (
(ifa->ifa_flag... IFF_UP ) == 0Description
TRUEnever evaluated
FALSEnever evaluated
ifa->ifa_flags &
(ifa->ifa_flag... IFF_UP ) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
303 IFF_UP
(ifa->ifa_flag... IFF_UP ) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
304 ) == 0
(ifa->ifa_flag... IFF_UP ) == 0Description
TRUEnever evaluated
FALSEnever evaluated
||
0
305 ifa->ifa_addr->sa_family != af
ifa->ifa_addr->sa_family != afDescription
TRUEnever evaluated
FALSEnever evaluated
||
0
306 -
307 __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
308 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
309 ) && __builtin_constant_p (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
310 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
311 ) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
312 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
313 ), __s2_len = __builtin_strlen (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
314 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
315 ), (!((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
316 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
317 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
318 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
319 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
320 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
321 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
322 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
323 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
324 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
325 ,
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
326 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
327 ) : (__builtin_constant_p (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
328 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
329 ) && ((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
330 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
331 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
332 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
333 ) == 1) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
334 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
335 ), __s1_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
336 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
337 ) && ((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
338 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
339 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
340 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
341 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
342 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
343 ,
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
344 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
345 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
346 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
347 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
348 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
349 ))[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
350 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
351 ))[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
352 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
353 ))[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 *) ( ifa->ifa_name ))[3] - __s2[3]);
0
354 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( ifa->ifa_name ))[3] - __s2[3]);
0
355 ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
356 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
357 ) && ((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
358 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
359 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
360 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
361 ) == 1) && (__s2_len = __builtin_strlen (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
362 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
363 ), __s2_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
364 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
365 ) && ((size_t)(const void *)((
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
366 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
367 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
368 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
369 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
370 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
371 ,
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
372 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
373 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
374 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
375 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
376 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
377 ))[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
378 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
379 ))[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
380 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
381 ))[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 *) ( options.bind_interface ))[3] - __s2[3]);
0
382 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( options.bind_interface ))[3] - __s2[3]);
0
383 ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
384 ifa->ifa_name
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
385 ,
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
386 options.bind_interface
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
387 )))); })
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
388 != 0
__extension__ ... )))); }) != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
389 continue;
never executed: continue;
0
390 switch (ifa->ifa_addr->sa_family) {-
391 case
never executed: case 2 :
never executed: case 2 :
0
392 2
never executed: case 2 :
0
393 :
never executed: case 2 :
0
394 sa = (struct sockaddr_in *)ifa->ifa_addr;-
395 if (!allow_local
!allow_localDescription
TRUEnever evaluated
FALSEnever evaluated
&& sa->sin_addr.s_addr ==
sa->sin_addr.s...) 0x7f000001))Description
TRUEnever evaluated
FALSEnever evaluated
0
396
sa->sin_addr.s...) 0x7f000001))Description
TRUEnever evaluated
FALSEnever evaluated
0
397 __bswap_32 (((in_addr_t) 0x7f000001))
sa->sin_addr.s...) 0x7f000001))Description
TRUEnever evaluated
FALSEnever evaluated
0
398 )-
399 continue;
never executed: continue;
0
400 if (*
*rlenp < sizeo...t sockaddr_in)Description
TRUEnever evaluated
FALSEnever evaluated
rlenp < sizeof(struct sockaddr_in)
*rlenp < sizeo...t sockaddr_in)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
401 error("%s: v4 addr doesn't fit",-
402 __func__);-
403 return
never executed: return -1;
-1;
never executed: return -1;
0
404 }-
405 *rlenp = sizeof(struct sockaddr_in);-
406 memcpy(resultp, sa, *rlenp);-
407 return
never executed: return 0;
0;
never executed: return 0;
0
408 case
never executed: case 10 :
never executed: case 10 :
0
409 10
never executed: case 10 :
0
410 :
never executed: case 10 :
0
411 sa6 = (struct sockaddr_in6 *)ifa->ifa_addr;-
412 v6addr = &sa6->sin6_addr;-
413 if (!allow_local
!allow_localDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
414 (-
415 (
(__extension__...fe800000); }))Description
TRUEnever evaluated
FALSEnever evaluated
__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) (
(__extension__...fe800000); }))Description
TRUEnever evaluated
FALSEnever evaluated
0
416 v6addr
(__extension__...fe800000); }))Description
TRUEnever evaluated
FALSEnever evaluated
0
417 ); (__a->__in6_u.__u6_addr32[0] & __bswap_32 (0xffc00000)) == __bswap_32 (0xfe800000); }))
(__extension__...fe800000); }))Description
TRUEnever evaluated
FALSEnever evaluated
0
418 ||-
419 -
420 (
(__extension__...ap_32 (1); }))Description
TRUEnever evaluated
FALSEnever evaluated
__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) (
(__extension__...ap_32 (1); }))Description
TRUEnever evaluated
FALSEnever evaluated
0
421 v6addr
(__extension__...ap_32 (1); }))Description
TRUEnever evaluated
FALSEnever evaluated
0
422 ); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == 0 && __a->__in6_u.__u6_addr32[3] == __bswap_32 (1); }))
(__extension__...ap_32 (1); }))Description
TRUEnever evaluated
FALSEnever evaluated
0
423 ))-
424 continue;
never executed: continue;
0
425 if (*
*rlenp < sizeo... sockaddr_in6)Description
TRUEnever evaluated
FALSEnever evaluated
rlenp < sizeof(struct sockaddr_in6)
*rlenp < sizeo... sockaddr_in6)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
426 error("%s: v6 addr doesn't fit",-
427 __func__);-
428 return
never executed: return -1;
-1;
never executed: return -1;
0
429 }-
430 *rlenp = sizeof(struct sockaddr_in6);-
431 memcpy(resultp, sa6, *rlenp);-
432 return
never executed: return 0;
0;
never executed: return 0;
0
433 }-
434 }
never executed: end of block
0
435 }
never executed: end of block
0
436 return
never executed: return -1;
-1;
never executed: return -1;
0
437}-
438-
439-
440-
441-
442-
443static int-
444ssh_create_socket(struct addrinfo *ai)-
445{-
446 int sock, r;-
447 struct sockaddr_storage bindaddr;-
448 socklen_t bindaddrlen = 0;-
449 struct addrinfo hints, *res = -
450 ((void *)0)-
451 ;-
452-
453 struct ifaddrs *ifaddrs = -
454 ((void *)0)-
455 ;-
456-
457 char ntop[-
458 1025-
459 ];-
460-
461 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);-
462 if (sock < 0
sock < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
463 error("socket: %s", strerror(-
464 (*__errno_location ())-
465 ));-
466 return
never executed: return -1;
-1;
never executed: return -1;
0
467 }-
468 fcntl(sock, -
469 2-
470 , -
471 1-
472 );-
473-
474-
475 if (options.bind_address ==
options.bind_a...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
476 ((void *)0)
options.bind_a...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
477 && options.bind_interface ==
options.bind_i...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
478 ((void *)0)
options.bind_i...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
479 )-
480 return
never executed: return sock;
sock;
never executed: return sock;
0
481-
482 if (options.bind_address !=
options.bind_a...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
483 ((void *)0)
options.bind_a...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
484 ) {-
485 memset(&hints, 0, sizeof(hints));-
486 hints.ai_family = ai->ai_family;-
487 hints.ai_socktype = ai->ai_socktype;-
488 hints.ai_protocol = ai->ai_protocol;-
489 hints.ai_flags = -
490 0x0001-
491 ;-
492 if ((
(r = getaddrin...s, &res)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = getaddrinfo(options.bind_address,
(r = getaddrin...s, &res)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
493 ((void *)0)
(r = getaddrin...s, &res)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
494 ,
(r = getaddrin...s, &res)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
495 &hints, &res)) != 0
(r = getaddrin...s, &res)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
496 error("getaddrinfo: %s: %s", options.bind_address,-
497 ssh_gai_strerror(r));-
498 goto
never executed: goto fail;
fail;
never executed: goto fail;
0
499 }-
500 if (res ==
res == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
501 ((void *)0)
res == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
502 ) {-
503 error("getaddrinfo: no addrs");-
504 goto
never executed: goto fail;
fail;
never executed: goto fail;
0
505 }-
506 if (res->ai_addrlen > sizeof(bindaddr)
res->ai_addrle...zeof(bindaddr)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
507 error("%s: addr doesn't fit", __func__);-
508 goto
never executed: goto fail;
fail;
never executed: goto fail;
0
509 }-
510 memcpy(&bindaddr, res->ai_addr, res->ai_addrlen);-
511 bindaddrlen = res->ai_addrlen;-
512 }
never executed: end of block
else if (options.bind_interface !=
options.bind_i...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
513 ((void *)0)
options.bind_i...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
514 ) {-
515-
516 if ((
(r = getifaddr...ifaddrs)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = getifaddrs(&ifaddrs)) != 0
(r = getifaddr...ifaddrs)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
517 error("getifaddrs: %s: %s", options.bind_interface,-
518 strerror(-
519 (*__errno_location ())-
520 ));-
521 goto
never executed: goto fail;
fail;
never executed: goto fail;
0
522 }-
523 bindaddrlen = sizeof(bindaddr);-
524 if (check_ifaddrs(options.bind_interface, ai->ai_family,
check_ifaddrs(...daddrlen) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
525 ifaddrs, &bindaddr, &bindaddrlen) != 0
check_ifaddrs(...daddrlen) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
526 logit("getifaddrs: %s: no suitable addresses",-
527 options.bind_interface);-
528 goto
never executed: goto fail;
fail;
never executed: goto fail;
0
529 }-
530-
531-
532-
533 }
never executed: end of block
0
534 if ((
(r = getnamein..., 0, 1 )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = getnameinfo((struct sockaddr *)&bindaddr, bindaddrlen,
(r = getnamein..., 0, 1 )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
535 ntop, sizeof(ntop),
(r = getnamein..., 0, 1 )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
536 ((void *)0)
(r = getnamein..., 0, 1 )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
537 , 0,
(r = getnamein..., 0, 1 )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
538 1
(r = getnamein..., 0, 1 )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
539 )) != 0
(r = getnamein..., 0, 1 )) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
540 error("%s: getnameinfo failed: %s", __func__,-
541 ssh_gai_strerror(r));-
542 goto
never executed: goto fail;
fail;
never executed: goto fail;
0
543 }-
544 if (bind(sock, (struct sockaddr *)&bindaddr, bindaddrlen) != 0
bind(sock, (st...daddrlen) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
545 error("bind %s: %s", ntop, strerror(-
546 (*__errno_location ())-
547 ));-
548 goto
never executed: goto fail;
fail;
never executed: goto fail;
0
549 }-
550 debug("%s: bound to %s", __func__, ntop);-
551-
552 goto
never executed: goto out;
out;
never executed: goto out;
0
553fail:-
554 close(sock);-
555 sock = -1;-
556 out:
code before this statement never executed: out:
0
557 if (res !=
res != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
558 ((void *)0)
res != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
559 )-
560 freeaddrinfo(res);
never executed: freeaddrinfo(res);
0
561-
562 if (ifaddrs !=
ifaddrs != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
563 ((void *)0)
ifaddrs != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
564 )-
565 freeifaddrs(ifaddrs);
never executed: freeifaddrs(ifaddrs);
0
566-
567 return
never executed: return sock;
sock;
never executed: return sock;
0
568}-
569-
570-
571-
572-
573-
574-
575static int-
576waitrfd(int fd, int *timeoutp)-
577{-
578 struct pollfd pfd;-
579 struct timeval t_start;-
580 int oerrno, r;-
581-
582 monotime_tv(&t_start);-
583 pfd.fd = fd;-
584 pfd.events = -
585 0x001-
586 ;-
587 for (; *
*timeoutp >= 0Description
TRUEnever evaluated
FALSEnever evaluated
timeoutp >= 0
*timeoutp >= 0Description
TRUEnever evaluated
FALSEnever evaluated
;) {
0
588 r = poll(&pfd, 1, *timeoutp);-
589 oerrno = -
590 (*__errno_location ())-
591 ;-
592 ms_subtract_diff(&t_start, timeoutp);-
593 -
594 (*__errno_location ()) -
595 = oerrno;-
596 if (r > 0
r > 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
597 return
never executed: return 0;
0;
never executed: return 0;
0
598 else if (r == -1
r == -1Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
599 (*
(*__errno_location ()) != 11Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) != 11Description
TRUEnever evaluated
FALSEnever evaluated
0
600 !=
(*__errno_location ()) != 11Description
TRUEnever evaluated
FALSEnever evaluated
0
601 11
(*__errno_location ()) != 11Description
TRUEnever evaluated
FALSEnever evaluated
0
602 )-
603 return
never executed: return -1;
-1;
never executed: return -1;
0
604 else if (r == 0
r == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
605 break;
never executed: break;
0
606 }
never executed: end of block
0
607-
608 -
609(*__errno_location ()) -
610 = -
611 110-
612 ;-
613 return
never executed: return -1;
-1;
never executed: return -1;
0
614}-
615-
616static int-
617timeout_connect(int sockfd, const struct sockaddr *serv_addr,-
618 socklen_t addrlen, int *timeoutp)-
619{-
620 int optval = 0;-
621 socklen_t optlen = sizeof(optval);-
622-
623-
624 if (*
*timeoutp <= 0Description
TRUEnever evaluated
FALSEnever evaluated
timeoutp <= 0
*timeoutp <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
625 return
never executed: return connect(sockfd, serv_addr, addrlen);
connect(sockfd, serv_addr, addrlen);
never executed: return connect(sockfd, serv_addr, addrlen);
0
626-
627 set_nonblock(sockfd);-
628 if (connect(sockfd, serv_addr, addrlen) == 0
connect(sockfd... addrlen) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
629-
630 unset_nonblock(sockfd);-
631 return
never executed: return 0;
0;
never executed: return 0;
0
632 } else if (-
633 (*
(*__errno_location ()) != 115Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) != 115Description
TRUEnever evaluated
FALSEnever evaluated
0
634 !=
(*__errno_location ()) != 115Description
TRUEnever evaluated
FALSEnever evaluated
0
635 115
(*__errno_location ()) != 115Description
TRUEnever evaluated
FALSEnever evaluated
0
636 )-
637 return
never executed: return -1;
-1;
never executed: return -1;
0
638-
639 if (waitrfd(sockfd, timeoutp) == -1
waitrfd(sockfd...imeoutp) == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
640 return
never executed: return -1;
-1;
never executed: return -1;
0
641-
642-
643 if (getsockopt(sockfd,
getsockopt(soc...&optlen) == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
644 1
getsockopt(soc...&optlen) == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
645 ,
getsockopt(soc...&optlen) == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
646 4
getsockopt(soc...&optlen) == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
647 , &optval, &optlen) == -1
getsockopt(soc...&optlen) == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
648 debug("getsockopt: %s", strerror(-
649 (*__errno_location ())-
650 ));-
651 return
never executed: return -1;
-1;
never executed: return -1;
0
652 }-
653 if (optval != 0
optval != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
654 -
655 (*__errno_location ()) -
656 = optval;-
657 return
never executed: return -1;
-1;
never executed: return -1;
0
658 }-
659 unset_nonblock(sockfd);-
660 return
never executed: return 0;
0;
never executed: return 0;
0
661}-
662static int-
663ssh_connect_direct(struct ssh *ssh, const char *host, struct addrinfo *aitop,-
664 struct sockaddr_storage *hostaddr, u_short port, int family,-
665 int connection_attempts, int *timeout_ms, int want_keepalive)-
666{-
667 int on = 1;-
668 int oerrno, sock = -1, attempt;-
669 char ntop[-
670 1025-
671 ], strport[-
672 32-
673 ];-
674 struct addrinfo *ai;-
675-
676 debug2("%s", __func__);-
677 memset(ntop, 0, sizeof(ntop));-
678 memset(strport, 0, sizeof(strport));-
679-
680 for (attempt = 0; attempt < connection_attempts
attempt < connection_attemptsDescription
TRUEnever evaluated
FALSEnever evaluated
; attempt++) {
0
681 if (attempt > 0
attempt > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
682-
683 sleep(1);-
684 debug("Trying again...");-
685 }
never executed: end of block
0
686-
687-
688-
689-
690 for (ai = aitop; ai
aiDescription
TRUEnever evaluated
FALSEnever evaluated
; ai = ai->ai_next) {
0
691 if (ai->ai_family !=
ai->ai_family != 2Description
TRUEnever evaluated
FALSEnever evaluated
0
692 2
ai->ai_family != 2Description
TRUEnever evaluated
FALSEnever evaluated
0
693 &&-
694 ai->ai_family !=
ai->ai_family != 10Description
TRUEnever evaluated
FALSEnever evaluated
0
695 10
ai->ai_family != 10Description
TRUEnever evaluated
FALSEnever evaluated
0
696 ) {-
697 -
698 (*__errno_location ()) -
699 = -
700 97-
701 ;-
702 continue;
never executed: continue;
0
703 }-
704 if (getnameinfo(ai->ai_addr, ai->ai_addrlen,
getnameinfo(ai..., 1 | 2 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
705 ntop, sizeof(ntop), strport, sizeof(strport),
getnameinfo(ai..., 1 | 2 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
706
getnameinfo(ai..., 1 | 2 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
707 1
getnameinfo(ai..., 1 | 2 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
708 |
getnameinfo(ai..., 1 | 2 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
709 2
getnameinfo(ai..., 1 | 2 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
710 ) != 0
getnameinfo(ai..., 1 | 2 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
711 oerrno = -
712 (*__errno_location ())-
713 ;-
714 error("%s: getnameinfo failed", __func__);-
715 -
716 (*__errno_location ()) -
717 = oerrno;-
718 continue;
never executed: continue;
0
719 }-
720 debug("Connecting to %.200s [%.100s] port %s.",-
721 host, ntop, strport);-
722-
723-
724 sock = ssh_create_socket(ai);-
725 if (sock < 0
sock < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
726-
727 -
728 (*__errno_location ()) -
729 = 0;-
730 continue;
never executed: continue;
0
731 }-
732-
733 if (timeout_connect(sock, ai->ai_addr, ai->ai_addrlen,
timeout_connec...meout_ms) >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
734 timeout_ms) >= 0
timeout_connec...meout_ms) >= 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
735-
736 memcpy(hostaddr, ai->ai_addr, ai->ai_addrlen);-
737 break;
never executed: break;
0
738 } else {-
739 oerrno = -
740 (*__errno_location ())-
741 ;-
742 debug("connect to address %s port %s: %s",-
743 ntop, strport, strerror(-
744 (*__errno_location ())-
745 ));-
746 close(sock);-
747 sock = -1;-
748 -
749 (*__errno_location ()) -
750 = oerrno;-
751 }
never executed: end of block
0
752 }-
753 if (sock != -1
sock != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
754 break;
never executed: break;
0
755 }
never executed: end of block
0
756-
757-
758 if (sock == -1
sock == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
759 error("ssh: connect to host %s port %s: %s",-
760 host, strport, -
761 (*__errno_location ()) -
762 == 0 ? "failure" : strerror(-
763 (*__errno_location ())-
764 ));-
765 return
never executed: return -1;
-1;
never executed: return -1;
0
766 }-
767-
768 debug("Connection established.");-
769-
770-
771 if (want_keepalive
want_keepaliveDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
772 setsockopt(sock,
setsockopt(soc...izeof(on)) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
773 1
setsockopt(soc...izeof(on)) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
774 ,
setsockopt(soc...izeof(on)) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
775 9
setsockopt(soc...izeof(on)) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
776 , (void *)&on,
setsockopt(soc...izeof(on)) < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
777 sizeof(on)) < 0
setsockopt(soc...izeof(on)) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
778 error("setsockopt SO_KEEPALIVE: %.100s", strerror(
never executed: error("setsockopt SO_KEEPALIVE: %.100s", strerror( (*__errno_location ()) ));
0
779 (*__errno_location ())
never executed: error("setsockopt SO_KEEPALIVE: %.100s", strerror( (*__errno_location ()) ));
0
780 ));
never executed: error("setsockopt SO_KEEPALIVE: %.100s", strerror( (*__errno_location ()) ));
0
781-
782-
783 if (ssh_packet_set_connection(ssh, sock, sock) ==
ssh_packet_set...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
784 ((void *)0)
ssh_packet_set...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
785 )-
786 return
never executed: return -1;
-1;
never executed: return -1;
0
787-
788 return
never executed: return 0;
0;
never executed: return 0;
0
789}-
790-
791int-
792ssh_connect(struct ssh *ssh, const char *host, struct addrinfo *addrs,-
793 struct sockaddr_storage *hostaddr, u_short port, int family,-
794 int connection_attempts, int *timeout_ms, int want_keepalive)-
795{-
796 if (options.proxy_command ==
options.proxy_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
797 ((void *)0)
options.proxy_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
798 ) {-
799 return
never executed: return ssh_connect_direct(ssh, host, addrs, hostaddr, port, family, connection_attempts, timeout_ms, want_keepalive);
ssh_connect_direct(ssh, host, addrs, hostaddr, port,
never executed: return ssh_connect_direct(ssh, host, addrs, hostaddr, port, family, connection_attempts, timeout_ms, want_keepalive);
0
800 family, connection_attempts, timeout_ms, want_keepalive);
never executed: return ssh_connect_direct(ssh, host, addrs, hostaddr, port, family, connection_attempts, timeout_ms, want_keepalive);
0
801 } else if (-
802 __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
803 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
804 ) && __builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
805 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
806 ) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
807 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
808 ), __s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
809 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
810 ), (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
811 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
812 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
813 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
814 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
815 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
816 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
817 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
818 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
819 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
820 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
821 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
822 ) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
823 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
824 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
825 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
826 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
827 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
828 ) == 1) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
829 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
830 ), __s1_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
831 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
832 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
833 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
834 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
835 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
836 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
837 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
838 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
839 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
840 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
841 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
842 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
843 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
844 ))[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
845 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
846 ))[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
847 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
848 ))[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 *) ( options.proxy_command ))[3] - __s2[3]);
0
849 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( options.proxy_command ))[3] - __s2[3]);
0
850 ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
851 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
852 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
853 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
854 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
855 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
856 ) == 1) && (__s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
857 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
858 ), __s2_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
859 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
860 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
861 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
862 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
863 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
864 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
865 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
866 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
867 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
868 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
869 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
870 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
871 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
872 ))[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
873 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
874 ))[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
875 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
876 ))[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
877 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]);
0
878 ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
879 options.proxy_command
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
880 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
881 "-"
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
882 )))); })
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
883 == 0
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
884 if ((
(ssh_packet_se...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
ssh_packet_set_connection(ssh,
(ssh_packet_se...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
885
(ssh_packet_se...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
886 0
(ssh_packet_se...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
887 ,
(ssh_packet_se...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
888 1
(ssh_packet_se...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
889 )) ==
(ssh_packet_se...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
890 ((void *)0)
(ssh_packet_se...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
891 )-
892 return
never executed: return -1;
-1;
never executed: return -1;
0
893 return
never executed: return 0;
0;
never executed: return 0;
0
894 } else if (options.proxy_use_fdpass
options.proxy_use_fdpassDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
895 return
never executed: return ssh_proxy_fdpass_connect(ssh, host, port, options.proxy_command);
ssh_proxy_fdpass_connect(ssh, host, port,
never executed: return ssh_proxy_fdpass_connect(ssh, host, port, options.proxy_command);
0
896 options.proxy_command);
never executed: return ssh_proxy_fdpass_connect(ssh, host, port, options.proxy_command);
0
897 }-
898 return
never executed: return ssh_proxy_connect(ssh, host, port, options.proxy_command);
ssh_proxy_connect(ssh, host, port, options.proxy_command);
never executed: return ssh_proxy_connect(ssh, host, port, options.proxy_command);
0
899}-
900-
901static void-
902send_client_banner(int connection_out, int minor1)-
903{-
904-
905 xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n",-
906 2, 0, "OpenSSH_7.8");-
907 if (atomicio((ssize_t (*)(int, void *, size_t))write, connection_out, client_version_string,
atomicio((ssiz...ersion_string)Description
TRUEnever evaluated
FALSEnever evaluated
0
908 strlen(client_version_string)) != strlen(client_version_string)
atomicio((ssiz...ersion_string)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
909 fatal("write: %.100s", strerror(
never executed: fatal("write: %.100s", strerror( (*__errno_location ()) ));
0
910 (*__errno_location ())
never executed: fatal("write: %.100s", strerror( (*__errno_location ()) ));
0
911 ));
never executed: fatal("write: %.100s", strerror( (*__errno_location ()) ));
0
912 chop(client_version_string);-
913 debug("Local version string %.100s", client_version_string);-
914}
never executed: end of block
0
915-
916-
917-
918-
919-
920void-
921ssh_exchange_identification(int timeout_ms)-
922{-
923 char buf[256], remote_version[256];-
924 int remote_major, remote_minor, mismatch;-
925 int connection_in = ssh_packet_get_connection_in(active_state);-
926 int connection_out = ssh_packet_get_connection_out(active_state);-
927 u_int i, n;-
928 size_t len;-
929 int rc;-
930-
931 send_client_banner(connection_out, 0);-
932-
933-
934 for (n = 0;;) {-
935 for (i = 0; i < sizeof(buf) - 1
i < sizeof(buf) - 1Description
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
936 if (timeout_ms > 0
timeout_ms > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
937 rc = waitrfd(connection_in, &timeout_ms);-
938 if (rc == -1
rc == -1Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
939 (*
(*__errno_location ()) == 110Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 110Description
TRUEnever evaluated
FALSEnever evaluated
0
940 ==
(*__errno_location ()) == 110Description
TRUEnever evaluated
FALSEnever evaluated
0
941 110
(*__errno_location ()) == 110Description
TRUEnever evaluated
FALSEnever evaluated
0
942 ) {-
943 fatal("Connection timed out during "-
944 "banner exchange");-
945 }
never executed: end of block
else if (rc == -1
rc == -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
946 fatal("%s: %s",-
947 __func__, strerror(-
948 (*__errno_location ())-
949 ));-
950 }
never executed: end of block
0
951 }
never executed: end of block
0
952-
953 len = atomicio(read, connection_in, &buf[i], 1);-
954 if (len != 1
len != 1Description
TRUEnever evaluated
FALSEnever evaluated
&&
0
955 (*
(*__errno_location ()) == 32Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 32Description
TRUEnever evaluated
FALSEnever evaluated
0
956 ==
(*__errno_location ()) == 32Description
TRUEnever evaluated
FALSEnever evaluated
0
957 32
(*__errno_location ()) == 32Description
TRUEnever evaluated
FALSEnever evaluated
0
958 )-
959 fatal("ssh_exchange_identification: "
never executed: fatal("ssh_exchange_identification: " "Connection closed by remote host");
0
960 "Connection closed by remote host");
never executed: fatal("ssh_exchange_identification: " "Connection closed by remote host");
0
961 else if (len != 1
len != 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
962 fatal("ssh_exchange_identification: "
never executed: fatal("ssh_exchange_identification: " "read: %.100s", strerror( (*__errno_location ()) ));
0
963 "read: %.100s", strerror(
never executed: fatal("ssh_exchange_identification: " "read: %.100s", strerror( (*__errno_location ()) ));
0
964 (*__errno_location ())
never executed: fatal("ssh_exchange_identification: " "read: %.100s", strerror( (*__errno_location ()) ));
0
965 ));
never executed: fatal("ssh_exchange_identification: " "read: %.100s", strerror( (*__errno_location ()) ));
0
966 if (buf[i] == '\r'
buf[i] == '\r'Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
967 buf[i] = '\n';-
968 buf[i + 1] = 0;-
969 continue;
never executed: continue;
0
970 }-
971 if (buf[i] == '\n'
buf[i] == '\n'Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
972 buf[i + 1] = 0;-
973 break;
never executed: break;
0
974 }-
975 if (++
++n > 65536Description
TRUEnever evaluated
FALSEnever evaluated
n > 65536
++n > 65536Description
TRUEnever evaluated
FALSEnever evaluated
)
0
976 fatal("ssh_exchange_identification: "
never executed: fatal("ssh_exchange_identification: " "No banner received");
0
977 "No banner received");
never executed: fatal("ssh_exchange_identification: " "No banner received");
0
978 }
never executed: end of block
0
979 buf[sizeof(buf) - 1] = 0;-
980 if (-
981 (
(__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
982 4
__builtin_constant_p ( 4 )Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
983 )
__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
984 buf
__builtin_constant_p ( buf )Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
985 )
__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
986 buf
strlen ( buf )...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
987 ) < ((size_t) (
strlen ( buf )...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
988 4
strlen ( buf )...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
989 ))
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
990 "SSH-"
__builtin_cons...t_p ( "SSH-" )Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
991 )
__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
992 "SSH-"
strlen ( "SSH-...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
993 ) < ((size_t) (
strlen ( "SSH-...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
994 4
strlen ( "SSH-...size_t) ( 4 ))Description
TRUEnever evaluated
FALSEnever evaluated
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
995 ))
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
996 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
997 ) && __builtin_constant_p (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
998 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
999 ) && (__s1_len = __builtin_strlen (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1000 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1001 ), __s2_len = __builtin_strlen (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1002 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1003 ), (!((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1004 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1005 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1006 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1007 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1008 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1009 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1010 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1011 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1012 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1013 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1014 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1015 ) : (__builtin_constant_p (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1016 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1017 ) && ((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1018 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1019 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1020 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1021 ) == 1) && (__s1_len = __builtin_strlen (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1022 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1023 ), __s1_len < 4) ? (__builtin_constant_p (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1024 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1025 ) && ((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1026 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1027 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1028 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1029 ) == 1) ? __builtin_strcmp (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1030 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1031 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1032 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1033 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1034 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1035 ); int __result = (((const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1036 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1037 ))[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
1038 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1039 ))[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
1040 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1041 ))[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
1042 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( buf ))[3] - __s2[3]);
0
1043 ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1044 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1045 ) && ((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1046 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1047 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1048 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1049 ) == 1) && (__s2_len = __builtin_strlen (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1050 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1051 ), __s2_len < 4) ? (__builtin_constant_p (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1052 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1053 ) && ((size_t)(const void *)((
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1054 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1055 ) + 1) - (size_t)(const void *)(
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1056 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1057 ) == 1) ? __builtin_strcmp (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1058 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1059 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1060 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1061 ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1062 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1063 ); int __result = (((const unsigned char *) (const char *) (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1064 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1065 ))[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
1066 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1067 ))[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
1068 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1069 ))[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
1070 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( "SSH-" ))[3] - __s2[3]);
0
1071 ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1072 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1073 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1074 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1075 )))); }) : strncmp (
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1076 buf
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1077 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1078 "SSH-"
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1079 ,
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1080 4
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1081 )))
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1082 == 0
(__extension__..." , 4 ))) == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1083 break;
never executed: break;
0
1084 debug("ssh_exchange_identification: %s", buf);-
1085 }
never executed: end of block
0
1086 server_version_string = xstrdup(buf);-
1087-
1088-
1089-
1090-
1091-
1092 if (sscanf(server_version_string, "SSH-%d.%d-%[^\n]\n",
sscanf(server_..._version) != 3Description
TRUEnever evaluated
FALSEnever evaluated
0
1093 &remote_major, &remote_minor, remote_version) != 3
sscanf(server_..._version) != 3Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1094 fatal("Bad remote protocol version identification: '%.100s'", buf);
never executed: fatal("Bad remote protocol version identification: '%.100s'", buf);
0
1095 debug("Remote protocol version %d.%d, remote software version %.100s",-
1096 remote_major, remote_minor, remote_version);-
1097-
1098 active_state->compat = compat_datafellows(remote_version);-
1099 mismatch = 0;-
1100-
1101 switch (remote_major) {-
1102 case
never executed: case 2:
2:
never executed: case 2:
0
1103 break;
never executed: break;
0
1104 case
never executed: case 1:
1:
never executed: case 1:
0
1105 if (remote_minor != 99
remote_minor != 99Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1106 mismatch = 1;
never executed: mismatch = 1;
0
1107 break;
never executed: break;
0
1108 default
never executed: default:
:
never executed: default:
0
1109 mismatch = 1;-
1110 break;
never executed: break;
0
1111 }-
1112 if (mismatch
mismatchDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1113 fatal("Protocol major versions differ: %d vs. %d",
never executed: fatal("Protocol major versions differ: %d vs. %d", 2, remote_major);
0
1114 2, remote_major);
never executed: fatal("Protocol major versions differ: %d vs. %d", 2, remote_major);
0
1115 if ((
(datafellows &...00002000) != 0Description
TRUEnever evaluated
FALSEnever evaluated
datafellows & 0x00002000) != 0
(datafellows &...00002000) != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1116 logit("Server version \"%.100s\" uses unsafe RSA signature "
never executed: logit("Server version \"%.100s\" uses unsafe RSA signature " "scheme; disabling use of RSA keys", remote_version);
0
1117 "scheme; disabling use of RSA keys", remote_version);
never executed: logit("Server version \"%.100s\" uses unsafe RSA signature " "scheme; disabling use of RSA keys", remote_version);
0
1118 chop(server_version_string);-
1119}
never executed: end of block
0
1120-
1121-
1122static int-
1123confirm(const char *prompt)-
1124{-
1125 const char *msg, *again = "Please type 'yes' or 'no': ";-
1126 char *p;-
1127 int ret = -1;-
1128-
1129 if (options.batch_mode
options.batch_modeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1130 return
never executed: return 0;
0;
never executed: return 0;
0
1131 for (msg = prompt;;msg = again) {-
1132 p = read_passphrase(msg, 0x0001);-
1133 if (p ==
p == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1134 ((void *)0)
p == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1135 )-
1136 return
never executed: return 0;
0;
never executed: return 0;
0
1137 p[-
1138 __builtin_strcspn (-
1139 p-
1140 , -
1141 "\n"-
1142 )-
1143 ] = '\0';-
1144 if (p[0] == '\0'
p[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
|| strcasecmp(p, "no") == 0
strcasecmp(p, "no") == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1145 ret = 0;
never executed: ret = 0;
0
1146 else if (strcasecmp(p, "yes") == 0
strcasecmp(p, "yes") == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1147 ret = 1;
never executed: ret = 1;
0
1148 free(p);-
1149 if (ret != -1
ret != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1150 return
never executed: return ret;
ret;
never executed: return ret;
0
1151 }
never executed: end of block
0
1152}
never executed: end of block
0
1153-
1154static int-
1155check_host_cert(const char *host, const struct sshkey *key)-
1156{-
1157 const char *reason;-
1158 int r;-
1159-
1160 if (sshkey_cert_check_authority(key, 1, 0, host, &reason) != 0
sshkey_cert_ch... &reason) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1161 error("%s", reason);-
1162 return
never executed: return 0;
0;
never executed: return 0;
0
1163 }-
1164 if (sshbuf_len(key->cert->critical) != 0
sshbuf_len(key...critical) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1165 error("Certificate for %s contains unsupported "-
1166 "critical options(s)", host);-
1167 return
never executed: return 0;
0;
never executed: return 0;
0
1168 }-
1169 if ((
(r = sshkey_ch...orithms)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
r = sshkey_check_cert_sigtype(key,
(r = sshkey_ch...orithms)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1170 options.ca_sign_algorithms)) != 0
(r = sshkey_ch...orithms)) != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1171 logit("%s: certificate signature algorithm %s: %s", __func__,-
1172 (key->cert == -
1173 ((void *)0) -
1174 || key->cert->signature_type == -
1175 ((void *)0)-
1176 ) ?-
1177 "(null)" : key->cert->signature_type, ssh_err(r));-
1178 return
never executed: return 0;
0;
never executed: return 0;
0
1179 }-
1180-
1181 return
never executed: return 1;
1;
never executed: return 1;
0
1182}-
1183-
1184static int-
1185sockaddr_is_local(struct sockaddr *hostaddr)-
1186{-
1187 switch (hostaddr->sa_family) {-
1188 case
never executed: case 2 :
never executed: case 2 :
0
1189 2
never executed: case 2 :
0
1190 :
never executed: case 2 :
0
1191 return
never executed: return ( __bswap_32 ( ((struct sockaddr_in *)hostaddr)-> sin_addr.s_addr ) >> 24) == 127 ;
(
never executed: return ( __bswap_32 ( ((struct sockaddr_in *)hostaddr)-> sin_addr.s_addr ) >> 24) == 127 ;
0
1192 __bswap_32 (
never executed: return ( __bswap_32 ( ((struct sockaddr_in *)hostaddr)-> sin_addr.s_addr ) >> 24) == 127 ;
0
1193 ((struct sockaddr_in *)hostaddr)-> sin_addr.s_addr
never executed: return ( __bswap_32 ( ((struct sockaddr_in *)hostaddr)-> sin_addr.s_addr ) >> 24) == 127 ;
0
1194 )
never executed: return ( __bswap_32 ( ((struct sockaddr_in *)hostaddr)-> sin_addr.s_addr ) >> 24) == 127 ;
0
1195
never executed: return ( __bswap_32 ( ((struct sockaddr_in *)hostaddr)-> sin_addr.s_addr ) >> 24) == 127 ;
0
1196 >> 24) ==
never executed: return ( __bswap_32 ( ((struct sockaddr_in *)hostaddr)-> sin_addr.s_addr ) >> 24) == 127 ;
0
1197 127
never executed: return ( __bswap_32 ( ((struct sockaddr_in *)hostaddr)-> sin_addr.s_addr ) >> 24) == 127 ;
0
1198 ;
never executed: return ( __bswap_32 ( ((struct sockaddr_in *)hostaddr)-> sin_addr.s_addr ) >> 24) == 127 ;
0
1199 case
never executed: case 10 :
never executed: case 10 :
0
1200 10
never executed: case 10 :
0
1201 :
never executed: case 10 :
0
1202 return
never executed: return (__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) ( &(((struct sockaddr_in6 *)hostaddr)->sin6_addr) ); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == 0 && __a->__in6_u.__u6_addr32[3] == __bswap_32 (1); })) ;
never executed: return (__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) ( &(((struct sockaddr_in6 *)hostaddr)->sin6_addr) ); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == 0 && __a->__in6_u.__u6_addr32[3] == __bswap_32 (1); })) ;
0
1203 (__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) (
never executed: return (__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) ( &(((struct sockaddr_in6 *)hostaddr)->sin6_addr) ); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == 0 && __a->__in6_u.__u6_addr32[3] == __bswap_32 (1); })) ;
0
1204 &(((struct sockaddr_in6 *)hostaddr)->sin6_addr)
never executed: return (__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) ( &(((struct sockaddr_in6 *)hostaddr)->sin6_addr) ); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == 0 && __a->__in6_u.__u6_addr32[3] == __bswap_32 (1); })) ;
0
1205 ); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == 0 && __a->__in6_u.__u6_addr32[3] == __bswap_32 (1); }))
never executed: return (__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) ( &(((struct sockaddr_in6 *)hostaddr)->sin6_addr) ); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == 0 && __a->__in6_u.__u6_addr32[3] == __bswap_32 (1); })) ;
0
1206
never executed: return (__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) ( &(((struct sockaddr_in6 *)hostaddr)->sin6_addr) ); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == 0 && __a->__in6_u.__u6_addr32[3] == __bswap_32 (1); })) ;
0
1207 ;
never executed: return (__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) ( &(((struct sockaddr_in6 *)hostaddr)->sin6_addr) ); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == 0 && __a->__in6_u.__u6_addr32[3] == __bswap_32 (1); })) ;
0
1208 default
never executed: default:
:
never executed: default:
0
1209 return
never executed: return 0;
0;
never executed: return 0;
0
1210 }-
1211}-
1212-
1213-
1214-
1215-
1216-
1217void-
1218get_hostfile_hostname_ipaddr(char *hostname, struct sockaddr *hostaddr,-
1219 u_short port, char **hostfile_hostname, char **hostfile_ipaddr)-
1220{-
1221 char ntop[-
1222 1025-
1223 ];-
1224 socklen_t addrlen;-
1225-
1226 switch (hostaddr ==
hostaddr == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1227 ((void *)0)
hostaddr == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1228 ? -1 : hostaddr->sa_family) {-
1229 case
never executed: case -1:
-1:
never executed: case -1:
0
1230 addrlen = 0;-
1231 break;
never executed: break;
0
1232 case
never executed: case 2 :
never executed: case 2 :
0
1233 2
never executed: case 2 :
0
1234 :
never executed: case 2 :
0
1235 addrlen = sizeof(struct sockaddr_in);-
1236 break;
never executed: break;
0
1237 case
never executed: case 10 :
never executed: case 10 :
0
1238 10
never executed: case 10 :
0
1239 :
never executed: case 10 :
0
1240 addrlen = sizeof(struct sockaddr_in6);-
1241 break;
never executed: break;
0
1242 default
never executed: default:
:
never executed: default:
0
1243 addrlen = sizeof(struct sockaddr);-
1244 break;
never executed: break;
0
1245 }-
1246-
1247-
1248-
1249-
1250-
1251 if (hostfile_ipaddr !=
hostfile_ipaddr != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1252 ((void *)0)
hostfile_ipaddr != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1253 ) {-
1254 if (options.proxy_command ==
options.proxy_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1255 ((void *)0)
options.proxy_...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1256 ) {-
1257 if (getnameinfo(hostaddr, addrlen,
getnameinfo(ho... , 0, 1 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1258 ntop, sizeof(ntop),
getnameinfo(ho... , 0, 1 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1259 ((void *)0)
getnameinfo(ho... , 0, 1 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1260 , 0,
getnameinfo(ho... , 0, 1 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1261 1
getnameinfo(ho... , 0, 1 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1262 ) != 0
getnameinfo(ho... , 0, 1 ) != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1263 fatal("%s: getnameinfo failed", __func__);
never executed: fatal("%s: getnameinfo failed", __func__);
0
1264 *hostfile_ipaddr = put_host_port(ntop, port);-
1265 }
never executed: end of block
else {
0
1266 *hostfile_ipaddr = xstrdup("<no hostip for proxy "-
1267 "command>");-
1268 }
never executed: end of block
0
1269 }-
1270-
1271-
1272-
1273-
1274-
1275-
1276-
1277 if (hostfile_hostname !=
hostfile_hostn...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1278 ((void *)0)
hostfile_hostn...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1279 ) {-
1280 if (options.host_key_alias !=
options.host_k...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1281 ((void *)0)
options.host_k...!= ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1282 ) {-
1283 *hostfile_hostname = xstrdup(options.host_key_alias);-
1284 debug("using hostkeyalias: %s", *hostfile_hostname);-
1285 }
never executed: end of block
else {
0
1286 *hostfile_hostname = put_host_port(hostname, port);-
1287 }
never executed: end of block
0
1288 }-
1289}
never executed: end of block
0
1290static int-
1291check_host_key(char *hostname, struct sockaddr *hostaddr, u_short port,-
1292 struct sshkey *host_key, int readonly,-
1293 char **user_hostfiles, u_int num_user_hostfiles,-
1294 char **system_hostfiles, u_int num_system_hostfiles)-
1295{-
1296 HostStatus host_status;-
1297 HostStatus ip_status;-
1298 struct sshkey *raw_key = -
1299 ((void *)0)-
1300 ;-
1301 char *ip = -
1302 ((void *)0)-
1303 , *host = -
1304 ((void *)0)-
1305 ;-
1306 char hostline[1000], *hostp, *fp, *ra;-
1307 char msg[1024];-
1308 const char *type;-
1309 const struct hostkey_entry *host_found, *ip_found;-
1310 int len, cancelled_forwarding = 0;-
1311 int local = sockaddr_is_local(hostaddr);-
1312 int r, want_cert = sshkey_is_cert(host_key), host_ip_differ = 0;-
1313 int hostkey_trusted = 0;-
1314 struct hostkeys *host_hostkeys, *ip_hostkeys;-
1315 u_int i;-
1316 if (options.no_host_authentication_for_localhost == 1
options.no_hos...localhost == 1Description
TRUEnever evaluated
FALSEnever evaluated
&& local
localDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
1317 options.host_key_alias ==
options.host_k...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1318 ((void *)0)
options.host_k...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1319 ) {-
1320 debug("Forcing accepting of host key for "-
1321 "loopback/localhost.");-
1322 return
never executed: return 0;
0;
never executed: return 0;
0
1323 }-
1324-
1325-
1326-
1327-
1328-
1329 get_hostfile_hostname_ipaddr(hostname, hostaddr, port, &host, &ip);-
1330-
1331-
1332-
1333-
1334-
1335 if (options.check_host_ip
options.check_host_ipDescription
TRUEnever evaluated
FALSEnever evaluated
&& (local
localDescription
TRUEnever evaluated
FALSEnever evaluated
||
0
1336 -
1337 __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1338 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1339 ) && __builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1340 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1341 ) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1342 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1343 ), __s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1344 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1345 ), (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1346 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1347 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1348 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1349 ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1350 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1351 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1352 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1353 ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1354 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1355 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1356 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1357 ) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1358 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1359 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1360 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1361 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1362 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1363 ) == 1) && (__s1_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1364 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1365 ), __s1_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1366 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1367 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1368 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1369 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1370 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1371 ) == 1) ? __builtin_strcmp (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1372 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1373 ,
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1374 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1375 ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1376 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1377 ); int __result = (((const unsigned char *) (const char *) (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1378 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1379 ))[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
1380 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1381 ))[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
1382 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1383 ))[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 *) ( hostname ))[3] - __s2[3]);
0
1384 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
never executed: __result = (((const unsigned char *) (const char *) ( hostname ))[3] - __s2[3]);
0
1385 ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1386 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1387 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1388 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1389 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1390 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1391 ) == 1) && (__s2_len = __builtin_strlen (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1392 ip
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1393 ), __s2_len < 4) ? (__builtin_constant_p (
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1394 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1395 ) && ((size_t)(const void *)((
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1396 hostname
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1397 ) + 1) - (size_t)(const void *)(
__extension__ ... )))); }) == 0Description
TRUEnever evaluated
FALSEnever evaluated
0