|
Lines 67-72
Link Here
|
| 67 |
#include "sshpty.h" |
67 |
#include "sshpty.h" |
| 68 |
#include "key.h" |
68 |
#include "key.h" |
| 69 |
#include "readconf.h" |
69 |
#include "readconf.h" |
|
|
70 |
#include "compat.h" |
| 70 |
#include "clientloop.h" |
71 |
#include "clientloop.h" |
| 71 |
|
72 |
|
| 72 |
/* from ssh.c */ |
73 |
/* from ssh.c */ |
|
Lines 212-218
muxserver_accept_control(void)
Link Here
|
| 212 |
socklen_t addrlen; |
213 |
socklen_t addrlen; |
| 213 |
struct sockaddr_storage addr; |
214 |
struct sockaddr_storage addr; |
| 214 |
struct mux_session_confirm_ctx *cctx; |
215 |
struct mux_session_confirm_ctx *cctx; |
| 215 |
char *cmd, *tag; |
216 |
char *cmd, *tag, *signal; |
| 216 |
u_int i, j, len, env_len, mux_command, flags, escape_char; |
217 |
u_int i, j, len, env_len, mux_command, flags, escape_char; |
| 217 |
uid_t euid; |
218 |
uid_t euid; |
| 218 |
gid_t egid; |
219 |
gid_t egid; |
|
Lines 278-283
muxserver_accept_control(void)
Link Here
|
| 278 |
allowed = ask_permission("Terminate shared connection " |
279 |
allowed = ask_permission("Terminate shared connection " |
| 279 |
"to %s? ", host); |
280 |
"to %s? ", host); |
| 280 |
break; |
281 |
break; |
|
|
282 |
case SSHMUX_COMMAND_KILL: |
| 283 |
signal = buffer_get_string(&m, &len); |
| 284 |
tag = buffer_get_string(&m, &len); |
| 285 |
c = NULL; |
| 286 |
if (tag && signal && compat20) { |
| 287 |
/* channel lookup by tag */ |
| 288 |
while (c = channel_next(c)) |
| 289 |
if (c->tag && (strcmp(tag, c->tag) == 0)) |
| 290 |
break; |
| 291 |
} |
| 292 |
if (c) { |
| 293 |
if (ask) |
| 294 |
allowed = ask_permission("Send signal %s to " |
| 295 |
"session %s in %s? ", |
| 296 |
signal, tag, host); |
| 297 |
} else { |
| 298 |
allowed = 0; |
| 299 |
} |
| 300 |
break; |
| 281 |
} |
301 |
} |
| 282 |
|
302 |
|
| 283 |
/* Build response */ |
303 |
/* Build response */ |
|
Lines 305-310
muxserver_accept_control(void)
Link Here
|
| 305 |
if (c->tag) |
325 |
if (c->tag) |
| 306 |
buffer_put_cstring(&m, c->tag); |
326 |
buffer_put_cstring(&m, c->tag); |
| 307 |
break; |
327 |
break; |
|
|
328 |
case SSHMUX_COMMAND_KILL: |
| 329 |
if (allowed) { |
| 330 |
int id = c->self; |
| 331 |
channel_request_start(id, "signal", 0); |
| 332 |
packet_put_cstring(signal); |
| 333 |
packet_send(); |
| 334 |
} |
| 335 |
break; |
| 308 |
default: |
336 |
default: |
| 309 |
error("Unsupported command %d", mux_command); |
337 |
error("Unsupported command %d", mux_command); |
| 310 |
goto cleanup; |
338 |
goto cleanup; |
|
Lines 513-518
muxclient(const char *path, int ac, char **av)
Link Here
|
| 513 |
muxclient_command = SSHMUX_COMMAND_OPEN; |
541 |
muxclient_command = SSHMUX_COMMAND_OPEN; |
| 514 |
case SSHMUX_COMMAND_OPEN: |
542 |
case SSHMUX_COMMAND_OPEN: |
| 515 |
break; |
543 |
break; |
|
|
544 |
case SSHMUX_COMMAND_KILL: |
| 545 |
if (ac != 2) |
| 546 |
fatal("Bad number of arguments for control command kill"); |
| 547 |
break; |
| 516 |
default: |
548 |
default: |
| 517 |
if (ac != 0) |
549 |
if (ac != 0) |
| 518 |
fatal("Bad number of arguments for control command"); |
550 |
fatal("Bad number of arguments for control command"); |
|
Lines 587-592
muxclient(const char *path, int ac, char **av)
Link Here
|
| 587 |
|
619 |
|
| 588 |
/* Add command specific data */ |
620 |
/* Add command specific data */ |
| 589 |
switch (muxclient_command) { |
621 |
switch (muxclient_command) { |
|
|
622 |
case SSHMUX_COMMAND_KILL: |
| 623 |
buffer_put_cstring(&m, av[0]); |
| 624 |
buffer_put_cstring(&m, av[1]); |
| 625 |
break; |
| 590 |
default: |
626 |
default: |
| 591 |
break; |
627 |
break; |
| 592 |
} |
628 |
} |
|
Lines 649-654
muxclient(const char *path, int ac, char **av)
Link Here
|
| 649 |
xfree(tag); |
685 |
xfree(tag); |
| 650 |
} |
686 |
} |
| 651 |
exit(0); |
687 |
exit(0); |
|
|
688 |
case SSHMUX_COMMAND_KILL: |
| 689 |
fprintf(stderr, "Signal request sent.\r\n"); |
| 690 |
exit(0); |
| 652 |
case SSHMUX_COMMAND_OPEN: |
691 |
case SSHMUX_COMMAND_OPEN: |
| 653 |
buffer_clear(&m); |
692 |
buffer_clear(&m); |
| 654 |
buffer_put_cstring(&m, term ? term : ""); |
693 |
buffer_put_cstring(&m, term ? term : ""); |