Line | Source | Count |
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 | | - |
26 | char *client_version_string = | - |
27 | ((void *)0) | - |
28 | ; | - |
29 | char *server_version_string = | - |
30 | ((void *)0) | - |
31 | ; | - |
32 | struct sshkey *previous_host_key = | - |
33 | ((void *)0) | - |
34 | ; | - |
35 | | - |
36 | static int matching_host_key_dns = 0; | - |
37 | | - |
38 | static pid_t proxy_command_pid = 0; | - |
39 | | - |
40 | | - |
41 | extern Options options; | - |
42 | extern char *__progname; | - |
43 | | - |
44 | static int show_other_keys(struct hostkeys *, struct sshkey *); | - |
45 | static void warn_changed_key(struct sshkey *); | - |
46 | | - |
47 | | - |
48 | static char * | - |
49 | expand_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 | | - |
70 | static int | - |
71 | ssh_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 ((TRUE | never evaluated | FALSE | never evaluated |
shell = getenv("SHELL")) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
80 | ((void *)0)TRUE | never evaluated | FALSE | never 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(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
87 | 1TRUE | never evaluated | FALSE | never evaluated |
| 0 |
88 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
89 | SOCK_STREAMTRUE | never evaluated | FALSE | never evaluated |
| 0 |
90 | , 0, sp) < 0TRUE | never evaluated | FALSE | never 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 ((TRUE | never evaluated | FALSE | never evaluated |
pid = fork()) == 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
102 | char *argv[10]; | - |
103 | | - |
104 | close(sp[1]); | - |
105 | | - |
106 | if (sp[0] != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
107 | if (dup2(sp[0], 0) < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
108 | perror("dup2 stdin"); never executed: perror("dup2 stdin"); | 0 |
109 | } never executed: end of block | 0 |
110 | if (sp[0] != 1TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
111 | if (dup2(sp[0], 1) < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
112 | perror("dup2 stdout"); never executed: perror("dup2 stdout"); | 0 |
113 | } never executed: end of block | 0 |
114 | if (sp[0] >= 2TRUE | never evaluated | FALSE | never 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 < 0TRUE | never evaluated | FALSE | never 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 ((TRUE | never evaluated | FALSE | never evaluated |
sock = mm_receive_fd(sp[1])) == -1TRUE | never evaluated | FALSE | never 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, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
149 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
150 | , 0) == -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
151 | if ( | - |
152 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
153 | != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
154 | 4TRUE | never evaluated | FALSE | never 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) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
162 | ((void *)0)TRUE | never evaluated | FALSE | never 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 | | - |
172 | static int | - |
173 | ssh_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 ((TRUE | never evaluated | FALSE | never evaluated |
shell = getenv("SHELL")) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
182 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
183 | || *TRUE | never evaluated | FALSE | never evaluated |
shell == '\0'TRUE | never evaluated | FALSE | never 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) < 0TRUE | never evaluated | FALSE | never evaluated |
|| pipe(pout) < 0TRUE | never evaluated | FALSE | never 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 ((TRUE | never evaluated | FALSE | never evaluated |
pid = fork()) == 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
201 | char *argv[10]; | - |
202 | | - |
203 | | - |
204 | close(pin[1]); | - |
205 | if (pin[0] != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
206 | if (dup2(pin[0], 0) < 0TRUE | never evaluated | FALSE | never 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) < 0TRUE | never evaluated | FALSE | never 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 < 0TRUE | never evaluated | FALSE | never 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]) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
253 | ((void *)0)TRUE | never evaluated | FALSE | never 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 | | - |
260 | void | - |
261 | ssh_kill_proxy_command(void) | - |
262 | { | - |
263 | | - |
264 | | - |
265 | | - |
266 | | - |
267 | if (proxy_command_pid > 1TRUE | never evaluated | FALSE | never 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 | | - |
279 | static int | - |
280 | check_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 < 2TRUE | never evaluated | FALSE | never evaluated |
; allow_local++) { | 0 |
294 | for (ifa = ifaddrs; ifa != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
295 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
296 | ; ifa = ifa->ifa_next) { | - |
297 | if (ifa->ifa_addr == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
298 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
299 | || ifa->ifa_name == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
300 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
301 | || | - |
302 | (TRUE | never evaluated | FALSE | never evaluated |
ifa->ifa_flags & TRUE | never evaluated | FALSE | never evaluated |
| 0 |
303 | IFF_UPTRUE | never evaluated | FALSE | never evaluated |
| 0 |
304 | ) == 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
305 | ifa->ifa_addr->sa_family != afTRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
306 | | - |
307 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
308 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
309 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
310 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
311 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
312 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
313 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
314 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
315 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
316 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
317 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
318 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
319 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
320 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
321 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
322 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
323 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
324 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
325 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
326 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
327 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
328 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
329 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
330 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
331 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
332 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
333 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
334 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
335 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
336 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
337 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
338 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
339 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
340 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
341 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
342 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
343 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
344 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
345 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
346 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
347 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
348 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
349 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
350 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
351 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
352 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
353 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never 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_nameTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( ifa->ifa_name ))[3] - __s2[3]); | 0 |
355 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
356 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
357 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
358 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
359 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
360 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
361 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
362 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
363 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
364 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
365 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
366 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
367 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
368 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
369 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
370 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
371 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
372 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
373 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
374 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
375 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
376 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
377 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
378 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
379 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
380 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
381 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never 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_interfaceTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( options.bind_interface ))[3] - __s2[3]); | 0 |
383 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
384 | ifa->ifa_nameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
385 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
386 | options.bind_interfaceTRUE | never evaluated | FALSE | never evaluated |
| 0 |
387 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
388 | != 0TRUE | never evaluated | FALSE | never 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_localTRUE | never evaluated | FALSE | never evaluated |
&& sa->sin_addr.s_addr ==TRUE | never evaluated | FALSE | never evaluated |
| 0 |
396 | TRUE | never evaluated | FALSE | never evaluated |
| 0 |
397 | __bswap_32 (((in_addr_t) 0x7f000001))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
398 | ) | - |
399 | continue; never executed: continue; | 0 |
400 | if (*TRUE | never evaluated | FALSE | never evaluated |
rlenp < sizeof(struct sockaddr_in)TRUE | never evaluated | FALSE | never 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_localTRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
414 | ( | - |
415 | (TRUE | never evaluated | FALSE | never evaluated |
__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
416 | v6addrTRUE | never evaluated | FALSE | never evaluated |
| 0 |
417 | ); (__a->__in6_u.__u6_addr32[0] & __bswap_32 (0xffc00000)) == __bswap_32 (0xfe800000); }))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
418 | || | - |
419 | | - |
420 | (TRUE | never evaluated | FALSE | never evaluated |
__extension__ ({ const struct in6_addr *__a = (const struct in6_addr *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
421 | v6addrTRUE | never evaluated | FALSE | never 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); }))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
423 | )) | - |
424 | continue; never executed: continue; | 0 |
425 | if (*TRUE | never evaluated | FALSE | never evaluated |
rlenp < sizeof(struct sockaddr_in6)TRUE | never evaluated | FALSE | never 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 | | - |
443 | static int | - |
444 | ssh_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 < 0TRUE | never evaluated | FALSE | never 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 == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
476 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
477 | && options.bind_interface == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
478 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
479 | ) | - |
480 | return never executed: return sock; sock;never executed: return sock; | 0 |
481 | | - |
482 | if (options.bind_address != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
483 | ((void *)0)TRUE | never evaluated | FALSE | never 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 ((TRUE | never evaluated | FALSE | never evaluated |
r = getaddrinfo(options.bind_address, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
493 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
494 | ,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
495 | &hints, &res)) != 0TRUE | never evaluated | FALSE | never 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 == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
501 | ((void *)0)TRUE | never evaluated | FALSE | never 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)TRUE | never evaluated | FALSE | never 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 != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
513 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
514 | ) { | - |
515 | | - |
516 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = getifaddrs(&ifaddrs)) != 0TRUE | never evaluated | FALSE | never 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,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
525 | ifaddrs, &bindaddr, &bindaddrlen) != 0TRUE | never evaluated | FALSE | never 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 ((TRUE | never evaluated | FALSE | never evaluated |
r = getnameinfo((struct sockaddr *)&bindaddr, bindaddrlen,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
535 | ntop, sizeof(ntop), TRUE | never evaluated | FALSE | never evaluated |
| 0 |
536 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
537 | , 0, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
538 | 1TRUE | never evaluated | FALSE | never evaluated |
| 0 |
539 | )) != 0TRUE | never evaluated | FALSE | never 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) != 0TRUE | never evaluated | FALSE | never 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 |
553 | fail: | - |
554 | close(sock); | - |
555 | sock = -1; | - |
556 | out: code before this statement never executed: out: | 0 |
557 | if (res != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
558 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
559 | ) | - |
560 | freeaddrinfo(res); never executed: freeaddrinfo(res); | 0 |
561 | | - |
562 | if (ifaddrs != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
563 | ((void *)0)TRUE | never evaluated | FALSE | never 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 | | - |
575 | static int | - |
576 | waitrfd(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 (; *TRUE | never evaluated | FALSE | never evaluated |
timeoutp >= 0TRUE | never evaluated | FALSE | never 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 > 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
597 | return never executed: return 0; 0;never executed: return 0; | 0 |
598 | else if (r == -1TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
599 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
600 | != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
601 | 11TRUE | never evaluated | FALSE | never evaluated |
| 0 |
602 | ) | - |
603 | return never executed: return -1; -1;never executed: return -1; | 0 |
604 | else if (r == 0TRUE | never evaluated | FALSE | never 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 | | - |
616 | static int | - |
617 | timeout_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 (*TRUE | never evaluated | FALSE | never evaluated |
timeoutp <= 0TRUE | never evaluated | FALSE | never 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) == 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
629 | | - |
630 | unset_nonblock(sockfd); | - |
631 | return never executed: return 0; 0;never executed: return 0; | 0 |
632 | } else if ( | - |
633 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
634 | != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
635 | 115TRUE | never evaluated | FALSE | never evaluated |
| 0 |
636 | ) | - |
637 | return never executed: return -1; -1;never executed: return -1; | 0 |
638 | | - |
639 | if (waitrfd(sockfd, timeoutp) == -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
640 | return never executed: return -1; -1;never executed: return -1; | 0 |
641 | | - |
642 | | - |
643 | if (getsockopt(sockfd, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
644 | 1TRUE | never evaluated | FALSE | never evaluated |
| 0 |
645 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
646 | 4TRUE | never evaluated | FALSE | never evaluated |
| 0 |
647 | , &optval, &optlen) == -1TRUE | never evaluated | FALSE | never 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 != 0TRUE | never evaluated | FALSE | never 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 | } | - |
662 | static int | - |
663 | ssh_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_attemptsTRUE | never evaluated | FALSE | never evaluated |
; attempt++) { | 0 |
681 | if (attempt > 0TRUE | never evaluated | FALSE | never 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; aiTRUE | never evaluated | FALSE | never evaluated |
; ai = ai->ai_next) { | 0 |
691 | if (ai->ai_family != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
692 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
693 | && | - |
694 | ai->ai_family != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
695 | 10TRUE | never evaluated | FALSE | never 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,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
705 | ntop, sizeof(ntop), strport, sizeof(strport),TRUE | never evaluated | FALSE | never evaluated |
| 0 |
706 | TRUE | never evaluated | FALSE | never evaluated |
| 0 |
707 | 1TRUE | never evaluated | FALSE | never evaluated |
| 0 |
708 | |TRUE | never evaluated | FALSE | never evaluated |
| 0 |
709 | 2TRUE | never evaluated | FALSE | never evaluated |
| 0 |
710 | ) != 0TRUE | never evaluated | FALSE | never 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 < 0TRUE | never evaluated | FALSE | never 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,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
734 | timeout_ms) >= 0TRUE | never evaluated | FALSE | never 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 != -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
754 | break; never executed: break; | 0 |
755 | } never executed: end of block | 0 |
756 | | - |
757 | | - |
758 | if (sock == -1TRUE | never evaluated | FALSE | never 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_keepaliveTRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
772 | setsockopt(sock, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
773 | 1TRUE | never evaluated | FALSE | never evaluated |
| 0 |
774 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
775 | 9TRUE | never evaluated | FALSE | never evaluated |
| 0 |
776 | , (void *)&on,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
777 | sizeof(on)) < 0TRUE | never evaluated | FALSE | never 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) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
784 | ((void *)0)TRUE | never evaluated | FALSE | never 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 | | - |
791 | int | - |
792 | ssh_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 == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
797 | ((void *)0)TRUE | never evaluated | FALSE | never 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 (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
803 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
804 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
805 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
806 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
807 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
808 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
809 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
810 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
811 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
812 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
813 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
814 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
815 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
816 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
817 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
818 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
819 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
820 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
821 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
822 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
823 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
824 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
825 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
826 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
827 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
828 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
829 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
830 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
831 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
832 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
833 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
834 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
835 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
836 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
837 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
838 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
839 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
840 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
841 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
842 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
843 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
844 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
845 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
846 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
847 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
848 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never 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_commandTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( options.proxy_command ))[3] - __s2[3]); | 0 |
850 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
851 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
852 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
853 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
854 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
855 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
856 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
857 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
858 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
859 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
860 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
861 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
862 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
863 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
864 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
865 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
866 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
867 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
868 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
869 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
870 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
871 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
872 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
873 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
874 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
875 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
876 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]); | 0 |
877 | "-"TRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( "-" ))[3] - __s2[3]); | 0 |
878 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
879 | options.proxy_commandTRUE | never evaluated | FALSE | never evaluated |
| 0 |
880 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
881 | "-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
882 | )))); }) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
883 | == 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
884 | if ((TRUE | never evaluated | FALSE | never evaluated |
ssh_packet_set_connection(ssh,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
885 | TRUE | never evaluated | FALSE | never evaluated |
| 0 |
886 | 0TRUE | never evaluated | FALSE | never evaluated |
| 0 |
887 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
888 | 1TRUE | never evaluated | FALSE | never evaluated |
| 0 |
889 | )) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
890 | ((void *)0)TRUE | never evaluated | FALSE | never 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_fdpassTRUE | never evaluated | FALSE | never 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 | | - |
901 | static void | - |
902 | send_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,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
908 | strlen(client_version_string)) != strlen(client_version_string)TRUE | never evaluated | FALSE | never 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 | | - |
920 | void | - |
921 | ssh_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) - 1TRUE | never evaluated | FALSE | never evaluated |
; i++) { | 0 |
936 | if (timeout_ms > 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
937 | rc = waitrfd(connection_in, &timeout_ms); | - |
938 | if (rc == -1TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
939 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
940 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
941 | 110TRUE | never evaluated | FALSE | never evaluated |
| 0 |
942 | ) { | - |
943 | fatal("Connection timed out during " | - |
944 | "banner exchange"); | - |
945 | } never executed: end of block else if (rc == -1TRUE | never evaluated | FALSE | never 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 != 1TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
955 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
956 | == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
957 | 32TRUE | never evaluated | FALSE | never 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 != 1TRUE | never evaluated | FALSE | never 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'TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
967 | buf[i] = '\n'; | - |
968 | buf[i + 1] = 0; | - |
969 | continue; never executed: continue; | 0 |
970 | } | - |
971 | if (buf[i] == '\n'TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
972 | buf[i + 1] = 0; | - |
973 | break; never executed: break; | 0 |
974 | } | - |
975 | if (++TRUE | never evaluated | FALSE | never evaluated |
n > 65536TRUE | never evaluated | FALSE | never 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 | (TRUE | never evaluated | FALSE | never evaluated |
__extension__ (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
982 | 4TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
983 | )TRUE | never evaluated | FALSE | never evaluated |
&& ((__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
984 | bufTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
985 | )TRUE | never evaluated | FALSE | never evaluated |
&& strlen (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
986 | bufTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
987 | ) < ((size_t) (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
988 | 4TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
989 | ))TRUE | never evaluated | FALSE | never evaluated |
) || (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
990 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
991 | )TRUE | never evaluated | FALSE | never evaluated |
&& strlen (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
992 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
993 | ) < ((size_t) (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
994 | 4TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
995 | ))TRUE | never evaluated | FALSE | never evaluated |
)) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
996 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
997 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
998 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
999 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1000 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1001 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1002 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1003 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1004 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1005 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1006 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1007 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1008 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1009 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1010 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1011 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1012 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1013 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1014 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1015 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1016 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1017 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1018 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1019 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1020 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1021 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1022 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1023 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1024 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1025 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1026 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1027 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1028 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1029 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1030 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1031 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1032 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1033 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1034 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1035 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1036 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1037 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1038 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1039 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1040 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1041 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( buf ))[3] - __s2[3]); | 0 |
1042 | bufTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( buf ))[3] - __s2[3]); | 0 |
1043 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1044 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1045 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1046 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1047 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1048 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1049 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1050 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1051 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1052 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1053 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1054 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1055 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1056 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1057 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1058 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1059 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1060 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1061 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1062 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1063 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1064 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1065 | ))[0] - __s2[0]); if (__s2_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1066 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1067 | ))[1] - __s2[1]); if (__s2_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1068 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1069 | ))[2] - __s2[2]); if (__s2_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( "SSH-" ))[3] - __s2[3]); | 0 |
1070 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( "SSH-" ))[3] - __s2[3]); | 0 |
1071 | ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1072 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1073 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1074 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1075 | )))); }) : strncmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1076 | bufTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1077 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1078 | "SSH-"TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1079 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1080 | 4TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1081 | ))) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1082 | == 0TRUE | never evaluated | FALSE | never 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",TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1093 | &remote_major, &remote_minor, remote_version) != 3TRUE | never evaluated | FALSE | never 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 != 99TRUE | never evaluated | FALSE | never 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 (mismatchTRUE | never evaluated | FALSE | never 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 ((TRUE | never evaluated | FALSE | never evaluated |
datafellows & 0x00002000) != 0TRUE | never evaluated | FALSE | never 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 | | - |
1122 | static int | - |
1123 | confirm(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_modeTRUE | never evaluated | FALSE | never 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 == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1134 | ((void *)0)TRUE | never evaluated | FALSE | never 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'TRUE | never evaluated | FALSE | never evaluated |
|| strcasecmp(p, "no") == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1145 | ret = 0; never executed: ret = 0; | 0 |
1146 | else if (strcasecmp(p, "yes") == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1147 | ret = 1; never executed: ret = 1; | 0 |
1148 | free(p); | - |
1149 | if (ret != -1TRUE | never evaluated | FALSE | never 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 | | - |
1154 | static int | - |
1155 | check_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) != 0TRUE | never evaluated | FALSE | never 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) != 0TRUE | never evaluated | FALSE | never 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 ((TRUE | never evaluated | FALSE | never evaluated |
r = sshkey_check_cert_sigtype(key,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1170 | options.ca_sign_algorithms)) != 0TRUE | never evaluated | FALSE | never 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 | | - |
1184 | static int | - |
1185 | sockaddr_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 | | - |
1217 | void | - |
1218 | get_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 == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1227 | ((void *)0)TRUE | never evaluated | FALSE | never 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 != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1252 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1253 | ) { | - |
1254 | if (options.proxy_command == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1255 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1256 | ) { | - |
1257 | if (getnameinfo(hostaddr, addrlen,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1258 | ntop, sizeof(ntop), TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1259 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1260 | , 0, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1261 | 1TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1262 | ) != 0TRUE | never evaluated | FALSE | never 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 != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1278 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1279 | ) { | - |
1280 | if (options.host_key_alias != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1281 | ((void *)0)TRUE | never evaluated | FALSE | never 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 |
1290 | static int | - |
1291 | check_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 == 1TRUE | never evaluated | FALSE | never evaluated |
&& localTRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
1317 | options.host_key_alias == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1318 | ((void *)0)TRUE | never evaluated | FALSE | never 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_ipTRUE | never evaluated | FALSE | never evaluated |
&& (localTRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1336 | | - |
1337 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1338 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1339 | ) && __builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1340 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1341 | ) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1342 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1343 | ), __s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1344 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1345 | ), (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1346 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1347 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1348 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1349 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1350 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1351 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1352 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1353 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1354 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1355 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1356 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1357 | ) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1358 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1359 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1360 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1361 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1362 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1363 | ) == 1) && (__s1_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1364 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1365 | ), __s1_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1366 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1367 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1368 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1369 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1370 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1371 | ) == 1) ? __builtin_strcmp (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1372 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1373 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1374 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1375 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1376 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1377 | ); int __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1378 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1379 | ))[0] - __s2[0]); if (__s1_len > 0TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1380 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1381 | ))[1] - __s2[1]); if (__s1_len > 1TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) { __result = (((const unsigned char *) (const char *) (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1382 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1383 | ))[2] - __s2[2]); if (__s1_len > 2TRUE | never evaluated | FALSE | never evaluated |
&& __result == 0TRUE | never evaluated | FALSE | never evaluated |
) __result = (((const unsigned char *) (const char *) (never executed: __result = (((const unsigned char *) (const char *) ( hostname ))[3] - __s2[3]); | 0 |
1384 | hostnameTRUE | never evaluated | FALSE | never evaluated |
never executed: __result = (((const unsigned char *) (const char *) ( hostname ))[3] - __s2[3]); | 0 |
1385 | ))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1386 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1387 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1388 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1389 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1390 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1391 | ) == 1) && (__s2_len = __builtin_strlen (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1392 | ipTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1393 | ), __s2_len < 4) ? (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1394 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1395 | ) && ((size_t)(const void *)((TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1396 | hostnameTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1397 | ) + 1) - (size_t)(const void *)(TRUE | never evaluated | FALSE | never evaluated |
| 0 |
|