Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | extern int tty_flag; | - |
18 | extern Options options; | - |
19 | extern int stdin_null_flag; | - |
20 | extern char *host; | - |
21 | extern int subsystem_flag; | - |
22 | extern struct sshbuf *command; | - |
23 | extern volatile sig_atomic_t quit_pending; | - |
24 | | - |
25 | | - |
26 | struct mux_session_confirm_ctx { | - |
27 | u_int want_tty; | - |
28 | u_int want_subsys; | - |
29 | u_int want_x_fwd; | - |
30 | u_int want_agent_fwd; | - |
31 | struct sshbuf *cmd; | - |
32 | char *term; | - |
33 | struct termios tio; | - |
34 | char **env; | - |
35 | u_int rid; | - |
36 | }; | - |
37 | | - |
38 | | - |
39 | struct mux_stdio_confirm_ctx { | - |
40 | u_int rid; | - |
41 | }; | - |
42 | | - |
43 | | - |
44 | struct mux_channel_confirm_ctx { | - |
45 | u_int cid; | - |
46 | u_int rid; | - |
47 | int fid; | - |
48 | }; | - |
49 | | - |
50 | | - |
51 | int muxserver_sock = -1; | - |
52 | | - |
53 | | - |
54 | u_int muxclient_request_id = 0; | - |
55 | | - |
56 | | - |
57 | u_int muxclient_command = 0; | - |
58 | | - |
59 | | - |
60 | static volatile sig_atomic_t muxclient_terminate = 0; | - |
61 | | - |
62 | | - |
63 | static u_int muxserver_pid = 0; | - |
64 | | - |
65 | static Channel *mux_listener_channel = | - |
66 | ((void *)0) | - |
67 | ; | - |
68 | | - |
69 | struct mux_master_state { | - |
70 | int hello_rcvd; | - |
71 | }; | - |
72 | static void mux_session_confirm(struct ssh *, int, int, void *); | - |
73 | static void mux_stdio_confirm(struct ssh *, int, int, void *); | - |
74 | | - |
75 | static int process_mux_master_hello(struct ssh *, u_int, | - |
76 | Channel *, struct sshbuf *, struct sshbuf *); | - |
77 | static int process_mux_new_session(struct ssh *, u_int, | - |
78 | Channel *, struct sshbuf *, struct sshbuf *); | - |
79 | static int process_mux_alive_check(struct ssh *, u_int, | - |
80 | Channel *, struct sshbuf *, struct sshbuf *); | - |
81 | static int process_mux_terminate(struct ssh *, u_int, | - |
82 | Channel *, struct sshbuf *, struct sshbuf *); | - |
83 | static int process_mux_open_fwd(struct ssh *, u_int, | - |
84 | Channel *, struct sshbuf *, struct sshbuf *); | - |
85 | static int process_mux_close_fwd(struct ssh *, u_int, | - |
86 | Channel *, struct sshbuf *, struct sshbuf *); | - |
87 | static int process_mux_stdio_fwd(struct ssh *, u_int, | - |
88 | Channel *, struct sshbuf *, struct sshbuf *); | - |
89 | static int process_mux_stop_listening(struct ssh *, u_int, | - |
90 | Channel *, struct sshbuf *, struct sshbuf *); | - |
91 | static int process_mux_proxy(struct ssh *, u_int, | - |
92 | Channel *, struct sshbuf *, struct sshbuf *); | - |
93 | | - |
94 | static const struct { | - |
95 | u_int type; | - |
96 | int (*handler)(struct ssh *, u_int, Channel *, | - |
97 | struct sshbuf *, struct sshbuf *); | - |
98 | } mux_master_handlers[] = { | - |
99 | { 0x00000001, process_mux_master_hello }, | - |
100 | { 0x10000002, process_mux_new_session }, | - |
101 | { 0x10000004, process_mux_alive_check }, | - |
102 | { 0x10000005, process_mux_terminate }, | - |
103 | { 0x10000006, process_mux_open_fwd }, | - |
104 | { 0x10000007, process_mux_close_fwd }, | - |
105 | { 0x10000008, process_mux_stdio_fwd }, | - |
106 | { 0x10000009, process_mux_stop_listening }, | - |
107 | { 0x1000000f, process_mux_proxy }, | - |
108 | { 0, | - |
109 | ((void *)0) | - |
110 | } | - |
111 | }; | - |
112 | | - |
113 | | - |
114 | | - |
115 | static void | - |
116 | mux_master_session_cleanup_cb(struct ssh *ssh, int cid, void *unused) | - |
117 | { | - |
118 | Channel *cc, *c = channel_by_id(ssh, cid); | - |
119 | | - |
120 | debug3("%s: entering for channel %d", __func__, cid); | - |
121 | if (c == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
122 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
123 | ) | - |
124 | fatal("%s: channel_by_id(%i) == NULL", __func__, cid); never executed: fatal("%s: channel_by_id(%i) == NULL", __func__, cid); | 0 |
125 | if (c->ctl_chan != -1TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
126 | if ((TRUE | never evaluated | FALSE | never evaluated |
cc = channel_by_id(ssh, c->ctl_chan)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
127 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
128 | ) | - |
129 | fatal("%s: channel %d missing control channel %d", never executed: fatal("%s: channel %d missing control channel %d", __func__, c->self, c->ctl_chan); | 0 |
130 | __func__, c->self, c->ctl_chan); never executed: fatal("%s: channel %d missing control channel %d", __func__, c->self, c->ctl_chan); | 0 |
131 | c->ctl_chan = -1; | - |
132 | cc->remote_id = 0; | - |
133 | cc->have_remote_id = 0; | - |
134 | chan_rcvd_oclose(ssh, cc); | - |
135 | } never executed: end of block | 0 |
136 | channel_cancel_cleanup(ssh, c->self); | - |
137 | } never executed: end of block | 0 |
138 | | - |
139 | | - |
140 | | - |
141 | static void | - |
142 | mux_master_control_cleanup_cb(struct ssh *ssh, int cid, void *unused) | - |
143 | { | - |
144 | Channel *sc, *c = channel_by_id(ssh, cid); | - |
145 | | - |
146 | debug3("%s: entering for channel %d", __func__, cid); | - |
147 | if (c == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
148 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
149 | ) | - |
150 | fatal("%s: channel_by_id(%i) == NULL", __func__, cid); never executed: fatal("%s: channel_by_id(%i) == NULL", __func__, cid); | 0 |
151 | if (c->have_remote_idTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
152 | if ((TRUE | never evaluated | FALSE | never evaluated |
sc = channel_by_id(ssh, c->remote_id)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
153 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
154 | ) | - |
155 | fatal("%s: channel %d missing session channel %u", never executed: fatal("%s: channel %d missing session channel %u", __func__, c->self, c->remote_id); | 0 |
156 | __func__, c->self, c->remote_id); never executed: fatal("%s: channel %d missing session channel %u", __func__, c->self, c->remote_id); | 0 |
157 | c->remote_id = 0; | - |
158 | c->have_remote_id = 0; | - |
159 | sc->ctl_chan = -1; | - |
160 | if (sc->type != 4TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
161 | sc->type != 3TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
162 | debug2("%s: channel %d: not open", __func__, sc->self); | - |
163 | chan_mark_dead(ssh, sc); | - |
164 | } never executed: end of block else { | 0 |
165 | if (sc->istate == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
166 | chan_read_failed(ssh, sc); never executed: chan_read_failed(ssh, sc); | 0 |
167 | if (sc->ostate == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
168 | chan_write_failed(ssh, sc); never executed: chan_write_failed(ssh, sc); | 0 |
169 | } never executed: end of block | 0 |
170 | } | - |
171 | channel_cancel_cleanup(ssh, c->self); | - |
172 | } never executed: end of block | 0 |
173 | | - |
174 | | - |
175 | static int | - |
176 | env_permitted(char *env) | - |
177 | { | - |
178 | int i, ret; | - |
179 | char name[1024], *cp; | - |
180 | | - |
181 | if ((TRUE | never evaluated | FALSE | never evaluated |
cp = TRUE | never evaluated | FALSE | never evaluated |
| 0 |
182 | (__extension__ (__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
183 | '='TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
184 | )TRUE | never evaluated | FALSE | never evaluated |
&& !__builtin_constant_p (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
185 | envTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
186 | )TRUE | never evaluated | FALSE | never evaluated |
&& (TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
187 | '='TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
188 | ) == '\0'TRUE | never evaluated | FALSE | never evaluated |
? (char *) __rawmemchr (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
189 | envTRUE | never evaluated | FALSE | never evaluated |
| 0 |
190 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
191 | '='TRUE | never evaluated | FALSE | never evaluated |
| 0 |
192 | ) : __builtin_strchr (TRUE | never evaluated | FALSE | never evaluated |
| 0 |
193 | envTRUE | never evaluated | FALSE | never evaluated |
| 0 |
194 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
195 | '='TRUE | never evaluated | FALSE | never evaluated |
| 0 |
196 | )))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
197 | ) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
198 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
199 | || cp == envTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
200 | return never executed: return 0; 0;never executed: return 0; | 0 |
201 | ret = snprintf(name, sizeof(name), "%.*s", (int)(cp - env), env); | - |
202 | if (ret <= 0TRUE | never evaluated | FALSE | never evaluated |
|| (TRUE | never evaluated | FALSE | never evaluated |
size_t)ret >= sizeof(name)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
203 | error("env_permitted: name '%.100s...' too long", env); | - |
204 | return never executed: return 0; 0;never executed: return 0; | 0 |
205 | } | - |
206 | | - |
207 | for (i = 0; i < options.num_send_envTRUE | never evaluated | FALSE | never evaluated |
; i++) | 0 |
208 | if (match_pattern(name, options.send_env[i])TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
209 | return never executed: return 1; 1;never executed: return 1; | 0 |
210 | | - |
211 | return never executed: return 0; 0;never executed: return 0; | 0 |
212 | } | - |
213 | | - |
214 | | - |
215 | | - |
216 | static int | - |
217 | process_mux_master_hello(struct ssh *ssh, u_int rid, | - |
218 | Channel *c, struct sshbuf *m, struct sshbuf *reply) | - |
219 | { | - |
220 | u_int ver; | - |
221 | struct mux_master_state *state = (struct mux_master_state *)c->mux_ctx; | - |
222 | int r; | - |
223 | | - |
224 | if (state == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
225 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
226 | ) | - |
227 | fatal("%s: channel %d: c->mux_ctx == NULL", __func__, c->self); never executed: fatal("%s: channel %d: c->mux_ctx == NULL", __func__, c->self); | 0 |
228 | if (state->hello_rcvdTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
229 | error("%s: HELLO received twice", __func__); | - |
230 | return never executed: return -1; -1;never executed: return -1; | 0 |
231 | } | - |
232 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &ver)) != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
233 | error("%s: malformed message: %s", __func__, ssh_err(r)); | - |
234 | return never executed: return -1; -1;never executed: return -1; | 0 |
235 | } | - |
236 | if (ver != 4TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
237 | error("Unsupported multiplexing protocol version %d " | - |
238 | "(expected %d)", ver, 4); | - |
239 | return never executed: return -1; -1;never executed: return -1; | 0 |
240 | } | - |
241 | debug2("%s: channel %d slave version %u", __func__, c->self, ver); | - |
242 | | - |
243 | | - |
244 | while (sshbuf_len(m) > 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
245 | char *name = | - |
246 | ((void *)0) | - |
247 | ; | - |
248 | | - |
249 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &name, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
250 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
251 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
252 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_string_direct(m, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
253 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
254 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
255 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
256 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
257 | error("%s: malformed extension: %s", | - |
258 | __func__, ssh_err(r)); | - |
259 | return never executed: return -1; -1;never executed: return -1; | 0 |
260 | } | - |
261 | debug2("Unrecognised slave extension \"%s\"", name); | - |
262 | free(name); | - |
263 | } never executed: end of block | 0 |
264 | state->hello_rcvd = 1; | - |
265 | return never executed: return 0; 0;never executed: return 0; | 0 |
266 | } | - |
267 | | - |
268 | | - |
269 | static void | - |
270 | reply_ok(struct sshbuf *reply, u_int rid) | - |
271 | { | - |
272 | int r; | - |
273 | | - |
274 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, 0x80000001)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
275 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, rid)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
276 | fatal("%s: reply: %s", __func__, ssh_err(r)); never executed: fatal("%s: reply: %s", __func__, ssh_err(r)); | 0 |
277 | } never executed: end of block | 0 |
278 | | - |
279 | | - |
280 | static void | - |
281 | reply_error(struct sshbuf *reply, u_int type, u_int rid, const char *msg) | - |
282 | { | - |
283 | int r; | - |
284 | | - |
285 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, type)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
286 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, rid)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
287 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_cstring(reply, msg)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
288 | fatal("%s: reply: %s", __func__, ssh_err(r)); never executed: fatal("%s: reply: %s", __func__, ssh_err(r)); | 0 |
289 | } never executed: end of block | 0 |
290 | | - |
291 | static int | - |
292 | process_mux_new_session(struct ssh *ssh, u_int rid, | - |
293 | Channel *c, struct sshbuf *m, struct sshbuf *reply) | - |
294 | { | - |
295 | Channel *nc; | - |
296 | struct mux_session_confirm_ctx *cctx; | - |
297 | char *cmd, *cp; | - |
298 | u_int i, j, env_len, escape_char, window, packetmax; | - |
299 | int r, new_fd[3]; | - |
300 | | - |
301 | | - |
302 | cctx = xcalloc(1, sizeof(*cctx)); | - |
303 | cctx->term = | - |
304 | ((void *)0) | - |
305 | ; | - |
306 | cctx->rid = rid; | - |
307 | cmd = | - |
308 | ((void *)0) | - |
309 | ; | - |
310 | cctx->env = | - |
311 | ((void *)0) | - |
312 | ; | - |
313 | env_len = 0; | - |
314 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_string_direct(m, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
315 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
316 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
317 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
318 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
319 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cctx->want_tty)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
320 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cctx->want_x_fwd)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
321 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cctx->want_agent_fwd)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
322 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cctx->want_subsys)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
323 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &escape_char)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
324 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &cctx->term, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
325 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
326 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
327 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &cmd, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
328 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
329 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
330 | malf: | - |
331 | free(cmd); | - |
332 | for (j = 0; j < env_lenTRUE | never evaluated | FALSE | never evaluated |
; j++) | 0 |
333 | free(cctx->env[j]); never executed: free(cctx->env[j]); | 0 |
334 | free(cctx->env); | - |
335 | free(cctx->term); | - |
336 | free(cctx); | - |
337 | error("%s: malformed message", __func__); | - |
338 | return never executed: return -1; -1;never executed: return -1; | 0 |
339 | } | - |
340 | | - |
341 | | - |
342 | while (sshbuf_len(m) > 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
343 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &cp, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
344 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
345 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
346 | goto never executed: goto malf; malf;never executed: goto malf; | 0 |
347 | if (!env_permitted(cp)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
348 | free(cp); | - |
349 | continue; never executed: continue; | 0 |
350 | } | - |
351 | cctx->env = xreallocarray(cctx->env, env_len + 2, | - |
352 | sizeof(*cctx->env)); | - |
353 | cctx->env[env_len++] = cp; | - |
354 | cctx->env[env_len] = | - |
355 | ((void *)0) | - |
356 | ; | - |
357 | if (env_len > 4096TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
358 | error(">%d environment variables received, ignoring " | - |
359 | "additional", 4096); | - |
360 | break; never executed: break; | 0 |
361 | } | - |
362 | } never executed: end of block | 0 |
363 | | - |
364 | debug2("%s: channel %d: request tty %d, X %d, agent %d, subsys %d, " | - |
365 | "term \"%s\", cmd \"%s\", env %u", __func__, c->self, | - |
366 | cctx->want_tty, cctx->want_x_fwd, cctx->want_agent_fwd, | - |
367 | cctx->want_subsys, cctx->term, cmd, env_len); | - |
368 | | - |
369 | if ((TRUE | never evaluated | FALSE | never evaluated |
cctx->cmd = sshbuf_new()) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
370 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
371 | ) | - |
372 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
373 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put(cctx->cmd, cmd, strlen(cmd))) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
374 | fatal("%s: sshbuf_put: %s", __func__, ssh_err(r)); never executed: fatal("%s: sshbuf_put: %s", __func__, ssh_err(r)); | 0 |
375 | free(cmd); | - |
376 | cmd = | - |
377 | ((void *)0) | - |
378 | ; | - |
379 | | - |
380 | | - |
381 | for(i = 0; i < 3TRUE | never evaluated | FALSE | never evaluated |
; i++) { | 0 |
382 | if ((TRUE | never evaluated | FALSE | never evaluated |
new_fd[i] = mm_receive_fd(c->sock)) == -1TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
383 | error("%s: failed to receive fd %d from slave", | - |
384 | __func__, i); | - |
385 | for (j = 0; j < iTRUE | never evaluated | FALSE | never evaluated |
; j++) | 0 |
386 | close(new_fd[j]); never executed: close(new_fd[j]); | 0 |
387 | for (j = 0; j < env_lenTRUE | never evaluated | FALSE | never evaluated |
; j++) | 0 |
388 | free(cctx->env[j]); never executed: free(cctx->env[j]); | 0 |
389 | free(cctx->env); | - |
390 | free(cctx->term); | - |
391 | sshbuf_free(cctx->cmd); | - |
392 | free(cctx); | - |
393 | reply_error(reply, 0x80000003, rid, | - |
394 | "did not receive file descriptors"); | - |
395 | return never executed: return -1; -1;never executed: return -1; | 0 |
396 | } | - |
397 | } never executed: end of block | 0 |
398 | | - |
399 | debug3("%s: got fds stdin %d, stdout %d, stderr %d", __func__, | - |
400 | new_fd[0], new_fd[1], new_fd[2]); | - |
401 | | - |
402 | | - |
403 | if (c->have_remote_idTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
404 | debug2("%s: session already open", __func__); | - |
405 | reply_error(reply, 0x80000003, rid, | - |
406 | "Multiple sessions not supported"); | - |
407 | cleanup: code before this statement never executed: cleanup: | 0 |
408 | close(new_fd[0]); | - |
409 | close(new_fd[1]); | - |
410 | close(new_fd[2]); | - |
411 | free(cctx->term); | - |
412 | if (env_len != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
413 | for (i = 0; i < env_lenTRUE | never evaluated | FALSE | never evaluated |
; i++) | 0 |
414 | free(cctx->env[i]); never executed: free(cctx->env[i]); | 0 |
415 | free(cctx->env); | - |
416 | } never executed: end of block | 0 |
417 | sshbuf_free(cctx->cmd); | - |
418 | free(cctx); | - |
419 | return never executed: return 0; 0;never executed: return 0; | 0 |
420 | } | - |
421 | | - |
422 | if (options.control_master == 3TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
423 | options.control_master == 4TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
424 | if (!ask_permission("Allow shared connection to %s? ", host)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
425 | debug2("%s: session refused by user", __func__); | - |
426 | reply_error(reply, 0x80000002, rid, | - |
427 | "Permission denied"); | - |
428 | goto never executed: goto cleanup; cleanup;never executed: goto cleanup; | 0 |
429 | } | - |
430 | } never executed: end of block | 0 |
431 | | - |
432 | | - |
433 | if (cctx->want_ttyTRUE | never evaluated | FALSE | never evaluated |
&& tcgetattr(new_fd[0], &cctx->tio) == -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
434 | error("%s: tcgetattr: %s", __func__, strerror( never executed: error("%s: tcgetattr: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
435 | (*__errno_location ()) never executed: error("%s: tcgetattr: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
436 | )); never executed: error("%s: tcgetattr: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
437 | | - |
438 | | - |
439 | if (!isatty(new_fd[0])TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
440 | set_nonblock(new_fd[0]); never executed: set_nonblock(new_fd[0]); | 0 |
441 | if (!isatty(new_fd[1])TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
442 | set_nonblock(new_fd[1]); never executed: set_nonblock(new_fd[1]); | 0 |
443 | if (!isatty(new_fd[2])TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
444 | set_nonblock(new_fd[2]); never executed: set_nonblock(new_fd[2]); | 0 |
445 | | - |
446 | window = (64*(32*1024)); | - |
447 | packetmax = (32*1024); | - |
448 | if (cctx->want_ttyTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
449 | window >>= 1; | - |
450 | packetmax >>= 1; | - |
451 | } never executed: end of block | 0 |
452 | | - |
453 | nc = channel_new(ssh, "session", 3, | - |
454 | new_fd[0], new_fd[1], new_fd[2], window, packetmax, | - |
455 | 2, "client-session", 0); | - |
456 | | - |
457 | nc->ctl_chan = c->self; | - |
458 | c->remote_id = nc->self; | - |
459 | c->have_remote_id = 1; | - |
460 | | - |
461 | if (cctx->want_ttyTRUE | never evaluated | FALSE | never evaluated |
&& escape_char != 0xffffffffTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
462 | channel_register_filter(ssh, nc->self, | - |
463 | client_simple_escape_filter, | - |
464 | ((void *)0) | - |
465 | , | - |
466 | client_filter_cleanup, | - |
467 | client_new_escape_filter_ctx((int)escape_char)); | - |
468 | } never executed: end of block | 0 |
469 | | - |
470 | debug2("%s: channel_new: %d linked to control channel %d", | - |
471 | __func__, nc->self, nc->ctl_chan); | - |
472 | | - |
473 | channel_send_open(ssh, nc->self); | - |
474 | channel_register_open_confirm(ssh, nc->self, mux_session_confirm, cctx); | - |
475 | c->mux_pause = 1; | - |
476 | channel_register_cleanup(ssh, nc->self, | - |
477 | mux_master_session_cleanup_cb, 1); | - |
478 | | - |
479 | | - |
480 | return never executed: return 0; 0;never executed: return 0; | 0 |
481 | } | - |
482 | | - |
483 | static int | - |
484 | process_mux_alive_check(struct ssh *ssh, u_int rid, | - |
485 | Channel *c, struct sshbuf *m, struct sshbuf *reply) | - |
486 | { | - |
487 | int r; | - |
488 | | - |
489 | debug2("%s: channel %d: alive check", __func__, c->self); | - |
490 | | - |
491 | | - |
492 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, 0x80000005)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
493 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, rid)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
494 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, (u_int)getpid())) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
495 | fatal("%s: reply: %s", __func__, ssh_err(r)); never executed: fatal("%s: reply: %s", __func__, ssh_err(r)); | 0 |
496 | | - |
497 | return never executed: return 0; 0;never executed: return 0; | 0 |
498 | } | - |
499 | | - |
500 | static int | - |
501 | process_mux_terminate(struct ssh *ssh, u_int rid, | - |
502 | Channel *c, struct sshbuf *m, struct sshbuf *reply) | - |
503 | { | - |
504 | debug2("%s: channel %d: terminate request", __func__, c->self); | - |
505 | | - |
506 | if (options.control_master == 3TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
507 | options.control_master == 4TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
508 | if (!ask_permission("Terminate shared connection to %s? ",TRUE | never evaluated | FALSE | never evaluated |
| 0 |
509 | host)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
510 | debug2("%s: termination refused by user", __func__); | - |
511 | reply_error(reply, 0x80000002, rid, | - |
512 | "Permission denied"); | - |
513 | return never executed: return 0; 0;never executed: return 0; | 0 |
514 | } | - |
515 | } never executed: end of block | 0 |
516 | | - |
517 | quit_pending = 1; | - |
518 | reply_ok(reply, rid); | - |
519 | | - |
520 | return never executed: return 0; 0;never executed: return 0; | 0 |
521 | } | - |
522 | | - |
523 | static char * | - |
524 | format_forward(u_int ftype, struct Forward *fwd) | - |
525 | { | - |
526 | char *ret; | - |
527 | | - |
528 | switch (ftype) { | - |
529 | case never executed: case 1: 1:never executed: case 1: | 0 |
530 | xasprintf(&ret, "local forward %.200s:%d -> %.200s:%d", | - |
531 | (fwd->listen_path != | - |
532 | ((void *)0) | - |
533 | ) ? fwd->listen_path : | - |
534 | (fwd->listen_host == | - |
535 | ((void *)0) | - |
536 | ) ? | - |
537 | (options.fwd_opts.gateway_ports ? "*" : "LOCALHOST") : | - |
538 | fwd->listen_host, fwd->listen_port, | - |
539 | (fwd->connect_path != | - |
540 | ((void *)0) | - |
541 | ) ? fwd->connect_path : | - |
542 | fwd->connect_host, fwd->connect_port); | - |
543 | break; never executed: break; | 0 |
544 | case never executed: case 3: 3:never executed: case 3: | 0 |
545 | xasprintf(&ret, "dynamic forward %.200s:%d -> *", | - |
546 | (fwd->listen_host == | - |
547 | ((void *)0) | - |
548 | ) ? | - |
549 | (options.fwd_opts.gateway_ports ? "*" : "LOCALHOST") : | - |
550 | fwd->listen_host, fwd->listen_port); | - |
551 | break; never executed: break; | 0 |
552 | case never executed: case 2: 2:never executed: case 2: | 0 |
553 | xasprintf(&ret, "remote forward %.200s:%d -> %.200s:%d", | - |
554 | (fwd->listen_path != | - |
555 | ((void *)0) | - |
556 | ) ? fwd->listen_path : | - |
557 | (fwd->listen_host == | - |
558 | ((void *)0) | - |
559 | ) ? | - |
560 | "LOCALHOST" : fwd->listen_host, | - |
561 | fwd->listen_port, | - |
562 | (fwd->connect_path != | - |
563 | ((void *)0) | - |
564 | ) ? fwd->connect_path : | - |
565 | fwd->connect_host, fwd->connect_port); | - |
566 | break; never executed: break; | 0 |
567 | default never executed: default: :never executed: default: | 0 |
568 | fatal("%s: unknown forward type %u", __func__, ftype); | - |
569 | } never executed: end of block | 0 |
570 | return never executed: return ret; ret;never executed: return ret; | 0 |
571 | } | - |
572 | | - |
573 | static int | - |
574 | compare_host(const char *a, const char *b) | - |
575 | { | - |
576 | if (a == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
577 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
578 | && b == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
579 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
580 | ) | - |
581 | return never executed: return 1; 1;never executed: return 1; | 0 |
582 | if (a == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
583 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
584 | || b == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
585 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
586 | ) | - |
587 | return never executed: return 0; 0;never executed: return 0; | 0 |
588 | return never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
589 | __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
590 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
591 | ) && __builtin_constant_p ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
592 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
593 | ) && (__s1_len = __builtin_strlen ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
594 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
595 | ), __s2_len = __builtin_strlen ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
596 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
597 | ), (!((size_t)(const void *)(( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
598 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
599 | ) + 1) - (size_t)(const void *)( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
600 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
601 | ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
602 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
603 | ) + 1) - (size_t)(const void *)( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
604 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
605 | ) == 1) || __s2_len >= 4)) ? __builtin_strcmp ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
606 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
607 | , never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
608 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
609 | ) : (__builtin_constant_p ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
610 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
611 | ) && ((size_t)(const void *)(( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
612 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
613 | ) + 1) - (size_t)(const void *)( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
614 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
615 | ) == 1) && (__s1_len = __builtin_strlen ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
616 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
617 | ), __s1_len < 4) ? (__builtin_constant_p ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
618 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
619 | ) && ((size_t)(const void *)(( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
620 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
621 | ) + 1) - (size_t)(const void *)( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
622 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
623 | ) == 1) ? __builtin_strcmp ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
624 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
625 | , never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
626 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
627 | ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
628 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
629 | ); int __result = (((const unsigned char *) (const char *) ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
630 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
631 | ))[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 *) (never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
632 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
633 | ))[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 *) (never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
634 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
635 | ))[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 *) ( a ))[3] - __s2[3]); never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
636 | a never executed: __result = (((const unsigned char *) (const char *) ( a ))[3] - __s2[3]); never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
637 | ))[3] - __s2[3]); never executed: __result = (((const unsigned char *) (const char *) ( a ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : (__builtin_constant_p (never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
638 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
639 | ) && ((size_t)(const void *)(( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
640 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
641 | ) + 1) - (size_t)(const void *)( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
642 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
643 | ) == 1) && (__s2_len = __builtin_strlen ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
644 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
645 | ), __s2_len < 4) ? (__builtin_constant_p ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
646 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
647 | ) && ((size_t)(const void *)(( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
648 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
649 | ) + 1) - (size_t)(const void *)( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
650 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
651 | ) == 1) ? __builtin_strcmp ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
652 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
653 | , never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
654 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
655 | ) : -(__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
656 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
657 | ); int __result = (((const unsigned char *) (const char *) ( never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
658 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
659 | ))[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 *) (never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
660 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
661 | ))[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 *) (never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
662 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
663 | ))[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 *) ( b ))[3] - __s2[3]); never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
664 | b never executed: __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
665 | ))[3] - __s2[3]); never executed: __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); }never executed: end of block }never executed: end of block __result; }))) : __builtin_strcmp (never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
666 | a never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
667 | , never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
668 | b never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
669 | )))); }) never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
670 | == 0; never executed: return __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ( a ) && __builtin_constant_p ( b ) && (__s1_len = __builtin_strlen ( a ), __s2_len = __builtin_strlen ( b ), (!((size_t)(const void *)(( a ) + 1) - (size_t)(const void *)( a ) == 1)...ult == 0) { __result = (((const unsigned char *) (const char *) ( b ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ( b ))[3] - __s2[3]); } } __result; }))) : __builtin_strcmp ( a , b )))); }) == 0; | 0 |
671 | } | - |
672 | | - |
673 | static int | - |
674 | compare_forward(struct Forward *a, struct Forward *b) | - |
675 | { | - |
676 | if (!compare_host(a->listen_host, b->listen_host)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
677 | return never executed: return 0; 0;never executed: return 0; | 0 |
678 | if (!compare_host(a->listen_path, b->listen_path)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
679 | return never executed: return 0; 0;never executed: return 0; | 0 |
680 | if (a->listen_port != b->listen_portTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
681 | return never executed: return 0; 0;never executed: return 0; | 0 |
682 | if (!compare_host(a->connect_host, b->connect_host)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
683 | return never executed: return 0; 0;never executed: return 0; | 0 |
684 | if (!compare_host(a->connect_path, b->connect_path)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
685 | return never executed: return 0; 0;never executed: return 0; | 0 |
686 | if (a->connect_port != b->connect_portTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
687 | return never executed: return 0; 0;never executed: return 0; | 0 |
688 | | - |
689 | return never executed: return 1; 1;never executed: return 1; | 0 |
690 | } | - |
691 | | - |
692 | static void | - |
693 | mux_confirm_remote_forward(struct ssh *ssh, int type, u_int32_t seq, void *ctxt) | - |
694 | { | - |
695 | struct mux_channel_confirm_ctx *fctx = ctxt; | - |
696 | char *failmsg = | - |
697 | ((void *)0) | - |
698 | ; | - |
699 | struct Forward *rfwd; | - |
700 | Channel *c; | - |
701 | struct sshbuf *out; | - |
702 | int r; | - |
703 | | - |
704 | if ((TRUE | never evaluated | FALSE | never evaluated |
c = channel_by_id(ssh, fctx->cid)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
705 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
706 | ) { | - |
707 | | - |
708 | error("%s: unknown channel", __func__); | - |
709 | return; never executed: return; | 0 |
710 | } | - |
711 | if ((TRUE | never evaluated | FALSE | never evaluated |
out = sshbuf_new()) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
712 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
713 | ) | - |
714 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
715 | if (fctx->fid >= options.num_remote_forwardsTRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
716 | (options.remote_forwards[fctx->fid].connect_path == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
717 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
718 | && | - |
719 | options.remote_forwards[fctx->fid].connect_host == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
720 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
721 | )) { | - |
722 | xasprintf(&failmsg, "unknown forwarding id %d", fctx->fid); | - |
723 | goto never executed: goto fail; fail;never executed: goto fail; | 0 |
724 | } | - |
725 | rfwd = &options.remote_forwards[fctx->fid]; | - |
726 | debug("%s: %s for: listen %d, connect %s:%d", __func__, | - |
727 | type == 81 ? "success" : "failure", | - |
728 | rfwd->listen_port, rfwd->connect_path ? rfwd->connect_path : | - |
729 | rfwd->connect_host, rfwd->connect_port); | - |
730 | if (type == 81TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
731 | if (rfwd->listen_port == 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
732 | rfwd->allocated_port = packet_get_int(); | - |
733 | debug("Allocated port %u for mux remote forward" | - |
734 | " to %s:%d", rfwd->allocated_port, | - |
735 | rfwd->connect_host, rfwd->connect_port); | - |
736 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(out,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
737 | 0x80000007)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
738 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(out, fctx->rid)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
739 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(out,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
740 | rfwd->allocated_port)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
741 | fatal("%s: reply: %s", __func__, ssh_err(r)); never executed: fatal("%s: reply: %s", __func__, ssh_err(r)); | 0 |
742 | channel_update_permission(ssh, rfwd->handle, | - |
743 | rfwd->allocated_port); | - |
744 | } never executed: end of block else { | 0 |
745 | reply_ok(out, fctx->rid); | - |
746 | } never executed: end of block | 0 |
747 | goto never executed: goto out; out;never executed: goto out; | 0 |
748 | } else { | - |
749 | if (rfwd->listen_port == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
750 | channel_update_permission(ssh, rfwd->handle, -1); never executed: channel_update_permission(ssh, rfwd->handle, -1); | 0 |
751 | if (rfwd->listen_path != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
752 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
753 | ) | - |
754 | xasprintf(&failmsg, "remote port forwarding failed for " never executed: xasprintf(&failmsg, "remote port forwarding failed for " "listen path %s", rfwd->listen_path); | 0 |
755 | "listen path %s", rfwd->listen_path); never executed: xasprintf(&failmsg, "remote port forwarding failed for " "listen path %s", rfwd->listen_path); | 0 |
756 | else | - |
757 | xasprintf(&failmsg, "remote port forwarding failed for " never executed: xasprintf(&failmsg, "remote port forwarding failed for " "listen port %d", rfwd->listen_port); | 0 |
758 | "listen port %d", rfwd->listen_port); never executed: xasprintf(&failmsg, "remote port forwarding failed for " "listen port %d", rfwd->listen_port); | 0 |
759 | | - |
760 | debug2("%s: clearing registered forwarding for listen %d, " | - |
761 | "connect %s:%d", __func__, rfwd->listen_port, | - |
762 | rfwd->connect_path ? rfwd->connect_path : | - |
763 | rfwd->connect_host, rfwd->connect_port); | - |
764 | | - |
765 | free(rfwd->listen_host); | - |
766 | free(rfwd->listen_path); | - |
767 | free(rfwd->connect_host); | - |
768 | free(rfwd->connect_path); | - |
769 | memset(rfwd, 0, sizeof(*rfwd)); | - |
770 | } never executed: end of block | 0 |
771 | fail: code before this statement never executed: fail: | 0 |
772 | error("%s: %s", __func__, failmsg); | - |
773 | reply_error(out, 0x80000003, fctx->rid, failmsg); | - |
774 | free(failmsg); | - |
775 | out: code before this statement never executed: out: | 0 |
776 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_stringb(c->output, out)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
777 | fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); never executed: fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); | 0 |
778 | sshbuf_free(out); | - |
779 | if (c->mux_pause <= 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
780 | fatal("%s: mux_pause %d", __func__, c->mux_pause); never executed: fatal("%s: mux_pause %d", __func__, c->mux_pause); | 0 |
781 | c->mux_pause = 0; | - |
782 | } never executed: end of block | 0 |
783 | | - |
784 | static int | - |
785 | process_mux_open_fwd(struct ssh *ssh, u_int rid, | - |
786 | Channel *c, struct sshbuf *m, struct sshbuf *reply) | - |
787 | { | - |
788 | struct Forward fwd; | - |
789 | char *fwd_desc = | - |
790 | ((void *)0) | - |
791 | ; | - |
792 | char *listen_addr, *connect_addr; | - |
793 | u_int ftype; | - |
794 | u_int lport, cport; | - |
795 | int r, i, ret = 0, freefwd = 1; | - |
796 | | - |
797 | memset(&fwd, 0, sizeof(fwd)); | - |
798 | | - |
799 | | - |
800 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &ftype)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
801 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &listen_addr, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
802 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
803 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
804 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &lport)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
805 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &connect_addr, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
806 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
807 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
808 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cport)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
809 | (lport != (u_int)-2TRUE | never evaluated | FALSE | never evaluated |
&& lport > 65535TRUE | never evaluated | FALSE | never evaluated |
) || | 0 |
810 | (cport != (u_int)-2TRUE | never evaluated | FALSE | never evaluated |
&& cport > 65535TRUE | never evaluated | FALSE | never evaluated |
)) { | 0 |
811 | error("%s: malformed message", __func__); | - |
812 | ret = -1; | - |
813 | goto never executed: goto out; out;never executed: goto out; | 0 |
814 | } | - |
815 | if (*TRUE | never evaluated | FALSE | never evaluated |
listen_addr == '\0'TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
816 | free(listen_addr); | - |
817 | listen_addr = | - |
818 | ((void *)0) | - |
819 | ; | - |
820 | } never executed: end of block | 0 |
821 | if (*TRUE | never evaluated | FALSE | never evaluated |
connect_addr == '\0'TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
822 | free(connect_addr); | - |
823 | connect_addr = | - |
824 | ((void *)0) | - |
825 | ; | - |
826 | } never executed: end of block | 0 |
827 | | - |
828 | memset(&fwd, 0, sizeof(fwd)); | - |
829 | fwd.listen_port = lport; | - |
830 | if (fwd.listen_port == -2TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
831 | fwd.listen_path = listen_addr; never executed: fwd.listen_path = listen_addr; | 0 |
832 | else | - |
833 | fwd.listen_host = listen_addr; never executed: fwd.listen_host = listen_addr; | 0 |
834 | fwd.connect_port = cport; | - |
835 | if (fwd.connect_port == -2TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
836 | fwd.connect_path = connect_addr; never executed: fwd.connect_path = connect_addr; | 0 |
837 | else | - |
838 | fwd.connect_host = connect_addr; never executed: fwd.connect_host = connect_addr; | 0 |
839 | | - |
840 | debug2("%s: channel %d: request %s", __func__, c->self, | - |
841 | (fwd_desc = format_forward(ftype, &fwd))); | - |
842 | | - |
843 | if (ftype != 1TRUE | never evaluated | FALSE | never evaluated |
&& ftype != 2TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
844 | ftype != 3TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
845 | logit("%s: invalid forwarding type %u", __func__, ftype); | - |
846 | invalid: code before this statement never executed: invalid: | 0 |
847 | free(listen_addr); | - |
848 | free(connect_addr); | - |
849 | reply_error(reply, 0x80000003, rid, | - |
850 | "Invalid forwarding request"); | - |
851 | return never executed: return 0; 0;never executed: return 0; | 0 |
852 | } | - |
853 | if (ftype == 3TRUE | never evaluated | FALSE | never evaluated |
&& fwd.listen_pathTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
854 | logit("%s: streamlocal and dynamic forwards " | - |
855 | "are mutually exclusive", __func__); | - |
856 | goto never executed: goto invalid; invalid;never executed: goto invalid; | 0 |
857 | } | - |
858 | if (fwd.listen_port != -2TRUE | never evaluated | FALSE | never evaluated |
&& fwd.listen_port >= 65536TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
859 | logit("%s: invalid listen port %u", __func__, | - |
860 | fwd.listen_port); | - |
861 | goto never executed: goto invalid; invalid;never executed: goto invalid; | 0 |
862 | } | - |
863 | if ((fwd.connect_port != -2TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
864 | fwd.connect_port >= 65536TRUE | never evaluated | FALSE | never evaluated |
) || | 0 |
865 | (ftype != 3TRUE | never evaluated | FALSE | never evaluated |
&& ftype != 2TRUE | never evaluated | FALSE | never evaluated |
&& | 0 |
866 | fwd.connect_port == 0TRUE | never evaluated | FALSE | never evaluated |
)) { | 0 |
867 | logit("%s: invalid connect port %u", __func__, | - |
868 | fwd.connect_port); | - |
869 | goto never executed: goto invalid; invalid;never executed: goto invalid; | 0 |
870 | } | - |
871 | if (ftype != 3TRUE | never evaluated | FALSE | never evaluated |
&& fwd.connect_host == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
872 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
873 | && | - |
874 | fwd.connect_path == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
875 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
876 | ) { | - |
877 | logit("%s: missing connect host", __func__); | - |
878 | goto never executed: goto invalid; invalid;never executed: goto invalid; | 0 |
879 | } | - |
880 | | - |
881 | | - |
882 | switch (ftype) { | - |
883 | case never executed: case 1: 1:never executed: case 1: | 0 |
884 | case never executed: case 3: 3:never executed: case 3: | 0 |
885 | for (i = 0; i < options.num_local_forwardsTRUE | never evaluated | FALSE | never evaluated |
; i++) { | 0 |
886 | if (compare_forward(&fwd,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
887 | options.local_forwards + i)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
888 | exists: | - |
889 | debug2("%s: found existing forwarding", | - |
890 | __func__); | - |
891 | reply_ok(reply, rid); | - |
892 | goto never executed: goto out; out;never executed: goto out; | 0 |
893 | } | - |
894 | } never executed: end of block | 0 |
895 | break; never executed: break; | 0 |
896 | case never executed: case 2: 2:never executed: case 2: | 0 |
897 | for (i = 0; i < options.num_remote_forwardsTRUE | never evaluated | FALSE | never evaluated |
; i++) { | 0 |
898 | if (!compare_forward(&fwd, options.remote_forwards + i)TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
899 | continue; never executed: continue; | 0 |
900 | if (fwd.listen_port != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
901 | goto never executed: goto exists; exists;never executed: goto exists; | 0 |
902 | debug2("%s: found allocated port", __func__); | - |
903 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
904 | 0x80000007)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
905 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, rid)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
906 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
907 | options.remote_forwards[i].allocated_port)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
908 | fatal("%s: reply: %s", __func__, ssh_err(r)); never executed: fatal("%s: reply: %s", __func__, ssh_err(r)); | 0 |
909 | goto never executed: goto out; out;never executed: goto out; | 0 |
910 | } | - |
911 | break; never executed: break; | 0 |
912 | } | - |
913 | | - |
914 | if (options.control_master == 3TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
915 | options.control_master == 4TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
916 | if (!ask_permission("Open %s on %s?", fwd_desc, host)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
917 | debug2("%s: forwarding refused by user", __func__); | - |
918 | reply_error(reply, 0x80000002, rid, | - |
919 | "Permission denied"); | - |
920 | goto never executed: goto out; out;never executed: goto out; | 0 |
921 | } | - |
922 | } never executed: end of block | 0 |
923 | | - |
924 | if (ftype == 1TRUE | never evaluated | FALSE | never evaluated |
|| ftype == 3TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
925 | if (!channel_setup_local_fwd_listener(ssh, &fwd,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
926 | &options.fwd_opts)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
927 | fail: | - |
928 | logit("slave-requested %s failed", fwd_desc); | - |
929 | reply_error(reply, 0x80000003, rid, | - |
930 | "Port forwarding failed"); | - |
931 | goto never executed: goto out; out;never executed: goto out; | 0 |
932 | } | - |
933 | add_local_forward(&options, &fwd); | - |
934 | freefwd = 0; | - |
935 | } never executed: end of block else { | 0 |
936 | struct mux_channel_confirm_ctx *fctx; | - |
937 | | - |
938 | fwd.handle = channel_request_remote_forwarding(ssh, &fwd); | - |
939 | if (fwd.handle < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
940 | goto never executed: goto fail; fail;never executed: goto fail; | 0 |
941 | add_remote_forward(&options, &fwd); | - |
942 | fctx = xcalloc(1, sizeof(*fctx)); | - |
943 | fctx->cid = c->self; | - |
944 | fctx->rid = rid; | - |
945 | fctx->fid = options.num_remote_forwards - 1; | - |
946 | client_register_global_confirm(mux_confirm_remote_forward, | - |
947 | fctx); | - |
948 | freefwd = 0; | - |
949 | c->mux_pause = 1; | - |
950 | | - |
951 | goto never executed: goto out; out;never executed: goto out; | 0 |
952 | } | - |
953 | reply_ok(reply, rid); | - |
954 | out: code before this statement never executed: out: | 0 |
955 | free(fwd_desc); | - |
956 | if (freefwdTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
957 | free(fwd.listen_host); | - |
958 | free(fwd.listen_path); | - |
959 | free(fwd.connect_host); | - |
960 | free(fwd.connect_path); | - |
961 | } never executed: end of block | 0 |
962 | return never executed: return ret; ret;never executed: return ret; | 0 |
963 | } | - |
964 | | - |
965 | static int | - |
966 | process_mux_close_fwd(struct ssh *ssh, u_int rid, | - |
967 | Channel *c, struct sshbuf *m, struct sshbuf *reply) | - |
968 | { | - |
969 | struct Forward fwd, *found_fwd; | - |
970 | char *fwd_desc = | - |
971 | ((void *)0) | - |
972 | ; | - |
973 | const char *error_reason = | - |
974 | ((void *)0) | - |
975 | ; | - |
976 | char *listen_addr = | - |
977 | ((void *)0) | - |
978 | , *connect_addr = | - |
979 | ((void *)0) | - |
980 | ; | - |
981 | u_int ftype; | - |
982 | int r, i, ret = 0; | - |
983 | u_int lport, cport; | - |
984 | | - |
985 | memset(&fwd, 0, sizeof(fwd)); | - |
986 | | - |
987 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &ftype)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
988 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &listen_addr, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
989 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
990 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
991 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &lport)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
992 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &connect_addr, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
993 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
994 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
995 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cport)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
996 | (lport != (u_int)-2TRUE | never evaluated | FALSE | never evaluated |
&& lport > 65535TRUE | never evaluated | FALSE | never evaluated |
) || | 0 |
997 | (cport != (u_int)-2TRUE | never evaluated | FALSE | never evaluated |
&& cport > 65535TRUE | never evaluated | FALSE | never evaluated |
)) { | 0 |
998 | error("%s: malformed message", __func__); | - |
999 | ret = -1; | - |
1000 | goto never executed: goto out; out;never executed: goto out; | 0 |
1001 | } | - |
1002 | | - |
1003 | if (*TRUE | never evaluated | FALSE | never evaluated |
listen_addr == '\0'TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1004 | free(listen_addr); | - |
1005 | listen_addr = | - |
1006 | ((void *)0) | - |
1007 | ; | - |
1008 | } never executed: end of block | 0 |
1009 | if (*TRUE | never evaluated | FALSE | never evaluated |
connect_addr == '\0'TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1010 | free(connect_addr); | - |
1011 | connect_addr = | - |
1012 | ((void *)0) | - |
1013 | ; | - |
1014 | } never executed: end of block | 0 |
1015 | | - |
1016 | memset(&fwd, 0, sizeof(fwd)); | - |
1017 | fwd.listen_port = lport; | - |
1018 | if (fwd.listen_port == -2TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1019 | fwd.listen_path = listen_addr; never executed: fwd.listen_path = listen_addr; | 0 |
1020 | else | - |
1021 | fwd.listen_host = listen_addr; never executed: fwd.listen_host = listen_addr; | 0 |
1022 | fwd.connect_port = cport; | - |
1023 | if (fwd.connect_port == -2TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1024 | fwd.connect_path = connect_addr; never executed: fwd.connect_path = connect_addr; | 0 |
1025 | else | - |
1026 | fwd.connect_host = connect_addr; never executed: fwd.connect_host = connect_addr; | 0 |
1027 | | - |
1028 | debug2("%s: channel %d: request cancel %s", __func__, c->self, | - |
1029 | (fwd_desc = format_forward(ftype, &fwd))); | - |
1030 | | - |
1031 | | - |
1032 | found_fwd = | - |
1033 | ((void *)0) | - |
1034 | ; | - |
1035 | switch (ftype) { | - |
1036 | case never executed: case 1: 1:never executed: case 1: | 0 |
1037 | case never executed: case 3: 3:never executed: case 3: | 0 |
1038 | for (i = 0; i < options.num_local_forwardsTRUE | never evaluated | FALSE | never evaluated |
; i++) { | 0 |
1039 | if (compare_forward(&fwd,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1040 | options.local_forwards + i)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1041 | found_fwd = options.local_forwards + i; | - |
1042 | break; never executed: break; | 0 |
1043 | } | - |
1044 | } never executed: end of block | 0 |
1045 | break; never executed: break; | 0 |
1046 | case never executed: case 2: 2:never executed: case 2: | 0 |
1047 | for (i = 0; i < options.num_remote_forwardsTRUE | never evaluated | FALSE | never evaluated |
; i++) { | 0 |
1048 | if (compare_forward(&fwd,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1049 | options.remote_forwards + i)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1050 | found_fwd = options.remote_forwards + i; | - |
1051 | break; never executed: break; | 0 |
1052 | } | - |
1053 | } never executed: end of block | 0 |
1054 | break; never executed: break; | 0 |
1055 | } | - |
1056 | | - |
1057 | if (found_fwd == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1058 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1059 | ) | - |
1060 | error_reason = "port not forwarded"; never executed: error_reason = "port not forwarded"; | 0 |
1061 | else if (ftype == 2TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1062 | | - |
1063 | | - |
1064 | | - |
1065 | | - |
1066 | | - |
1067 | | - |
1068 | if (channel_request_rforward_cancel(ssh, found_fwd) == -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1069 | error_reason = "port not in permitted opens"; never executed: error_reason = "port not in permitted opens"; | 0 |
1070 | } never executed: end of block else { | 0 |
1071 | | - |
1072 | if (channel_cancel_lport_listener(ssh, &fwd, fwd.connect_port,TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1073 | &options.fwd_opts) == -1TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1074 | error_reason = "port not found"; never executed: error_reason = "port not found"; | 0 |
1075 | } never executed: end of block | 0 |
1076 | | - |
1077 | if (error_reason != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1078 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1079 | ) | - |
1080 | reply_error(reply, 0x80000003, rid, error_reason); never executed: reply_error(reply, 0x80000003, rid, error_reason); | 0 |
1081 | else { | - |
1082 | reply_ok(reply, rid); | - |
1083 | free(found_fwd->listen_host); | - |
1084 | free(found_fwd->listen_path); | - |
1085 | free(found_fwd->connect_host); | - |
1086 | free(found_fwd->connect_path); | - |
1087 | found_fwd->listen_host = found_fwd->connect_host = | - |
1088 | ((void *)0) | - |
1089 | ; | - |
1090 | found_fwd->listen_path = found_fwd->connect_path = | - |
1091 | ((void *)0) | - |
1092 | ; | - |
1093 | found_fwd->listen_port = found_fwd->connect_port = 0; | - |
1094 | } never executed: end of block | 0 |
1095 | out: code before this statement never executed: out: | 0 |
1096 | free(fwd_desc); | - |
1097 | free(listen_addr); | - |
1098 | free(connect_addr); | - |
1099 | | - |
1100 | return never executed: return ret; ret;never executed: return ret; | 0 |
1101 | } | - |
1102 | | - |
1103 | static int | - |
1104 | process_mux_stdio_fwd(struct ssh *ssh, u_int rid, | - |
1105 | Channel *c, struct sshbuf *m, struct sshbuf *reply) | - |
1106 | { | - |
1107 | Channel *nc; | - |
1108 | char *chost = | - |
1109 | ((void *)0) | - |
1110 | ; | - |
1111 | u_int cport, i, j; | - |
1112 | int r, new_fd[2]; | - |
1113 | struct mux_stdio_confirm_ctx *cctx; | - |
1114 | | - |
1115 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_string_direct(m, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1116 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1117 | , TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1118 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1119 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1120 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &chost, TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1121 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1122 | )) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1123 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cport)) != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1124 | free(chost); | - |
1125 | error("%s: malformed message", __func__); | - |
1126 | return never executed: return -1; -1;never executed: return -1; | 0 |
1127 | } | - |
1128 | | - |
1129 | debug2("%s: channel %d: request stdio fwd to %s:%u", | - |
1130 | __func__, c->self, chost, cport); | - |
1131 | | - |
1132 | | - |
1133 | for(i = 0; i < 2TRUE | never evaluated | FALSE | never evaluated |
; i++) { | 0 |
1134 | if ((TRUE | never evaluated | FALSE | never evaluated |
new_fd[i] = mm_receive_fd(c->sock)) == -1TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1135 | error("%s: failed to receive fd %d from slave", | - |
1136 | __func__, i); | - |
1137 | for (j = 0; j < iTRUE | never evaluated | FALSE | never evaluated |
; j++) | 0 |
1138 | close(new_fd[j]); never executed: close(new_fd[j]); | 0 |
1139 | free(chost); | - |
1140 | | - |
1141 | | - |
1142 | reply_error(reply, 0x80000003, rid, | - |
1143 | "did not receive file descriptors"); | - |
1144 | return never executed: return -1; -1;never executed: return -1; | 0 |
1145 | } | - |
1146 | } never executed: end of block | 0 |
1147 | | - |
1148 | debug3("%s: got fds stdin %d, stdout %d", __func__, | - |
1149 | new_fd[0], new_fd[1]); | - |
1150 | | - |
1151 | | - |
1152 | if (c->have_remote_idTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1153 | debug2("%s: session already open", __func__); | - |
1154 | reply_error(reply, 0x80000003, rid, | - |
1155 | "Multiple sessions not supported"); | - |
1156 | cleanup: code before this statement never executed: cleanup: | 0 |
1157 | close(new_fd[0]); | - |
1158 | close(new_fd[1]); | - |
1159 | free(chost); | - |
1160 | return never executed: return 0; 0;never executed: return 0; | 0 |
1161 | } | - |
1162 | | - |
1163 | if (options.control_master == 3TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1164 | options.control_master == 4TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1165 | if (!ask_permission("Allow forward to %s:%u? ",TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1166 | chost, cport)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1167 | debug2("%s: stdio fwd refused by user", __func__); | - |
1168 | reply_error(reply, 0x80000002, rid, | - |
1169 | "Permission denied"); | - |
1170 | goto never executed: goto cleanup; cleanup;never executed: goto cleanup; | 0 |
1171 | } | - |
1172 | } never executed: end of block | 0 |
1173 | | - |
1174 | | - |
1175 | if (!isatty(new_fd[0])TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1176 | set_nonblock(new_fd[0]); never executed: set_nonblock(new_fd[0]); | 0 |
1177 | if (!isatty(new_fd[1])TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1178 | set_nonblock(new_fd[1]); never executed: set_nonblock(new_fd[1]); | 0 |
1179 | | - |
1180 | nc = channel_connect_stdio_fwd(ssh, chost, cport, new_fd[0], new_fd[1]); | - |
1181 | free(chost); | - |
1182 | | - |
1183 | nc->ctl_chan = c->self; | - |
1184 | c->remote_id = nc->self; | - |
1185 | c->have_remote_id = 1; | - |
1186 | | - |
1187 | debug2("%s: channel_new: %d linked to control channel %d", | - |
1188 | __func__, nc->self, nc->ctl_chan); | - |
1189 | | - |
1190 | channel_register_cleanup(ssh, nc->self, | - |
1191 | mux_master_session_cleanup_cb, 1); | - |
1192 | | - |
1193 | cctx = xcalloc(1, sizeof(*cctx)); | - |
1194 | cctx->rid = rid; | - |
1195 | channel_register_open_confirm(ssh, nc->self, mux_stdio_confirm, cctx); | - |
1196 | c->mux_pause = 1; | - |
1197 | | - |
1198 | | - |
1199 | return never executed: return 0; 0;never executed: return 0; | 0 |
1200 | } | - |
1201 | | - |
1202 | | - |
1203 | static void | - |
1204 | mux_stdio_confirm(struct ssh *ssh, int id, int success, void *arg) | - |
1205 | { | - |
1206 | struct mux_stdio_confirm_ctx *cctx = arg; | - |
1207 | Channel *c, *cc; | - |
1208 | struct sshbuf *reply; | - |
1209 | int r; | - |
1210 | | - |
1211 | if (cctx == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1212 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1213 | ) | - |
1214 | fatal("%s: cctx == NULL", __func__); never executed: fatal("%s: cctx == NULL", __func__); | 0 |
1215 | if ((TRUE | never evaluated | FALSE | never evaluated |
c = channel_by_id(ssh, id)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1216 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1217 | ) | - |
1218 | fatal("%s: no channel for id %d", __func__, id); never executed: fatal("%s: no channel for id %d", __func__, id); | 0 |
1219 | if ((TRUE | never evaluated | FALSE | never evaluated |
cc = channel_by_id(ssh, c->ctl_chan)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1220 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1221 | ) | - |
1222 | fatal("%s: channel %d lacks control channel %d", __func__, never executed: fatal("%s: channel %d lacks control channel %d", __func__, id, c->ctl_chan); | 0 |
1223 | id, c->ctl_chan); never executed: fatal("%s: channel %d lacks control channel %d", __func__, id, c->ctl_chan); | 0 |
1224 | if ((TRUE | never evaluated | FALSE | never evaluated |
reply = sshbuf_new()) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1225 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1226 | ) | - |
1227 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
1228 | | - |
1229 | if (!successTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1230 | debug3("%s: sending failure reply", __func__); | - |
1231 | reply_error(reply, 0x80000003, cctx->rid, | - |
1232 | "Session open refused by peer"); | - |
1233 | | - |
1234 | goto never executed: goto done; done;never executed: goto done; | 0 |
1235 | } | - |
1236 | | - |
1237 | debug3("%s: sending success reply", __func__); | - |
1238 | | - |
1239 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, 0x80000006)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1240 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, cctx->rid)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1241 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, c->self)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1242 | fatal("%s: reply: %s", __func__, ssh_err(r)); never executed: fatal("%s: reply: %s", __func__, ssh_err(r)); | 0 |
1243 | | - |
1244 | done: code before this statement never executed: done: | 0 |
1245 | | - |
1246 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_stringb(cc->output, reply)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1247 | fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); never executed: fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); | 0 |
1248 | sshbuf_free(reply); | - |
1249 | | - |
1250 | if (cc->mux_pause <= 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1251 | fatal("%s: mux_pause %d", __func__, cc->mux_pause); never executed: fatal("%s: mux_pause %d", __func__, cc->mux_pause); | 0 |
1252 | cc->mux_pause = 0; | - |
1253 | c->open_confirm_ctx = | - |
1254 | ((void *)0) | - |
1255 | ; | - |
1256 | free(cctx); | - |
1257 | } never executed: end of block | 0 |
1258 | | - |
1259 | static int | - |
1260 | process_mux_stop_listening(struct ssh *ssh, u_int rid, | - |
1261 | Channel *c, struct sshbuf *m, struct sshbuf *reply) | - |
1262 | { | - |
1263 | debug("%s: channel %d: stop listening", __func__, c->self); | - |
1264 | | - |
1265 | if (options.control_master == 3TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1266 | options.control_master == 4TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1267 | if (!ask_permission("Disable further multiplexing on shared "TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1268 | "connection to %s? ", host)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1269 | debug2("%s: stop listen refused by user", __func__); | - |
1270 | reply_error(reply, 0x80000002, rid, | - |
1271 | "Permission denied"); | - |
1272 | return never executed: return 0; 0;never executed: return 0; | 0 |
1273 | } | - |
1274 | } never executed: end of block | 0 |
1275 | | - |
1276 | if (mux_listener_channel != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1277 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1278 | ) { | - |
1279 | channel_free(ssh, mux_listener_channel); | - |
1280 | client_stop_mux(); | - |
1281 | free(options.control_path); | - |
1282 | options.control_path = | - |
1283 | ((void *)0) | - |
1284 | ; | - |
1285 | mux_listener_channel = | - |
1286 | ((void *)0) | - |
1287 | ; | - |
1288 | muxserver_sock = -1; | - |
1289 | } never executed: end of block | 0 |
1290 | | - |
1291 | reply_ok(reply, rid); | - |
1292 | return never executed: return 0; 0;never executed: return 0; | 0 |
1293 | } | - |
1294 | | - |
1295 | static int | - |
1296 | process_mux_proxy(struct ssh *ssh, u_int rid, | - |
1297 | Channel *c, struct sshbuf *m, struct sshbuf *reply) | - |
1298 | { | - |
1299 | int r; | - |
1300 | | - |
1301 | debug("%s: channel %d: proxy request", __func__, c->self); | - |
1302 | | - |
1303 | c->mux_rcb = channel_proxy_downstream; | - |
1304 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, 0x8000000f)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1305 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(reply, rid)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1306 | fatal("%s: reply: %s", __func__, ssh_err(r)); never executed: fatal("%s: reply: %s", __func__, ssh_err(r)); | 0 |
1307 | | - |
1308 | return never executed: return 0; 0;never executed: return 0; | 0 |
1309 | } | - |
1310 | | - |
1311 | | - |
1312 | static int | - |
1313 | mux_master_read_cb(struct ssh *ssh, Channel *c) | - |
1314 | { | - |
1315 | struct mux_master_state *state = (struct mux_master_state *)c->mux_ctx; | - |
1316 | struct sshbuf *in = | - |
1317 | ((void *)0) | - |
1318 | , *out = | - |
1319 | ((void *)0) | - |
1320 | ; | - |
1321 | u_int type, rid, i; | - |
1322 | int r, ret = -1; | - |
1323 | | - |
1324 | if ((TRUE | never evaluated | FALSE | never evaluated |
out = sshbuf_new()) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1325 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1326 | ) | - |
1327 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
1328 | | - |
1329 | | - |
1330 | if (c->mux_ctx == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1331 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1332 | ) { | - |
1333 | state = xcalloc(1, sizeof(*state)); | - |
1334 | c->mux_ctx = state; | - |
1335 | channel_register_cleanup(ssh, c->self, | - |
1336 | mux_master_control_cleanup_cb, 0); | - |
1337 | | - |
1338 | | - |
1339 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(out, 0x00000001)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1340 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(out, 4)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1341 | fatal("%s: reply: %s", __func__, ssh_err(r)); never executed: fatal("%s: reply: %s", __func__, ssh_err(r)); | 0 |
1342 | | - |
1343 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_stringb(c->output, out)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1344 | fatal("%s: sshbuf_put_stringb: %s", never executed: fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); | 0 |
1345 | __func__, ssh_err(r)); never executed: fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); | 0 |
1346 | debug3("%s: channel %d: hello sent", __func__, c->self); | - |
1347 | ret = 0; | - |
1348 | goto never executed: goto out; out;never executed: goto out; | 0 |
1349 | } | - |
1350 | | - |
1351 | | - |
1352 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_froms(c->input, &in)) != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1353 | malf: | - |
1354 | error("%s: malformed message", __func__); | - |
1355 | goto never executed: goto out; out;never executed: goto out; | 0 |
1356 | } | - |
1357 | | - |
1358 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(in, &type)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1359 | goto never executed: goto malf; malf;never executed: goto malf; | 0 |
1360 | debug3("%s: channel %d packet type 0x%08x len %zu", | - |
1361 | __func__, c->self, type, sshbuf_len(in)); | - |
1362 | | - |
1363 | if (type == 0x00000001TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1364 | rid = 0; never executed: rid = 0; | 0 |
1365 | else { | - |
1366 | if (!state->hello_rcvdTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1367 | error("%s: expected MUX_MSG_HELLO(0x%08x), " | - |
1368 | "received 0x%08x", __func__, 0x00000001, type); | - |
1369 | goto never executed: goto out; out;never executed: goto out; | 0 |
1370 | } | - |
1371 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_get_u32(in, &rid)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1372 | goto never executed: goto malf; malf;never executed: goto malf; | 0 |
1373 | } never executed: end of block | 0 |
1374 | | - |
1375 | for (i = 0; mux_master_handlers[i].handler != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1376 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1377 | ; i++) { | - |
1378 | if (type == mux_master_handlers[i].typeTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1379 | ret = mux_master_handlers[i].handler(ssh, rid, | - |
1380 | c, in, out); | - |
1381 | break; never executed: break; | 0 |
1382 | } | - |
1383 | } never executed: end of block | 0 |
1384 | if (mux_master_handlers[i].handler == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1385 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1386 | ) { | - |
1387 | error("%s: unsupported mux message 0x%08x", __func__, type); | - |
1388 | reply_error(out, 0x80000003, rid, "unsupported request"); | - |
1389 | ret = 0; | - |
1390 | } never executed: end of block | 0 |
1391 | | - |
1392 | if (sshbuf_len(out) != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1393 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_stringb(c->output, out)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1394 | fatal("%s: sshbuf_put_stringb: %s", never executed: fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); | 0 |
1395 | __func__, ssh_err(r)); never executed: fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); | 0 |
1396 | } never executed: end of block | 0 |
1397 | out: code before this statement never executed: out: | 0 |
1398 | sshbuf_free(in); | - |
1399 | sshbuf_free(out); | - |
1400 | return never executed: return ret; ret;never executed: return ret; | 0 |
1401 | } | - |
1402 | | - |
1403 | void | - |
1404 | mux_exit_message(struct ssh *ssh, Channel *c, int exitval) | - |
1405 | { | - |
1406 | struct sshbuf *m; | - |
1407 | Channel *mux_chan; | - |
1408 | int r; | - |
1409 | | - |
1410 | debug3("%s: channel %d: exit message, exitval %d", __func__, c->self, | - |
1411 | exitval); | - |
1412 | | - |
1413 | if ((TRUE | never evaluated | FALSE | never evaluated |
mux_chan = channel_by_id(ssh, c->ctl_chan)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1414 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1415 | ) | - |
1416 | fatal("%s: channel %d missing mux channel %d", never executed: fatal("%s: channel %d missing mux channel %d", __func__, c->self, c->ctl_chan); | 0 |
1417 | __func__, c->self, c->ctl_chan); never executed: fatal("%s: channel %d missing mux channel %d", __func__, c->self, c->ctl_chan); | 0 |
1418 | | - |
1419 | | - |
1420 | if ((TRUE | never evaluated | FALSE | never evaluated |
m = sshbuf_new()) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1421 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1422 | ) | - |
1423 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
1424 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(m, 0x80000004)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1425 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(m, c->self)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1426 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(m, exitval)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1427 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_stringb(mux_chan->output, m)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1428 | fatal("%s: reply: %s", __func__, ssh_err(r)); never executed: fatal("%s: reply: %s", __func__, ssh_err(r)); | 0 |
1429 | sshbuf_free(m); | - |
1430 | } never executed: end of block | 0 |
1431 | | - |
1432 | void | - |
1433 | mux_tty_alloc_failed(struct ssh *ssh, Channel *c) | - |
1434 | { | - |
1435 | struct sshbuf *m; | - |
1436 | Channel *mux_chan; | - |
1437 | int r; | - |
1438 | | - |
1439 | debug3("%s: channel %d: TTY alloc failed", __func__, c->self); | - |
1440 | | - |
1441 | if ((TRUE | never evaluated | FALSE | never evaluated |
mux_chan = channel_by_id(ssh, c->ctl_chan)) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1442 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1443 | ) | - |
1444 | fatal("%s: channel %d missing mux channel %d", never executed: fatal("%s: channel %d missing mux channel %d", __func__, c->self, c->ctl_chan); | 0 |
1445 | __func__, c->self, c->ctl_chan); never executed: fatal("%s: channel %d missing mux channel %d", __func__, c->self, c->ctl_chan); | 0 |
1446 | | - |
1447 | | - |
1448 | if ((TRUE | never evaluated | FALSE | never evaluated |
m = sshbuf_new()) == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1449 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1450 | ) | - |
1451 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
1452 | if ((TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(m, 0x80000008)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1453 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_u32(m, c->self)) != 0TRUE | never evaluated | FALSE | never evaluated |
|| | 0 |
1454 | (TRUE | never evaluated | FALSE | never evaluated |
r = sshbuf_put_stringb(mux_chan->output, m)) != 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1455 | fatal("%s: reply: %s", __func__, ssh_err(r)); never executed: fatal("%s: reply: %s", __func__, ssh_err(r)); | 0 |
1456 | sshbuf_free(m); | - |
1457 | } never executed: end of block | 0 |
1458 | | - |
1459 | | - |
1460 | void | - |
1461 | muxserver_listen(struct ssh *ssh) | - |
1462 | { | - |
1463 | mode_t old_umask; | - |
1464 | char *orig_control_path = options.control_path; | - |
1465 | char rbuf[16+1]; | - |
1466 | u_int i, r; | - |
1467 | int oerrno; | - |
1468 | | - |
1469 | if (options.control_path == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1470 | ((void *)0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1471 | || | - |
1472 | options.control_master == 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
1473 | return; never executed: return; | 0 |
1474 | | - |
1475 | debug("setting up multiplex master socket"); | - |
1476 | | - |
1477 | | - |
1478 | | - |
1479 | | - |
1480 | | - |
1481 | | - |
1482 | | - |
1483 | for (i = 0; i < sizeof(rbuf) - 1TRUE | never evaluated | FALSE | never evaluated |
; i++) { | 0 |
1484 | r = arc4random_uniform(26+26+10); | - |
1485 | rbuf[i] = (TRUE | never evaluated | FALSE | never evaluated |
r < 26)TRUE | never evaluated | FALSE | never evaluated |
? 'a' + r : | 0 |
1486 | (TRUE | never evaluated | FALSE | never evaluated |
r < 26*2)TRUE | never evaluated | FALSE | never evaluated |
? 'A' + r - 26 : | 0 |
1487 | '0' + r - 26 - 26; | - |
1488 | } never executed: end of block | 0 |
1489 | rbuf[sizeof(rbuf) - 1] = '\0'; | - |
1490 | options.control_path = | - |
1491 | ((void *)0) | - |
1492 | ; | - |
1493 | xasprintf(&options.control_path, "%s.%s", orig_control_path, rbuf); | - |
1494 | debug3("%s: temporary control path %s", __func__, options.control_path); | - |
1495 | | - |
1496 | old_umask = umask(0177); | - |
1497 | muxserver_sock = unix_listener(options.control_path, 64, 0); | - |
1498 | oerrno = | - |
1499 | (*__errno_location ()) | - |
1500 | ; | - |
1501 | umask(old_umask); | - |
1502 | if (muxserver_sock < 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1503 | if (oerrno == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1504 | 22TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1505 | || oerrno == TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1506 | 98TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1507 | ) { | - |
1508 | error("ControlSocket %s already exists, " | - |
1509 | "disabling multiplexing", options.control_path); | - |
1510 | disable_mux_master: code before this statement never executed: disable_mux_master: | 0 |
1511 | if (muxserver_sock != -1TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1512 | close(muxserver_sock); | - |
1513 | muxserver_sock = -1; | - |
1514 | } never executed: end of block | 0 |
1515 | free(orig_control_path); | - |
1516 | free(options.control_path); | - |
1517 | options.control_path = | - |
1518 | ((void *)0) | - |
1519 | ; | - |
1520 | options.control_master = 0; | - |
1521 | return; never executed: return; | 0 |
1522 | } else { | - |
1523 | | - |
1524 | cleanup_exit(255); | - |
1525 | } never executed: end of block | 0 |
1526 | } | - |
1527 | | - |
1528 | | - |
1529 | if (link(options.control_path, orig_control_path) != 0TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
1530 | if ( | - |
1531 | (*TRUE | never evaluated | FALSE | never evaluated |
__errno_location ()) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1532 | != TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1533 | 17TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1534 | ) { | - |
1535 | fatal("%s: link mux listener %s => %s: %s", __func__, | - |
1536 | options.control_path, orig_control_path, | - |
1537 | strerror( | - |
1538 | (*__errno_location ()) | - |
|