| 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 != -1| TRUE | 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_id| TRUE | 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 != 4| TRUE | never evaluated | | FALSE | never evaluated |
&& | 0 |
| 161 | sc->type != 3| TRUE | 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 == 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 166 | chan_read_failed(ssh, sc); never executed: chan_read_failed(ssh, sc); | 0 |
| 167 | if (sc->ostate == 0| TRUE | 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 | env| TRUE | 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 | env| TRUE | 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 | env| TRUE | 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 == env| TRUE | 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 <= 0| TRUE | 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_env| TRUE | 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_rcvd| TRUE | 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)) != 0| TRUE | 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 != 4| TRUE | 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) > 0| TRUE | 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 | )) != 0| TRUE | 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 | )) != 0| TRUE | 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)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 275 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(reply, rid)) != 0| TRUE | 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)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 286 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(reply, rid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 287 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_cstring(reply, msg)) != 0| TRUE | 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 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 319 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cctx->want_tty)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 320 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cctx->want_x_fwd)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 321 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cctx->want_agent_fwd)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 322 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cctx->want_subsys)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 323 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &escape_char)) != 0| TRUE | 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 | )) != 0| TRUE | 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 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 330 | malf: | - |
| 331 | free(cmd); | - |
| 332 | for (j = 0; j < env_len| TRUE | 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) > 0| TRUE | 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 | )) != 0| TRUE | 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 > 4096| TRUE | 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))) != 0| TRUE | 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 < 3| TRUE | never evaluated | | FALSE | never evaluated |
; i++) { | 0 |
| 382 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
new_fd[i] = mm_receive_fd(c->sock)) == -1| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 383 | error("%s: failed to receive fd %d from slave", | - |
| 384 | __func__, i); | - |
| 385 | for (j = 0; j < i| TRUE | 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_len| TRUE | 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_id| TRUE | 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 != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 413 | for (i = 0; i < env_len| TRUE | 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 == 3| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 423 | options.control_master == 4| TRUE | 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_tty| TRUE | never evaluated | | FALSE | never evaluated |
&& tcgetattr(new_fd[0], &cctx->tio) == -1| TRUE | 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_tty| TRUE | 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_tty| TRUE | never evaluated | | FALSE | never evaluated |
&& escape_char != 0xffffffff| TRUE | 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)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 493 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(reply, rid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 494 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(reply, (u_int)getpid())) != 0| TRUE | 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 == 3| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 507 | options.control_master == 4| TRUE | 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 > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | 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 > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | 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 > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | 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 > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | 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 > 1| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | 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 > 2| TRUE | never evaluated | | FALSE | never evaluated |
&& __result == 0| TRUE | 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_port| TRUE | 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_port| TRUE | 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_forwards| TRUE | 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 == 81| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 731 | if (rfwd->listen_port == 0| TRUE | 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)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 738 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(out, fctx->rid)) != 0| TRUE | 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)) != 0| TRUE | 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 == 0| TRUE | 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)) != 0| TRUE | 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 <= 0| TRUE | 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)) != 0| TRUE | 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 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 804 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &lport)) != 0| TRUE | 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 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 808 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cport)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 809 | (lport != (u_int)-2| TRUE | never evaluated | | FALSE | never evaluated |
&& lport > 65535| TRUE | never evaluated | | FALSE | never evaluated |
) || | 0 |
| 810 | (cport != (u_int)-2| TRUE | never evaluated | | FALSE | never evaluated |
&& cport > 65535| TRUE | 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 == -2| TRUE | 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 == -2| TRUE | 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 != 1| TRUE | never evaluated | | FALSE | never evaluated |
&& ftype != 2| TRUE | never evaluated | | FALSE | never evaluated |
&& | 0 |
| 844 | ftype != 3| TRUE | 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 == 3| TRUE | never evaluated | | FALSE | never evaluated |
&& fwd.listen_path| TRUE | 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 != -2| TRUE | never evaluated | | FALSE | never evaluated |
&& fwd.listen_port >= 65536| TRUE | 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 != -2| TRUE | never evaluated | | FALSE | never evaluated |
&& | 0 |
| 864 | fwd.connect_port >= 65536| TRUE | never evaluated | | FALSE | never evaluated |
) || | 0 |
| 865 | (ftype != 3| TRUE | never evaluated | | FALSE | never evaluated |
&& ftype != 2| TRUE | never evaluated | | FALSE | never evaluated |
&& | 0 |
| 866 | fwd.connect_port == 0| TRUE | 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 != 3| TRUE | 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_forwards| TRUE | 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_forwards| TRUE | 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 != 0| TRUE | 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)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 905 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(reply, rid)) != 0| TRUE | 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)) != 0| TRUE | 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 == 3| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 915 | options.control_master == 4| TRUE | 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 == 1| TRUE | never evaluated | | FALSE | never evaluated |
|| ftype == 3| TRUE | 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 < 0| TRUE | 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 (freefwd| TRUE | 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)) != 0| TRUE | 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 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 991 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &lport)) != 0| TRUE | 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 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 995 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cport)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 996 | (lport != (u_int)-2| TRUE | never evaluated | | FALSE | never evaluated |
&& lport > 65535| TRUE | never evaluated | | FALSE | never evaluated |
) || | 0 |
| 997 | (cport != (u_int)-2| TRUE | never evaluated | | FALSE | never evaluated |
&& cport > 65535| TRUE | 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 == -2| TRUE | 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 == -2| TRUE | 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_forwards| TRUE | 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_forwards| TRUE | 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 == 2| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1062 | | - |
| 1063 | | - |
| 1064 | | - |
| 1065 | | - |
| 1066 | | - |
| 1067 | | - |
| 1068 | if (channel_request_rforward_cancel(ssh, found_fwd) == -1| TRUE | 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) == -1| TRUE | 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 | )) != 0| TRUE | 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 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1123 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &cport)) != 0| TRUE | 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 < 2| TRUE | never evaluated | | FALSE | never evaluated |
; i++) { | 0 |
| 1134 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
new_fd[i] = mm_receive_fd(c->sock)) == -1| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1135 | error("%s: failed to receive fd %d from slave", | - |
| 1136 | __func__, i); | - |
| 1137 | for (j = 0; j < i| TRUE | 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_id| TRUE | 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 == 3| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1164 | options.control_master == 4| TRUE | 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 (!success| TRUE | 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)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1240 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(reply, cctx->rid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1241 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(reply, c->self)) != 0| TRUE | 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)) != 0| TRUE | 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 <= 0| TRUE | 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 == 3| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1266 | options.control_master == 4| TRUE | 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)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1305 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(reply, rid)) != 0| TRUE | 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)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1340 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(out, 4)) != 0| TRUE | 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)) != 0| TRUE | 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)) != 0| TRUE | 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)) != 0| TRUE | 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 == 0x00000001| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1364 | rid = 0; never executed: rid = 0; | 0 |
| 1365 | else { | - |
| 1366 | if (!state->hello_rcvd| TRUE | 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)) != 0| TRUE | 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].type| TRUE | 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) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1393 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_stringb(c->output, out)) != 0| TRUE | 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)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1425 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, c->self)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1426 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, exitval)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1427 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_stringb(mux_chan->output, m)) != 0| TRUE | 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)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1453 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, c->self)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1454 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_stringb(mux_chan->output, m)) != 0| TRUE | 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 == 0| TRUE | 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) - 1| TRUE | 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 < 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1503 | if (oerrno == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1504 | 22| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1505 | || oerrno == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1506 | 98| TRUE | 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 != -1| TRUE | 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) != 0| TRUE | 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 | 17| TRUE | 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 ()) | - |
| 1539 | )); | - |
| 1540 | } never executed: end of block | 0 |
| 1541 | error("ControlSocket %s already exists, disabling multiplexing", | - |
| 1542 | orig_control_path); | - |
| 1543 | unlink(options.control_path); | - |
| 1544 | goto never executed: goto disable_mux_master; disable_mux_master;never executed: goto disable_mux_master; | 0 |
| 1545 | } | - |
| 1546 | unlink(options.control_path); | - |
| 1547 | free(options.control_path); | - |
| 1548 | options.control_path = orig_control_path; | - |
| 1549 | | - |
| 1550 | set_nonblock(muxserver_sock); | - |
| 1551 | | - |
| 1552 | mux_listener_channel = channel_new(ssh, "mux listener", | - |
| 1553 | 15, muxserver_sock, muxserver_sock, -1, | - |
| 1554 | (64*(32*1024)), (32*1024), | - |
| 1555 | 0, options.control_path, 1); | - |
| 1556 | mux_listener_channel->mux_rcb = mux_master_read_cb; | - |
| 1557 | debug3("%s: mux listener channel %d fd %d", __func__, | - |
| 1558 | mux_listener_channel->self, mux_listener_channel->sock); | - |
| 1559 | } never executed: end of block | 0 |
| 1560 | | - |
| 1561 | | - |
| 1562 | static void | - |
| 1563 | mux_session_confirm(struct ssh *ssh, int id, int success, void *arg) | - |
| 1564 | { | - |
| 1565 | struct mux_session_confirm_ctx *cctx = arg; | - |
| 1566 | const char *display; | - |
| 1567 | Channel *c, *cc; | - |
| 1568 | int i, r; | - |
| 1569 | struct sshbuf *reply; | - |
| 1570 | | - |
| 1571 | if (cctx == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1572 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1573 | ) | - |
| 1574 | fatal("%s: cctx == NULL", __func__); never executed: fatal("%s: cctx == NULL", __func__); | 0 |
| 1575 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
c = channel_by_id(ssh, id)) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1576 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1577 | ) | - |
| 1578 | fatal("%s: no channel for id %d", __func__, id); never executed: fatal("%s: no channel for id %d", __func__, id); | 0 |
| 1579 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
cc = channel_by_id(ssh, c->ctl_chan)) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1580 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1581 | ) | - |
| 1582 | 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 |
| 1583 | id, c->ctl_chan); never executed: fatal("%s: channel %d lacks control channel %d", __func__, id, c->ctl_chan); | 0 |
| 1584 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
reply = sshbuf_new()) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1585 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1586 | ) | - |
| 1587 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
| 1588 | | - |
| 1589 | if (!success| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1590 | debug3("%s: sending failure reply", __func__); | - |
| 1591 | reply_error(reply, 0x80000003, cctx->rid, | - |
| 1592 | "Session open refused by peer"); | - |
| 1593 | goto never executed: goto done; done;never executed: goto done; | 0 |
| 1594 | } | - |
| 1595 | | - |
| 1596 | display = getenv("DISPLAY"); | - |
| 1597 | if (cctx->want_x_fwd| TRUE | never evaluated | | FALSE | never evaluated |
&& options.forward_x11| TRUE | never evaluated | | FALSE | never evaluated |
&& display != | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1598 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1599 | ) { | - |
| 1600 | char *proto, *data; | - |
| 1601 | | - |
| 1602 | | - |
| 1603 | if (client_x11_get_proto(ssh, display, options.xauth_location,| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1604 | options.forward_x11_trusted, options.forward_x11_timeout,| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1605 | &proto, &data) == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1606 | | - |
| 1607 | debug("Requesting X11 forwarding with authentication " | - |
| 1608 | "spoofing."); | - |
| 1609 | x11_request_forwarding_with_spoofing(ssh, id, | - |
| 1610 | display, proto, data, 1); | - |
| 1611 | | - |
| 1612 | client_expect_confirm(ssh, id, "X11 forwarding", | - |
| 1613 | CONFIRM_WARN); | - |
| 1614 | } never executed: end of block | 0 |
| 1615 | } never executed: end of block | 0 |
| 1616 | | - |
| 1617 | if (cctx->want_agent_fwd| TRUE | never evaluated | | FALSE | never evaluated |
&& options.forward_agent| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1618 | debug("Requesting authentication agent forwarding."); | - |
| 1619 | channel_request_start(ssh, id, "auth-agent-req@openssh.com", 0); | - |
| 1620 | ssh_packet_send(active_state); | - |
| 1621 | } never executed: end of block | 0 |
| 1622 | | - |
| 1623 | client_session2_setup(ssh, id, cctx->want_tty, cctx->want_subsys, | - |
| 1624 | cctx->term, &cctx->tio, c->rfd, cctx->cmd, cctx->env); | - |
| 1625 | | - |
| 1626 | debug3("%s: sending success reply", __func__); | - |
| 1627 | | - |
| 1628 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(reply, 0x80000006)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1629 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(reply, cctx->rid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1630 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(reply, c->self)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1631 | fatal("%s: reply: %s", __func__, ssh_err(r)); never executed: fatal("%s: reply: %s", __func__, ssh_err(r)); | 0 |
| 1632 | | - |
| 1633 | done: code before this statement never executed: done: | 0 |
| 1634 | | - |
| 1635 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_stringb(cc->output, reply)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1636 | fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); never executed: fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); | 0 |
| 1637 | sshbuf_free(reply); | - |
| 1638 | | - |
| 1639 | if (cc->mux_pause <= 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1640 | fatal("%s: mux_pause %d", __func__, cc->mux_pause); never executed: fatal("%s: mux_pause %d", __func__, cc->mux_pause); | 0 |
| 1641 | cc->mux_pause = 0; | - |
| 1642 | c->open_confirm_ctx = | - |
| 1643 | ((void *)0) | - |
| 1644 | ; | - |
| 1645 | sshbuf_free(cctx->cmd); | - |
| 1646 | free(cctx->term); | - |
| 1647 | if (cctx->env != | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1648 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1649 | ) { | - |
| 1650 | for (i = 0; cctx->env[i] != | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1651 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1652 | ; i++) | - |
| 1653 | free(cctx->env[i]); never executed: free(cctx->env[i]); | 0 |
| 1654 | free(cctx->env); | - |
| 1655 | } never executed: end of block | 0 |
| 1656 | free(cctx); | - |
| 1657 | } never executed: end of block | 0 |
| 1658 | | - |
| 1659 | | - |
| 1660 | | - |
| 1661 | | - |
| 1662 | static void | - |
| 1663 | control_client_sighandler(int signo) | - |
| 1664 | { | - |
| 1665 | muxclient_terminate = signo; | - |
| 1666 | } never executed: end of block | 0 |
| 1667 | | - |
| 1668 | | - |
| 1669 | | - |
| 1670 | | - |
| 1671 | | - |
| 1672 | static void | - |
| 1673 | control_client_sigrelay(int signo) | - |
| 1674 | { | - |
| 1675 | int save_errno = | - |
| 1676 | (*__errno_location ()) | - |
| 1677 | ; | - |
| 1678 | | - |
| 1679 | if (muxserver_pid > 1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1680 | kill(muxserver_pid, signo); never executed: kill(muxserver_pid, signo); | 0 |
| 1681 | | - |
| 1682 | | - |
| 1683 | (*__errno_location ()) | - |
| 1684 | = save_errno; | - |
| 1685 | } never executed: end of block | 0 |
| 1686 | | - |
| 1687 | static int | - |
| 1688 | mux_client_read(int fd, struct sshbuf *b, size_t need) | - |
| 1689 | { | - |
| 1690 | size_t have; | - |
| 1691 | ssize_t len; | - |
| 1692 | u_char *p; | - |
| 1693 | struct pollfd pfd; | - |
| 1694 | int r; | - |
| 1695 | | - |
| 1696 | pfd.fd = fd; | - |
| 1697 | pfd.events = | - |
| 1698 | 0x001 | - |
| 1699 | ; | - |
| 1700 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_reserve(b, need, &p)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1701 | fatal("%s: reserve: %s", __func__, ssh_err(r)); never executed: fatal("%s: reserve: %s", __func__, ssh_err(r)); | 0 |
| 1702 | for (have = 0; have < need| TRUE | never evaluated | | FALSE | never evaluated |
; ) { | 0 |
| 1703 | if (muxclient_terminate| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1704 | | - |
| 1705 | (*__errno_location ()) | - |
| 1706 | = | - |
| 1707 | 4 | - |
| 1708 | ; | - |
| 1709 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 1710 | } | - |
| 1711 | len = read(fd, p + have, need - have); | - |
| 1712 | if (len < 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1713 | switch ( | - |
| 1714 | (*__errno_location ()) | - |
| 1715 | ) { | - |
| 1716 | | - |
| 1717 | | - |
| 1718 | | - |
| 1719 | case never executed: case 11 : never executed: case 11 : | 0 |
| 1720 | 11 never executed: case 11 : | 0 |
| 1721 | : never executed: case 11 : | 0 |
| 1722 | (void)poll(&pfd, 1, -1); | - |
| 1723 | | - |
| 1724 | case never executed: case 4 : never executed: case 4 : code before this statement never executed: case 4 : | 0 |
| 1725 | 4 never executed: case 4 : code before this statement never executed: case 4 : | 0 |
| 1726 | : never executed: case 4 : code before this statement never executed: case 4 : | 0 |
| 1727 | continue; never executed: continue; | 0 |
| 1728 | default never executed: default: :never executed: default: | 0 |
| 1729 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 1730 | } | - |
| 1731 | } | - |
| 1732 | if (len == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1733 | | - |
| 1734 | (*__errno_location ()) | - |
| 1735 | = | - |
| 1736 | 32 | - |
| 1737 | ; | - |
| 1738 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 1739 | } | - |
| 1740 | have += (size_t)len; | - |
| 1741 | } never executed: end of block | 0 |
| 1742 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 1743 | } | - |
| 1744 | | - |
| 1745 | static int | - |
| 1746 | mux_client_write_packet(int fd, struct sshbuf *m) | - |
| 1747 | { | - |
| 1748 | struct sshbuf *queue; | - |
| 1749 | u_int have, need; | - |
| 1750 | int r, oerrno, len; | - |
| 1751 | const u_char *ptr; | - |
| 1752 | struct pollfd pfd; | - |
| 1753 | | - |
| 1754 | pfd.fd = fd; | - |
| 1755 | pfd.events = | - |
| 1756 | 0x004 | - |
| 1757 | ; | - |
| 1758 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
queue = sshbuf_new()) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1759 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1760 | ) | - |
| 1761 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
| 1762 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_stringb(queue, m)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1763 | fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); never executed: fatal("%s: sshbuf_put_stringb: %s", __func__, ssh_err(r)); | 0 |
| 1764 | | - |
| 1765 | need = sshbuf_len(queue); | - |
| 1766 | ptr = sshbuf_ptr(queue); | - |
| 1767 | | - |
| 1768 | for (have = 0; have < need| TRUE | never evaluated | | FALSE | never evaluated |
; ) { | 0 |
| 1769 | if (muxclient_terminate| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1770 | sshbuf_free(queue); | - |
| 1771 | | - |
| 1772 | (*__errno_location ()) | - |
| 1773 | = | - |
| 1774 | 4 | - |
| 1775 | ; | - |
| 1776 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 1777 | } | - |
| 1778 | len = write(fd, ptr + have, need - have); | - |
| 1779 | if (len < 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1780 | switch ( | - |
| 1781 | (*__errno_location ()) | - |
| 1782 | ) { | - |
| 1783 | | - |
| 1784 | | - |
| 1785 | | - |
| 1786 | case never executed: case 11 : never executed: case 11 : | 0 |
| 1787 | 11 never executed: case 11 : | 0 |
| 1788 | : never executed: case 11 : | 0 |
| 1789 | (void)poll(&pfd, 1, -1); | - |
| 1790 | | - |
| 1791 | case never executed: case 4 : never executed: case 4 : code before this statement never executed: case 4 : | 0 |
| 1792 | 4 never executed: case 4 : code before this statement never executed: case 4 : | 0 |
| 1793 | : never executed: case 4 : code before this statement never executed: case 4 : | 0 |
| 1794 | continue; never executed: continue; | 0 |
| 1795 | default never executed: default: :never executed: default: | 0 |
| 1796 | oerrno = | - |
| 1797 | (*__errno_location ()) | - |
| 1798 | ; | - |
| 1799 | sshbuf_free(queue); | - |
| 1800 | | - |
| 1801 | (*__errno_location ()) | - |
| 1802 | = oerrno; | - |
| 1803 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 1804 | } | - |
| 1805 | } | - |
| 1806 | if (len == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1807 | sshbuf_free(queue); | - |
| 1808 | | - |
| 1809 | (*__errno_location ()) | - |
| 1810 | = | - |
| 1811 | 32 | - |
| 1812 | ; | - |
| 1813 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 1814 | } | - |
| 1815 | have += (u_int)len; | - |
| 1816 | } never executed: end of block | 0 |
| 1817 | sshbuf_free(queue); | - |
| 1818 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 1819 | } | - |
| 1820 | | - |
| 1821 | static int | - |
| 1822 | mux_client_read_packet(int fd, struct sshbuf *m) | - |
| 1823 | { | - |
| 1824 | struct sshbuf *queue; | - |
| 1825 | size_t need, have; | - |
| 1826 | const u_char *ptr; | - |
| 1827 | int r, oerrno; | - |
| 1828 | | - |
| 1829 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
queue = sshbuf_new()) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1830 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1831 | ) | - |
| 1832 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
| 1833 | if (mux_client_read(fd, queue, 4) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1834 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
oerrno = | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1835 | (*__errno_location ())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1836 | ) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1837 | 32| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1838 | ) | - |
| 1839 | debug3("%s: read header failed: %s", __func__, never executed: debug3("%s: read header failed: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 1840 | strerror( never executed: debug3("%s: read header failed: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 1841 | (*__errno_location ()) never executed: debug3("%s: read header failed: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 1842 | )); never executed: debug3("%s: read header failed: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 1843 | sshbuf_free(queue); | - |
| 1844 | | - |
| 1845 | (*__errno_location ()) | - |
| 1846 | = oerrno; | - |
| 1847 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 1848 | } | - |
| 1849 | need = (((u_int32_t)(((const u_char *)(sshbuf_ptr(queue)))[0]) << 24) | ((u_int32_t)(((const u_char *)(sshbuf_ptr(queue)))[1]) << 16) | ((u_int32_t)(((const u_char *)(sshbuf_ptr(queue)))[2]) << 8) | (u_int32_t)(((const u_char *)(sshbuf_ptr(queue)))[3])); | - |
| 1850 | if (mux_client_read(fd, queue, need) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1851 | oerrno = | - |
| 1852 | (*__errno_location ()) | - |
| 1853 | ; | - |
| 1854 | debug3("%s: read body failed: %s", __func__, strerror( | - |
| 1855 | (*__errno_location ()) | - |
| 1856 | )); | - |
| 1857 | sshbuf_free(queue); | - |
| 1858 | | - |
| 1859 | (*__errno_location ()) | - |
| 1860 | = oerrno; | - |
| 1861 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 1862 | } | - |
| 1863 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_string_direct(queue, &ptr, &have)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1864 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put(m, ptr, have)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1865 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); never executed: fatal("%s: buffer error: %s", __func__, ssh_err(r)); | 0 |
| 1866 | sshbuf_free(queue); | - |
| 1867 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 1868 | } | - |
| 1869 | | - |
| 1870 | static int | - |
| 1871 | mux_client_hello_exchange(int fd) | - |
| 1872 | { | - |
| 1873 | struct sshbuf *m; | - |
| 1874 | u_int type, ver; | - |
| 1875 | int r, ret = -1; | - |
| 1876 | | - |
| 1877 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
m = sshbuf_new()) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1878 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1879 | ) | - |
| 1880 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
| 1881 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, 0x00000001)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1882 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, 4)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1883 | fatal("%s: hello: %s", __func__, ssh_err(r)); never executed: fatal("%s: hello: %s", __func__, ssh_err(r)); | 0 |
| 1884 | | - |
| 1885 | | - |
| 1886 | if (mux_client_write_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1887 | debug("%s: write packet: %s", __func__, strerror( | - |
| 1888 | (*__errno_location ()) | - |
| 1889 | )); | - |
| 1890 | goto never executed: goto out; out;never executed: goto out; | 0 |
| 1891 | } | - |
| 1892 | | - |
| 1893 | sshbuf_reset(m); | - |
| 1894 | | - |
| 1895 | | - |
| 1896 | if (mux_client_read_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1897 | debug("%s: read packet failed", __func__); | - |
| 1898 | goto never executed: goto out; out;never executed: goto out; | 0 |
| 1899 | } | - |
| 1900 | | - |
| 1901 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &type)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1902 | fatal("%s: decode type: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode type: %s", __func__, ssh_err(r)); | 0 |
| 1903 | if (type != 0x00000001| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1904 | error("%s: expected HELLO (%u) received %u", | - |
| 1905 | __func__, 0x00000001, type); | - |
| 1906 | goto never executed: goto out; out;never executed: goto out; | 0 |
| 1907 | } | - |
| 1908 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &ver)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1909 | fatal("%s: decode version: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode version: %s", __func__, ssh_err(r)); | 0 |
| 1910 | if (ver != 4| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1911 | error("Unsupported multiplexing protocol version %d " | - |
| 1912 | "(expected %d)", ver, 4); | - |
| 1913 | goto never executed: goto out; out;never executed: goto out; | 0 |
| 1914 | } | - |
| 1915 | debug2("%s: master version %u", __func__, ver); | - |
| 1916 | | - |
| 1917 | while (sshbuf_len(m) > 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1918 | char *name = | - |
| 1919 | ((void *)0) | - |
| 1920 | ; | - |
| 1921 | | - |
| 1922 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &name, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1923 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1924 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1925 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_string_direct(m, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1926 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1927 | , | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1928 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1929 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1930 | error("%s: malformed extension: %s", | - |
| 1931 | __func__, ssh_err(r)); | - |
| 1932 | goto never executed: goto out; out;never executed: goto out; | 0 |
| 1933 | } | - |
| 1934 | debug2("Unrecognised master extension \"%s\"", name); | - |
| 1935 | free(name); | - |
| 1936 | } never executed: end of block | 0 |
| 1937 | | - |
| 1938 | ret = 0; | - |
| 1939 | out: code before this statement never executed: out: | 0 |
| 1940 | sshbuf_free(m); | - |
| 1941 | return never executed: return ret; ret;never executed: return ret; | 0 |
| 1942 | } | - |
| 1943 | | - |
| 1944 | static u_int | - |
| 1945 | mux_client_request_alive(int fd) | - |
| 1946 | { | - |
| 1947 | struct sshbuf *m; | - |
| 1948 | char *e; | - |
| 1949 | u_int pid, type, rid; | - |
| 1950 | int r; | - |
| 1951 | | - |
| 1952 | debug3("%s: entering", __func__); | - |
| 1953 | | - |
| 1954 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
m = sshbuf_new()) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1955 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1956 | ) | - |
| 1957 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
| 1958 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, 0x10000004)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 1959 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, muxclient_request_id)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1960 | fatal("%s: request: %s", __func__, ssh_err(r)); never executed: fatal("%s: request: %s", __func__, ssh_err(r)); | 0 |
| 1961 | | - |
| 1962 | if (mux_client_write_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1963 | fatal("%s: write packet: %s", __func__, strerror( never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 1964 | (*__errno_location ()) never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 1965 | )); never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 1966 | | - |
| 1967 | sshbuf_reset(m); | - |
| 1968 | | - |
| 1969 | | - |
| 1970 | if (mux_client_read_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1971 | sshbuf_free(m); | - |
| 1972 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 1973 | } | - |
| 1974 | | - |
| 1975 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &type)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1976 | fatal("%s: decode type: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode type: %s", __func__, ssh_err(r)); | 0 |
| 1977 | if (type != 0x80000005| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 1978 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1979 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 1980 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1981 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 1982 | fatal("%s: master returned error: %s", __func__, e); | - |
| 1983 | } never executed: end of block | 0 |
| 1984 | | - |
| 1985 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &rid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1986 | fatal("%s: decode remote ID: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode remote ID: %s", __func__, ssh_err(r)); | 0 |
| 1987 | if (rid != muxclient_request_id| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1988 | fatal("%s: out of sequence reply: my id %u theirs %u", never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 1989 | __func__, muxclient_request_id, rid); never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 1990 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &pid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 1991 | fatal("%s: decode PID: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode PID: %s", __func__, ssh_err(r)); | 0 |
| 1992 | sshbuf_free(m); | - |
| 1993 | | - |
| 1994 | debug3("%s: done pid = %u", __func__, pid); | - |
| 1995 | | - |
| 1996 | muxclient_request_id++; | - |
| 1997 | | - |
| 1998 | return never executed: return pid; pid;never executed: return pid; | 0 |
| 1999 | } | - |
| 2000 | | - |
| 2001 | static void | - |
| 2002 | mux_client_request_terminate(int fd) | - |
| 2003 | { | - |
| 2004 | struct sshbuf *m; | - |
| 2005 | char *e; | - |
| 2006 | u_int type, rid; | - |
| 2007 | int r; | - |
| 2008 | | - |
| 2009 | debug3("%s: entering", __func__); | - |
| 2010 | | - |
| 2011 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
m = sshbuf_new()) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2012 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2013 | ) | - |
| 2014 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
| 2015 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, 0x10000005)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2016 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, muxclient_request_id)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2017 | fatal("%s: request: %s", __func__, ssh_err(r)); never executed: fatal("%s: request: %s", __func__, ssh_err(r)); | 0 |
| 2018 | | - |
| 2019 | if (mux_client_write_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2020 | fatal("%s: write packet: %s", __func__, strerror( never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2021 | (*__errno_location ()) never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2022 | )); never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2023 | | - |
| 2024 | sshbuf_reset(m); | - |
| 2025 | | - |
| 2026 | | - |
| 2027 | if (mux_client_read_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2028 | | - |
| 2029 | if ( | - |
| 2030 | (*| TRUE | never evaluated | | FALSE | never evaluated |
__errno_location ()) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2031 | == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2032 | 32| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2033 | ) { | - |
| 2034 | sshbuf_free(m); | - |
| 2035 | return; never executed: return; | 0 |
| 2036 | } | - |
| 2037 | fatal("%s: read from master failed: %s", | - |
| 2038 | __func__, strerror( | - |
| 2039 | (*__errno_location ()) | - |
| 2040 | )); | - |
| 2041 | } never executed: end of block | 0 |
| 2042 | | - |
| 2043 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &type)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2044 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &rid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2045 | fatal("%s: decode: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode: %s", __func__, ssh_err(r)); | 0 |
| 2046 | if (rid != muxclient_request_id| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2047 | fatal("%s: out of sequence reply: my id %u theirs %u", never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2048 | __func__, muxclient_request_id, rid); never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2049 | switch (type) { | - |
| 2050 | case never executed: case 0x80000001: 0x80000001:never executed: case 0x80000001: | 0 |
| 2051 | break; never executed: break; | 0 |
| 2052 | case never executed: case 0x80000002: 0x80000002:never executed: case 0x80000002: | 0 |
| 2053 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2054 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2055 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2056 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2057 | fatal("Master refused termination request: %s", e); | - |
| 2058 | case never executed: case 0x80000003: 0x80000003:never executed: case 0x80000003: code before this statement never executed: case 0x80000003: | 0 |
| 2059 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2060 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2061 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2062 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2063 | fatal("%s: termination request failed: %s", __func__, e); | - |
| 2064 | default never executed: default: :never executed: default: code before this statement never executed: default: | 0 |
| 2065 | fatal("%s: unexpected response from master 0x%08x", | - |
| 2066 | __func__, type); | - |
| 2067 | } never executed: end of block | 0 |
| 2068 | sshbuf_free(m); | - |
| 2069 | muxclient_request_id++; | - |
| 2070 | } never executed: end of block | 0 |
| 2071 | | - |
| 2072 | static int | - |
| 2073 | mux_client_forward(int fd, int cancel_flag, u_int ftype, struct Forward *fwd) | - |
| 2074 | { | - |
| 2075 | struct sshbuf *m; | - |
| 2076 | char *e, *fwd_desc; | - |
| 2077 | const char *lhost, *chost; | - |
| 2078 | u_int type, rid; | - |
| 2079 | int r; | - |
| 2080 | | - |
| 2081 | fwd_desc = format_forward(ftype, fwd); | - |
| 2082 | debug("Requesting %s %s", | - |
| 2083 | cancel_flag ? "cancellation of" : "forwarding of", fwd_desc); | - |
| 2084 | free(fwd_desc); | - |
| 2085 | | - |
| 2086 | type = cancel_flag| TRUE | never evaluated | | FALSE | never evaluated |
? 0x10000007 : 0x10000006; | 0 |
| 2087 | if (fwd->listen_path != | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2088 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2089 | ) | - |
| 2090 | lhost = fwd->listen_path; never executed: lhost = fwd->listen_path; | 0 |
| 2091 | else if (fwd->listen_host == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2092 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2093 | ) | - |
| 2094 | lhost = ""; never executed: lhost = ""; | 0 |
| 2095 | else if (*| TRUE | never evaluated | | FALSE | never evaluated |
fwd->listen_host == '\0'| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2096 | lhost = "*"; never executed: lhost = "*"; | 0 |
| 2097 | else | - |
| 2098 | lhost = fwd->listen_host; never executed: lhost = fwd->listen_host; | 0 |
| 2099 | | - |
| 2100 | if (fwd->connect_path != | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2101 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2102 | ) | - |
| 2103 | chost = fwd->connect_path; never executed: chost = fwd->connect_path; | 0 |
| 2104 | else if (fwd->connect_host == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2105 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2106 | ) | - |
| 2107 | chost = ""; never executed: chost = ""; | 0 |
| 2108 | else | - |
| 2109 | chost = fwd->connect_host; never executed: chost = fwd->connect_host; | 0 |
| 2110 | | - |
| 2111 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
m = sshbuf_new()) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2112 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2113 | ) | - |
| 2114 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
| 2115 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, type)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2116 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, muxclient_request_id)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2117 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, ftype)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2118 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_cstring(m, lhost)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2119 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, fwd->listen_port)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2120 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_cstring(m, chost)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2121 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, fwd->connect_port)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2122 | fatal("%s: request: %s", __func__, ssh_err(r)); never executed: fatal("%s: request: %s", __func__, ssh_err(r)); | 0 |
| 2123 | | - |
| 2124 | if (mux_client_write_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2125 | fatal("%s: write packet: %s", __func__, strerror( never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2126 | (*__errno_location ()) never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2127 | )); never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2128 | | - |
| 2129 | sshbuf_reset(m); | - |
| 2130 | | - |
| 2131 | | - |
| 2132 | if (mux_client_read_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2133 | sshbuf_free(m); | - |
| 2134 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2135 | } | - |
| 2136 | | - |
| 2137 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &type)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2138 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &rid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2139 | fatal("%s: decode: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode: %s", __func__, ssh_err(r)); | 0 |
| 2140 | if (rid != muxclient_request_id| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2141 | fatal("%s: out of sequence reply: my id %u theirs %u", never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2142 | __func__, muxclient_request_id, rid); never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2143 | | - |
| 2144 | switch (type) { | - |
| 2145 | case never executed: case 0x80000001: 0x80000001:never executed: case 0x80000001: | 0 |
| 2146 | break; never executed: break; | 0 |
| 2147 | case never executed: case 0x80000007: 0x80000007:never executed: case 0x80000007: | 0 |
| 2148 | if (cancel_flag| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2149 | fatal("%s: got MUX_S_REMOTE_PORT for cancel", __func__); never executed: fatal("%s: got MUX_S_REMOTE_PORT for cancel", __func__); | 0 |
| 2150 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &fwd->allocated_port)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2151 | fatal("%s: decode port: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode port: %s", __func__, ssh_err(r)); | 0 |
| 2152 | verbose("Allocated port %u for remote forward to %s:%d", | - |
| 2153 | fwd->allocated_port, | - |
| 2154 | fwd->connect_host ? fwd->connect_host : "", | - |
| 2155 | fwd->connect_port); | - |
| 2156 | if (muxclient_command == 5| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2157 | fprintf( never executed: fprintf( stdout , "%i\n", fwd->allocated_port); | 0 |
| 2158 | stdout never executed: fprintf( stdout , "%i\n", fwd->allocated_port); | 0 |
| 2159 | , "%i\n", fwd->allocated_port); never executed: fprintf( stdout , "%i\n", fwd->allocated_port); | 0 |
| 2160 | break; never executed: break; | 0 |
| 2161 | case never executed: case 0x80000002: 0x80000002:never executed: case 0x80000002: | 0 |
| 2162 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2163 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2164 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2165 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2166 | sshbuf_free(m); | - |
| 2167 | error("Master refused forwarding request: %s", e); | - |
| 2168 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2169 | case never executed: case 0x80000003: 0x80000003:never executed: case 0x80000003: | 0 |
| 2170 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2171 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2172 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2173 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2174 | sshbuf_free(m); | - |
| 2175 | error("%s: forwarding request failed: %s", __func__, e); | - |
| 2176 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2177 | default never executed: default: :never executed: default: | 0 |
| 2178 | fatal("%s: unexpected response from master 0x%08x", | - |
| 2179 | __func__, type); | - |
| 2180 | } never executed: end of block | 0 |
| 2181 | sshbuf_free(m); | - |
| 2182 | | - |
| 2183 | muxclient_request_id++; | - |
| 2184 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 2185 | } | - |
| 2186 | | - |
| 2187 | static int | - |
| 2188 | mux_client_forwards(int fd, int cancel_flag) | - |
| 2189 | { | - |
| 2190 | int i, ret = 0; | - |
| 2191 | | - |
| 2192 | debug3("%s: %s forwardings: %d local, %d remote", __func__, | - |
| 2193 | cancel_flag ? "cancel" : "request", | - |
| 2194 | options.num_local_forwards, options.num_remote_forwards); | - |
| 2195 | | - |
| 2196 | | - |
| 2197 | for (i = 0; i < options.num_local_forwards| TRUE | never evaluated | | FALSE | never evaluated |
; i++) { | 0 |
| 2198 | if (mux_client_forward(fd, cancel_flag,| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2199 | options.local_forwards[i].connect_port == 0 ?| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2200 | 3 : 1,| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2201 | options.local_forwards + i) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2202 | ret = -1; never executed: ret = -1; | 0 |
| 2203 | } never executed: end of block | 0 |
| 2204 | for (i = 0; i < options.num_remote_forwards| TRUE | never evaluated | | FALSE | never evaluated |
; i++) { | 0 |
| 2205 | if (mux_client_forward(fd, cancel_flag, 2,| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2206 | options.remote_forwards + i) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2207 | ret = -1; never executed: ret = -1; | 0 |
| 2208 | } never executed: end of block | 0 |
| 2209 | return never executed: return ret; ret;never executed: return ret; | 0 |
| 2210 | } | - |
| 2211 | | - |
| 2212 | static int | - |
| 2213 | mux_client_request_session(int fd) | - |
| 2214 | { | - |
| 2215 | struct sshbuf *m; | - |
| 2216 | char *e; | - |
| 2217 | const char *term; | - |
| 2218 | u_int echar, rid, sid, esid, exitval, type, exitval_seen; | - |
| 2219 | extern char **environ; | - |
| 2220 | int r, i, devnull, rawmode; | - |
| 2221 | | - |
| 2222 | debug3("%s: entering", __func__); | - |
| 2223 | | - |
| 2224 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
muxserver_pid = mux_client_request_alive(fd)) == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2225 | error("%s: master alive request failed", __func__); | - |
| 2226 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2227 | } | - |
| 2228 | | - |
| 2229 | mysignal( | - |
| 2230 | 13 | - |
| 2231 | , | - |
| 2232 | ((__sighandler_t) 1) | - |
| 2233 | ); | - |
| 2234 | | - |
| 2235 | if (stdin_null_flag| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2236 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
devnull = open(| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2237 | "/dev/null"| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2238 | , | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2239 | 00| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2240 | )) == -1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2241 | fatal("open(/dev/null): %s", strerror( never executed: fatal("open(/dev/null): %s", strerror( (*__errno_location ()) )); | 0 |
| 2242 | (*__errno_location ()) never executed: fatal("open(/dev/null): %s", strerror( (*__errno_location ()) )); | 0 |
| 2243 | )); never executed: fatal("open(/dev/null): %s", strerror( (*__errno_location ()) )); | 0 |
| 2244 | if (dup2(devnull, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2245 | 0| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2246 | ) == -1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2247 | fatal("dup2: %s", strerror( never executed: fatal("dup2: %s", strerror( (*__errno_location ()) )); | 0 |
| 2248 | (*__errno_location ()) never executed: fatal("dup2: %s", strerror( (*__errno_location ()) )); | 0 |
| 2249 | )); never executed: fatal("dup2: %s", strerror( (*__errno_location ()) )); | 0 |
| 2250 | if (devnull > | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2251 | 2| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2252 | ) | - |
| 2253 | close(devnull); never executed: close(devnull); | 0 |
| 2254 | } never executed: end of block | 0 |
| 2255 | | - |
| 2256 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
term = getenv("TERM")) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2257 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2258 | ) | - |
| 2259 | term = ""; never executed: term = ""; | 0 |
| 2260 | echar = 0xffffffff; | - |
| 2261 | if (options.escape_char != -2| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2262 | echar = (u_int)options.escape_char; never executed: echar = (u_int)options.escape_char; | 0 |
| 2263 | | - |
| 2264 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
m = sshbuf_new()) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2265 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2266 | ) | - |
| 2267 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
| 2268 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, 0x10000002)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2269 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, muxclient_request_id)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2270 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_string(m, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2271 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2272 | , 0)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2273 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, tty_flag)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2274 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, options.forward_x11)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2275 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, options.forward_agent)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2276 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, subsystem_flag)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2277 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, echar)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2278 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_cstring(m, term)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2279 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_stringb(m, command)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2280 | fatal("%s: request: %s", __func__, ssh_err(r)); never executed: fatal("%s: request: %s", __func__, ssh_err(r)); | 0 |
| 2281 | | - |
| 2282 | | - |
| 2283 | if (options.num_send_env > 0| TRUE | never evaluated | | FALSE | never evaluated |
&& environ != | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2284 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2285 | ) { | - |
| 2286 | for (i = 0; environ[i] != | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2287 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2288 | ; i++) { | - |
| 2289 | if (!env_permitted(environ[i])| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2290 | continue; never executed: continue; | 0 |
| 2291 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_cstring(m, environ[i])) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2292 | fatal("%s: request: %s", __func__, ssh_err(r)); never executed: fatal("%s: request: %s", __func__, ssh_err(r)); | 0 |
| 2293 | } never executed: end of block | 0 |
| 2294 | } never executed: end of block | 0 |
| 2295 | for (i = 0; i < options.num_setenv| TRUE | never evaluated | | FALSE | never evaluated |
; i++) { | 0 |
| 2296 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_cstring(m, options.setenv[i])) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2297 | fatal("%s: request: %s", __func__, ssh_err(r)); never executed: fatal("%s: request: %s", __func__, ssh_err(r)); | 0 |
| 2298 | } never executed: end of block | 0 |
| 2299 | | - |
| 2300 | if (mux_client_write_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2301 | fatal("%s: write packet: %s", __func__, strerror( never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2302 | (*__errno_location ()) never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2303 | )); never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2304 | | - |
| 2305 | | - |
| 2306 | if (mm_send_fd(fd, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2307 | 0| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2308 | ) == -1| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2309 | mm_send_fd(fd, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2310 | 1| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2311 | ) == -1| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2312 | mm_send_fd(fd, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2313 | 2| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2314 | ) == -1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2315 | fatal("%s: send fds failed", __func__); never executed: fatal("%s: send fds failed", __func__); | 0 |
| 2316 | | - |
| 2317 | debug3("%s: session request sent", __func__); | - |
| 2318 | | - |
| 2319 | | - |
| 2320 | sshbuf_reset(m); | - |
| 2321 | if (mux_client_read_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2322 | error("%s: read from master failed: %s", | - |
| 2323 | __func__, strerror( | - |
| 2324 | (*__errno_location ()) | - |
| 2325 | )); | - |
| 2326 | sshbuf_free(m); | - |
| 2327 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2328 | } | - |
| 2329 | | - |
| 2330 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &type)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2331 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &rid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2332 | fatal("%s: decode: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode: %s", __func__, ssh_err(r)); | 0 |
| 2333 | if (rid != muxclient_request_id| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2334 | fatal("%s: out of sequence reply: my id %u theirs %u", never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2335 | __func__, muxclient_request_id, rid); never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2336 | | - |
| 2337 | switch (type) { | - |
| 2338 | case never executed: case 0x80000006: 0x80000006:never executed: case 0x80000006: | 0 |
| 2339 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &sid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2340 | fatal("%s: decode ID: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode ID: %s", __func__, ssh_err(r)); | 0 |
| 2341 | break; never executed: break; | 0 |
| 2342 | case never executed: case 0x80000002: 0x80000002:never executed: case 0x80000002: | 0 |
| 2343 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2344 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2345 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2346 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2347 | error("Master refused session request: %s", e); | - |
| 2348 | sshbuf_free(m); | - |
| 2349 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2350 | case never executed: case 0x80000003: 0x80000003:never executed: case 0x80000003: | 0 |
| 2351 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2352 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2353 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2354 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2355 | error("%s: session request failed: %s", __func__, e); | - |
| 2356 | sshbuf_free(m); | - |
| 2357 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2358 | default never executed: default: :never executed: default: | 0 |
| 2359 | sshbuf_free(m); | - |
| 2360 | error("%s: unexpected response from master 0x%08x", | - |
| 2361 | __func__, type); | - |
| 2362 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2363 | } | - |
| 2364 | muxclient_request_id++; | - |
| 2365 | | - |
| 2366 | if (pledge("stdio proc tty", | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2367 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2368 | ) == -1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2369 | fatal("%s pledge(): %s", __func__, strerror( never executed: fatal("%s pledge(): %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2370 | (*__errno_location ()) never executed: fatal("%s pledge(): %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2371 | )); never executed: fatal("%s pledge(): %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2372 | platform_pledge_mux(); | - |
| 2373 | | - |
| 2374 | mysignal( | - |
| 2375 | 1 | - |
| 2376 | ,control_client_sighandler); | - |
| 2377 | mysignal( | - |
| 2378 | 2 | - |
| 2379 | ,control_client_sighandler); | - |
| 2380 | mysignal( | - |
| 2381 | 15 | - |
| 2382 | ,control_client_sighandler); | - |
| 2383 | mysignal( | - |
| 2384 | 28 | - |
| 2385 | ,control_client_sigrelay); | - |
| 2386 | | - |
| 2387 | rawmode = tty_flag; | - |
| 2388 | if (tty_flag| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2389 | enter_raw_mode(options.request_tty == 3); never executed: enter_raw_mode(options.request_tty == 3); | 0 |
| 2390 | for (exitval = 255, exitval_seen = 0;;) { | - |
| 2391 | sshbuf_reset(m); | - |
| 2392 | if (mux_client_read_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2393 | break; never executed: break; | 0 |
| 2394 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &type)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2395 | fatal("%s: decode type: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode type: %s", __func__, ssh_err(r)); | 0 |
| 2396 | switch (type) { | - |
| 2397 | case never executed: case 0x80000008: 0x80000008:never executed: case 0x80000008: | 0 |
| 2398 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &esid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2399 | fatal("%s: decode ID: %s", never executed: fatal("%s: decode ID: %s", __func__, ssh_err(r)); | 0 |
| 2400 | __func__, ssh_err(r)); never executed: fatal("%s: decode ID: %s", __func__, ssh_err(r)); | 0 |
| 2401 | if (esid != sid| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2402 | fatal("%s: tty alloc fail on unknown session: " never executed: fatal("%s: tty alloc fail on unknown session: " "my id %u theirs %u", __func__, sid, esid); | 0 |
| 2403 | "my id %u theirs %u", never executed: fatal("%s: tty alloc fail on unknown session: " "my id %u theirs %u", __func__, sid, esid); | 0 |
| 2404 | __func__, sid, esid); never executed: fatal("%s: tty alloc fail on unknown session: " "my id %u theirs %u", __func__, sid, esid); | 0 |
| 2405 | leave_raw_mode(options.request_tty == | - |
| 2406 | 3); | - |
| 2407 | rawmode = 0; | - |
| 2408 | continue; never executed: continue; | 0 |
| 2409 | case never executed: case 0x80000004: 0x80000004:never executed: case 0x80000004: | 0 |
| 2410 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &esid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2411 | fatal("%s: decode ID: %s", never executed: fatal("%s: decode ID: %s", __func__, ssh_err(r)); | 0 |
| 2412 | __func__, ssh_err(r)); never executed: fatal("%s: decode ID: %s", __func__, ssh_err(r)); | 0 |
| 2413 | if (esid != sid| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2414 | fatal("%s: exit on unknown session: " never executed: fatal("%s: exit on unknown session: " "my id %u theirs %u", __func__, sid, esid); | 0 |
| 2415 | "my id %u theirs %u", never executed: fatal("%s: exit on unknown session: " "my id %u theirs %u", __func__, sid, esid); | 0 |
| 2416 | __func__, sid, esid); never executed: fatal("%s: exit on unknown session: " "my id %u theirs %u", __func__, sid, esid); | 0 |
| 2417 | if (exitval_seen| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2418 | fatal("%s: exitval sent twice", __func__); never executed: fatal("%s: exitval sent twice", __func__); | 0 |
| 2419 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &exitval)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2420 | fatal("%s: decode exit value: %s", never executed: fatal("%s: decode exit value: %s", __func__, ssh_err(r)); | 0 |
| 2421 | __func__, ssh_err(r)); never executed: fatal("%s: decode exit value: %s", __func__, ssh_err(r)); | 0 |
| 2422 | exitval_seen = 1; | - |
| 2423 | continue; never executed: continue; | 0 |
| 2424 | default never executed: default: :never executed: default: | 0 |
| 2425 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2426 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2427 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2428 | fatal("%s: decode error: %s", never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2429 | __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2430 | fatal("%s: master returned error: %s", __func__, e); | - |
| 2431 | } never executed: end of block | 0 |
| 2432 | } | - |
| 2433 | | - |
| 2434 | close(fd); | - |
| 2435 | if (rawmode| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2436 | leave_raw_mode(options.request_tty == 3); never executed: leave_raw_mode(options.request_tty == 3); | 0 |
| 2437 | | - |
| 2438 | if (muxclient_terminate| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2439 | debug2("Exiting on signal: %s", strsignal(muxclient_terminate)); | - |
| 2440 | exitval = 255; | - |
| 2441 | } never executed: end of block else if (!exitval_seen| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2442 | debug2("Control master terminated unexpectedly"); | - |
| 2443 | exitval = 255; | - |
| 2444 | } never executed: end of block else | 0 |
| 2445 | debug2("Received exit status from master %d", exitval); never executed: debug2("Received exit status from master %d", exitval); | 0 |
| 2446 | | - |
| 2447 | if (tty_flag| TRUE | never evaluated | | FALSE | never evaluated |
&& options.log_level != SYSLOG_LEVEL_QUIET| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2448 | fprintf( never executed: fprintf( stderr , "Shared connection to %s closed.\r\n", host); | 0 |
| 2449 | stderr never executed: fprintf( stderr , "Shared connection to %s closed.\r\n", host); | 0 |
| 2450 | , "Shared connection to %s closed.\r\n", host); never executed: fprintf( stderr , "Shared connection to %s closed.\r\n", host); | 0 |
| 2451 | | - |
| 2452 | exit(exitval); never executed: exit(exitval); | 0 |
| 2453 | } | - |
| 2454 | | - |
| 2455 | static int | - |
| 2456 | mux_client_proxy(int fd) | - |
| 2457 | { | - |
| 2458 | struct sshbuf *m; | - |
| 2459 | char *e; | - |
| 2460 | u_int type, rid; | - |
| 2461 | int r; | - |
| 2462 | | - |
| 2463 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
m = sshbuf_new()) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2464 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2465 | ) | - |
| 2466 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
| 2467 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, 0x1000000f)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2468 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, muxclient_request_id)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2469 | fatal("%s: request: %s", __func__, ssh_err(r)); never executed: fatal("%s: request: %s", __func__, ssh_err(r)); | 0 |
| 2470 | if (mux_client_write_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2471 | fatal("%s: write packet: %s", __func__, strerror( never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2472 | (*__errno_location ()) never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2473 | )); never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2474 | | - |
| 2475 | sshbuf_reset(m); | - |
| 2476 | | - |
| 2477 | | - |
| 2478 | if (mux_client_read_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2479 | sshbuf_free(m); | - |
| 2480 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 2481 | } | - |
| 2482 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &type)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2483 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &rid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2484 | fatal("%s: decode: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode: %s", __func__, ssh_err(r)); | 0 |
| 2485 | if (rid != muxclient_request_id| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2486 | fatal("%s: out of sequence reply: my id %u theirs %u", never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2487 | __func__, muxclient_request_id, rid); never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2488 | if (type != 0x8000000f| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2489 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2490 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2491 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2492 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2493 | fatal("%s: master returned error: %s", __func__, e); | - |
| 2494 | } never executed: end of block | 0 |
| 2495 | sshbuf_free(m); | - |
| 2496 | | - |
| 2497 | debug3("%s: done", __func__); | - |
| 2498 | muxclient_request_id++; | - |
| 2499 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 2500 | } | - |
| 2501 | | - |
| 2502 | static int | - |
| 2503 | mux_client_request_stdio_fwd(int fd) | - |
| 2504 | { | - |
| 2505 | struct sshbuf *m; | - |
| 2506 | char *e; | - |
| 2507 | u_int type, rid, sid; | - |
| 2508 | int r, devnull; | - |
| 2509 | | - |
| 2510 | debug3("%s: entering", __func__); | - |
| 2511 | | - |
| 2512 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
muxserver_pid = mux_client_request_alive(fd)) == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2513 | error("%s: master alive request failed", __func__); | - |
| 2514 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2515 | } | - |
| 2516 | | - |
| 2517 | mysignal( | - |
| 2518 | 13 | - |
| 2519 | , | - |
| 2520 | ((__sighandler_t) 1) | - |
| 2521 | ); | - |
| 2522 | | - |
| 2523 | if (stdin_null_flag| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2524 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
devnull = open(| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2525 | "/dev/null"| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2526 | , | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2527 | 00| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2528 | )) == -1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2529 | fatal("open(/dev/null): %s", strerror( never executed: fatal("open(/dev/null): %s", strerror( (*__errno_location ()) )); | 0 |
| 2530 | (*__errno_location ()) never executed: fatal("open(/dev/null): %s", strerror( (*__errno_location ()) )); | 0 |
| 2531 | )); never executed: fatal("open(/dev/null): %s", strerror( (*__errno_location ()) )); | 0 |
| 2532 | if (dup2(devnull, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2533 | 0| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2534 | ) == -1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2535 | fatal("dup2: %s", strerror( never executed: fatal("dup2: %s", strerror( (*__errno_location ()) )); | 0 |
| 2536 | (*__errno_location ()) never executed: fatal("dup2: %s", strerror( (*__errno_location ()) )); | 0 |
| 2537 | )); never executed: fatal("dup2: %s", strerror( (*__errno_location ()) )); | 0 |
| 2538 | if (devnull > | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2539 | 2| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2540 | ) | - |
| 2541 | close(devnull); never executed: close(devnull); | 0 |
| 2542 | } never executed: end of block | 0 |
| 2543 | | - |
| 2544 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
m = sshbuf_new()) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2545 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2546 | ) | - |
| 2547 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
| 2548 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, 0x10000008)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2549 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, muxclient_request_id)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2550 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_string(m, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2551 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2552 | , 0)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2553 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_cstring(m, options.stdio_forward_host)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2554 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, options.stdio_forward_port)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2555 | fatal("%s: request: %s", __func__, ssh_err(r)); never executed: fatal("%s: request: %s", __func__, ssh_err(r)); | 0 |
| 2556 | | - |
| 2557 | if (mux_client_write_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2558 | fatal("%s: write packet: %s", __func__, strerror( never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2559 | (*__errno_location ()) never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2560 | )); never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2561 | | - |
| 2562 | | - |
| 2563 | if (mm_send_fd(fd, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2564 | 0| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2565 | ) == -1| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2566 | mm_send_fd(fd, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2567 | 1| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2568 | ) == -1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2569 | fatal("%s: send fds failed", __func__); never executed: fatal("%s: send fds failed", __func__); | 0 |
| 2570 | | - |
| 2571 | if (pledge("stdio proc tty", | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2572 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2573 | ) == -1| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2574 | fatal("%s pledge(): %s", __func__, strerror( never executed: fatal("%s pledge(): %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2575 | (*__errno_location ()) never executed: fatal("%s pledge(): %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2576 | )); never executed: fatal("%s pledge(): %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2577 | platform_pledge_mux(); | - |
| 2578 | | - |
| 2579 | debug3("%s: stdio forward request sent", __func__); | - |
| 2580 | | - |
| 2581 | | - |
| 2582 | sshbuf_reset(m); | - |
| 2583 | | - |
| 2584 | if (mux_client_read_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2585 | error("%s: read from master failed: %s", | - |
| 2586 | __func__, strerror( | - |
| 2587 | (*__errno_location ()) | - |
| 2588 | )); | - |
| 2589 | sshbuf_free(m); | - |
| 2590 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2591 | } | - |
| 2592 | | - |
| 2593 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &type)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2594 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &rid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2595 | fatal("%s: decode: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode: %s", __func__, ssh_err(r)); | 0 |
| 2596 | if (rid != muxclient_request_id| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2597 | fatal("%s: out of sequence reply: my id %u theirs %u", never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2598 | __func__, muxclient_request_id, rid); never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2599 | switch (type) { | - |
| 2600 | case never executed: case 0x80000006: 0x80000006:never executed: case 0x80000006: | 0 |
| 2601 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &sid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2602 | fatal("%s: decode ID: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode ID: %s", __func__, ssh_err(r)); | 0 |
| 2603 | debug("%s: master session id: %u", __func__, sid); | - |
| 2604 | break; never executed: break; | 0 |
| 2605 | case never executed: case 0x80000002: 0x80000002:never executed: case 0x80000002: | 0 |
| 2606 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2607 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2608 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2609 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2610 | sshbuf_free(m); | - |
| 2611 | fatal("Master refused stdio forwarding request: %s", e); | - |
| 2612 | case never executed: case 0x80000003: 0x80000003:never executed: case 0x80000003: code before this statement never executed: case 0x80000003: | 0 |
| 2613 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2614 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2615 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2616 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2617 | sshbuf_free(m); | - |
| 2618 | fatal("Stdio forwarding request failed: %s", e); | - |
| 2619 | default never executed: default: :never executed: default: code before this statement never executed: default: | 0 |
| 2620 | sshbuf_free(m); | - |
| 2621 | error("%s: unexpected response from master 0x%08x", | - |
| 2622 | __func__, type); | - |
| 2623 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2624 | } | - |
| 2625 | muxclient_request_id++; | - |
| 2626 | | - |
| 2627 | mysignal( | - |
| 2628 | 1 | - |
| 2629 | ,control_client_sighandler); | - |
| 2630 | mysignal( | - |
| 2631 | 2 | - |
| 2632 | ,control_client_sighandler); | - |
| 2633 | mysignal( | - |
| 2634 | 15 | - |
| 2635 | ,control_client_sighandler); | - |
| 2636 | mysignal( | - |
| 2637 | 28 | - |
| 2638 | ,control_client_sigrelay); | - |
| 2639 | | - |
| 2640 | | - |
| 2641 | | - |
| 2642 | | - |
| 2643 | sshbuf_reset(m); | - |
| 2644 | if (mux_client_read_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2645 | if ( | - |
| 2646 | (*| TRUE | never evaluated | | FALSE | never evaluated |
__errno_location ()) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2647 | == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2648 | 32| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2649 | || | - |
| 2650 | ( | - |
| 2651 | (*| TRUE | never evaluated | | FALSE | never evaluated |
__errno_location ()) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2652 | == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2653 | 4| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2654 | && muxclient_terminate != 0| TRUE | never evaluated | | FALSE | never evaluated |
)) | 0 |
| 2655 | return never executed: return 0; 0;never executed: return 0; | 0 |
| 2656 | fatal("%s: mux_client_read_packet: %s", | - |
| 2657 | __func__, strerror( | - |
| 2658 | (*__errno_location ()) | - |
| 2659 | )); | - |
| 2660 | } never executed: end of block | 0 |
| 2661 | fatal("%s: master returned unexpected message %u", __func__, type); | - |
| 2662 | } never executed: end of block | 0 |
| 2663 | | - |
| 2664 | static void | - |
| 2665 | mux_client_request_stop_listening(int fd) | - |
| 2666 | { | - |
| 2667 | struct sshbuf *m; | - |
| 2668 | char *e; | - |
| 2669 | u_int type, rid; | - |
| 2670 | int r; | - |
| 2671 | | - |
| 2672 | debug3("%s: entering", __func__); | - |
| 2673 | | - |
| 2674 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
m = sshbuf_new()) == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2675 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2676 | ) | - |
| 2677 | fatal("%s: sshbuf_new", __func__); never executed: fatal("%s: sshbuf_new", __func__); | 0 |
| 2678 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, 0x10000009)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2679 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_put_u32(m, muxclient_request_id)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2680 | fatal("%s: request: %s", __func__, ssh_err(r)); never executed: fatal("%s: request: %s", __func__, ssh_err(r)); | 0 |
| 2681 | | - |
| 2682 | if (mux_client_write_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2683 | fatal("%s: write packet: %s", __func__, strerror( never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2684 | (*__errno_location ()) never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2685 | )); never executed: fatal("%s: write packet: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2686 | | - |
| 2687 | sshbuf_reset(m); | - |
| 2688 | | - |
| 2689 | | - |
| 2690 | if (mux_client_read_packet(fd, m) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2691 | fatal("%s: read from master failed: %s", never executed: fatal("%s: read from master failed: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2692 | __func__, strerror( never executed: fatal("%s: read from master failed: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2693 | (*__errno_location ()) never executed: fatal("%s: read from master failed: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2694 | )); never executed: fatal("%s: read from master failed: %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2695 | | - |
| 2696 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &type)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
|| | 0 |
| 2697 | (| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_u32(m, &rid)) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2698 | fatal("%s: decode: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode: %s", __func__, ssh_err(r)); | 0 |
| 2699 | if (rid != muxclient_request_id| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2700 | fatal("%s: out of sequence reply: my id %u theirs %u", never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2701 | __func__, muxclient_request_id, rid); never executed: fatal("%s: out of sequence reply: my id %u theirs %u", __func__, muxclient_request_id, rid); | 0 |
| 2702 | | - |
| 2703 | switch (type) { | - |
| 2704 | case never executed: case 0x80000001: 0x80000001:never executed: case 0x80000001: | 0 |
| 2705 | break; never executed: break; | 0 |
| 2706 | case never executed: case 0x80000002: 0x80000002:never executed: case 0x80000002: | 0 |
| 2707 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2708 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2709 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2710 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2711 | fatal("Master refused stop listening request: %s", e); | - |
| 2712 | case never executed: case 0x80000003: 0x80000003:never executed: case 0x80000003: code before this statement never executed: case 0x80000003: | 0 |
| 2713 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
r = sshbuf_get_cstring(m, &e, | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2714 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2715 | )) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2716 | fatal("%s: decode error: %s", __func__, ssh_err(r)); never executed: fatal("%s: decode error: %s", __func__, ssh_err(r)); | 0 |
| 2717 | fatal("%s: stop listening request failed: %s", __func__, e); | - |
| 2718 | default never executed: default: :never executed: default: code before this statement never executed: default: | 0 |
| 2719 | fatal("%s: unexpected response from master 0x%08x", | - |
| 2720 | __func__, type); | - |
| 2721 | } never executed: end of block | 0 |
| 2722 | sshbuf_free(m); | - |
| 2723 | muxclient_request_id++; | - |
| 2724 | } never executed: end of block | 0 |
| 2725 | | - |
| 2726 | | - |
| 2727 | int | - |
| 2728 | muxclient(const char *path) | - |
| 2729 | { | - |
| 2730 | struct sockaddr_un addr; | - |
| 2731 | int sock; | - |
| 2732 | u_int pid; | - |
| 2733 | | - |
| 2734 | if (muxclient_command == 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2735 | if (options.stdio_forward_host != | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2736 | ((void *)0)| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2737 | ) | - |
| 2738 | muxclient_command = 4; never executed: muxclient_command = 4; | 0 |
| 2739 | else | - |
| 2740 | muxclient_command = 1; never executed: muxclient_command = 1; | 0 |
| 2741 | } | - |
| 2742 | | - |
| 2743 | switch (options.control_master) { | - |
| 2744 | case never executed: case 2: 2:never executed: case 2: | 0 |
| 2745 | case never executed: case 4: 4:never executed: case 4: | 0 |
| 2746 | debug("auto-mux: Trying existing master"); | - |
| 2747 | | - |
| 2748 | case never executed: case 0: 0:never executed: case 0: code before this statement never executed: case 0: | 0 |
| 2749 | break; never executed: break; | 0 |
| 2750 | default never executed: default: :never executed: default: | 0 |
| 2751 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2752 | } | - |
| 2753 | | - |
| 2754 | memset(&addr, '\0', sizeof(addr)); | - |
| 2755 | addr.sun_family = | - |
| 2756 | 1 | - |
| 2757 | ; | - |
| 2758 | | - |
| 2759 | if (strlcpy(addr.sun_path, path,| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2760 | sizeof(addr.sun_path)) >= sizeof(addr.sun_path)| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2761 | fatal("ControlPath too long ('%s' >= %u bytes)", path, never executed: fatal("ControlPath too long ('%s' >= %u bytes)", path, (unsigned int)sizeof(addr.sun_path)); | 0 |
| 2762 | (unsigned int)sizeof(addr.sun_path)); never executed: fatal("ControlPath too long ('%s' >= %u bytes)", path, (unsigned int)sizeof(addr.sun_path)); | 0 |
| 2763 | | - |
| 2764 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
sock = socket(| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2765 | 1| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2766 | , | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2767 | SOCK_STREAM| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2768 | , 0)) < 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2769 | fatal("%s socket(): %s", __func__, strerror( never executed: fatal("%s socket(): %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2770 | (*__errno_location ()) never executed: fatal("%s socket(): %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2771 | )); never executed: fatal("%s socket(): %s", __func__, strerror( (*__errno_location ()) )); | 0 |
| 2772 | | - |
| 2773 | if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == -1| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2774 | switch (muxclient_command) { | - |
| 2775 | case never executed: case 1: 1:never executed: case 1: | 0 |
| 2776 | case never executed: case 4: 4:never executed: case 4: | 0 |
| 2777 | break; never executed: break; | 0 |
| 2778 | default never executed: default: :never executed: default: | 0 |
| 2779 | fatal("Control socket connect(%.100s): %s", path, | - |
| 2780 | strerror( | - |
| 2781 | (*__errno_location ()) | - |
| 2782 | )); | - |
| 2783 | } never executed: end of block | 0 |
| 2784 | if ( | - |
| 2785 | (*| TRUE | never evaluated | | FALSE | never evaluated |
__errno_location ()) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2786 | == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2787 | 111| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2788 | && | - |
| 2789 | options.control_master != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2790 | debug("Stale control socket %.100s, unlinking", path); | - |
| 2791 | unlink(path); | - |
| 2792 | } never executed: end of block else if ( | 0 |
| 2793 | (*| TRUE | never evaluated | | FALSE | never evaluated |
__errno_location ()) | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2794 | == | TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2795 | 2| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 2796 | ) { | - |
| 2797 | debug("Control socket \"%.100s\" does not exist", path); | - |
| 2798 | } never executed: end of block else { | 0 |
| 2799 | error("Control socket connect(%.100s): %s", path, | - |
| 2800 | strerror( | - |
| 2801 | (*__errno_location ()) | - |
| 2802 | )); | - |
| 2803 | } never executed: end of block | 0 |
| 2804 | close(sock); | - |
| 2805 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2806 | } | - |
| 2807 | set_nonblock(sock); | - |
| 2808 | | - |
| 2809 | if (mux_client_hello_exchange(sock) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2810 | error("%s: master hello exchange failed", __func__); | - |
| 2811 | close(sock); | - |
| 2812 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2813 | } | - |
| 2814 | | - |
| 2815 | switch (muxclient_command) { | - |
| 2816 | case never executed: case 2: 2:never executed: case 2: | 0 |
| 2817 | if ((| TRUE | never evaluated | | FALSE | never evaluated |
pid = mux_client_request_alive(sock)) == 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2818 | fatal("%s: master alive check failed", __func__); never executed: fatal("%s: master alive check failed", __func__); | 0 |
| 2819 | fprintf( | - |
| 2820 | stderr | - |
| 2821 | , "Master running (pid=%u)\r\n", pid); | - |
| 2822 | exit(0); never executed: exit(0); | 0 |
| 2823 | case never executed: case 3: 3:never executed: case 3: code before this statement never executed: case 3: | 0 |
| 2824 | mux_client_request_terminate(sock); | - |
| 2825 | if (options.log_level != SYSLOG_LEVEL_QUIET| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2826 | fprintf( never executed: fprintf( stderr , "Exit request sent.\r\n"); | 0 |
| 2827 | stderr never executed: fprintf( stderr , "Exit request sent.\r\n"); | 0 |
| 2828 | , "Exit request sent.\r\n"); never executed: fprintf( stderr , "Exit request sent.\r\n"); | 0 |
| 2829 | exit(0); never executed: exit(0); | 0 |
| 2830 | case never executed: case 5: 5:never executed: case 5: code before this statement never executed: case 5: | 0 |
| 2831 | if (mux_client_forwards(sock, 0) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2832 | fatal("%s: master forward request failed", __func__); never executed: fatal("%s: master forward request failed", __func__); | 0 |
| 2833 | exit(0); never executed: exit(0); | 0 |
| 2834 | case never executed: case 1: 1:never executed: case 1: code before this statement never executed: case 1: | 0 |
| 2835 | if (mux_client_forwards(sock, 0) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) { | 0 |
| 2836 | error("%s: master forward request failed", __func__); | - |
| 2837 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2838 | } | - |
| 2839 | mux_client_request_session(sock); | - |
| 2840 | return never executed: return -1; -1;never executed: return -1; | 0 |
| 2841 | case never executed: case 4: 4:never executed: case 4: | 0 |
| 2842 | mux_client_request_stdio_fwd(sock); | - |
| 2843 | exit(0); never executed: exit(0); | 0 |
| 2844 | case never executed: case 6: 6:never executed: case 6: code before this statement never executed: case 6: | 0 |
| 2845 | mux_client_request_stop_listening(sock); | - |
| 2846 | if (options.log_level != SYSLOG_LEVEL_QUIET| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2847 | fprintf( never executed: fprintf( stderr , "Stop listening request sent.\r\n"); | 0 |
| 2848 | stderr never executed: fprintf( stderr , "Stop listening request sent.\r\n"); | 0 |
| 2849 | , "Stop listening request sent.\r\n"); never executed: fprintf( stderr , "Stop listening request sent.\r\n"); | 0 |
| 2850 | exit(0); never executed: exit(0); | 0 |
| 2851 | case never executed: case 7: 7:never executed: case 7: code before this statement never executed: case 7: | 0 |
| 2852 | if (mux_client_forwards(sock, 1) != 0| TRUE | never evaluated | | FALSE | never evaluated |
) | 0 |
| 2853 | error("%s: master cancel forward request failed", never executed: error("%s: master cancel forward request failed", __func__); | 0 |
| 2854 | __func__); never executed: error("%s: master cancel forward request failed", __func__); | 0 |
| 2855 | exit(0); never executed: exit(0); | 0 |
| 2856 | case never executed: case 8: 8:never executed: case 8: code before this statement never executed: case 8: | 0 |
| 2857 | mux_client_proxy(sock); | - |
| 2858 | return never executed: return (sock); (sock);never executed: return (sock); | 0 |
| 2859 | default never executed: default: :never executed: default: | 0 |
| 2860 | fatal("unrecognised muxclient_command %d", muxclient_command); | - |
| 2861 | } never executed: end of block | 0 |
| 2862 | } | - |
| | |