diff options
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/channels.c b/channels.c index e90f7fea9..bd68177b7 100644 --- a/channels.c +++ b/channels.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: channels.c,v 1.384 2018/07/27 12:03:17 markus Exp $ */ | 1 | /* $OpenBSD: channels.c,v 1.385 2018/10/04 00:10:11 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -799,6 +799,25 @@ channel_find_open(struct ssh *ssh) | |||
799 | return -1; | 799 | return -1; |
800 | } | 800 | } |
801 | 801 | ||
802 | /* Returns the state of the channel's extended usage flag */ | ||
803 | const char * | ||
804 | channel_format_extended_usage(const Channel *c) | ||
805 | { | ||
806 | if (c->efd == -1) | ||
807 | return "closed"; | ||
808 | |||
809 | switch (c->extended_usage) { | ||
810 | case CHAN_EXTENDED_WRITE: | ||
811 | return "write"; | ||
812 | case CHAN_EXTENDED_READ: | ||
813 | return "read"; | ||
814 | case CHAN_EXTENDED_IGNORE: | ||
815 | return "ignore"; | ||
816 | default: | ||
817 | return "UNKNOWN"; | ||
818 | } | ||
819 | } | ||
820 | |||
802 | /* | 821 | /* |
803 | * Returns a message describing the currently open forwarded connections, | 822 | * Returns a message describing the currently open forwarded connections, |
804 | * suitable for sending to the client. The message contains crlf pairs for | 823 | * suitable for sending to the client. The message contains crlf pairs for |
@@ -845,13 +864,16 @@ channel_open_message(struct ssh *ssh) | |||
845 | case SSH_CHANNEL_MUX_PROXY: | 864 | case SSH_CHANNEL_MUX_PROXY: |
846 | case SSH_CHANNEL_MUX_CLIENT: | 865 | case SSH_CHANNEL_MUX_CLIENT: |
847 | if ((r = sshbuf_putf(buf, " #%d %.300s " | 866 | if ((r = sshbuf_putf(buf, " #%d %.300s " |
848 | "(t%d %s%u i%u/%zu o%u/%zu fd %d/%d cc %d)\r\n", | 867 | "(t%d %s%u i%u/%zu o%u/%zu " |
868 | "fd %d/%d/%d [%s] sock %d cc %d)\r\n", | ||
849 | c->self, c->remote_name, | 869 | c->self, c->remote_name, |
850 | c->type, | 870 | c->type, |
851 | c->have_remote_id ? "r" : "nr", c->remote_id, | 871 | c->have_remote_id ? "r" : "nr", c->remote_id, |
852 | c->istate, sshbuf_len(c->input), | 872 | c->istate, sshbuf_len(c->input), |
853 | c->ostate, sshbuf_len(c->output), | 873 | c->ostate, sshbuf_len(c->output), |
854 | c->rfd, c->wfd, c->ctl_chan)) != 0) | 874 | c->rfd, c->wfd, c->efd, |
875 | channel_format_extended_usage(c), | ||
876 | c->sock, c->ctl_chan)) != 0) | ||
855 | fatal("%s: sshbuf_putf: %s", | 877 | fatal("%s: sshbuf_putf: %s", |
856 | __func__, ssh_err(r)); | 878 | __func__, ssh_err(r)); |
857 | continue; | 879 | continue; |
@@ -2352,6 +2374,7 @@ channel_garbage_collect(struct ssh *ssh, Channel *c) | |||
2352 | if (c->detach_user != NULL) { | 2374 | if (c->detach_user != NULL) { |
2353 | if (!chan_is_dead(ssh, c, c->detach_close)) | 2375 | if (!chan_is_dead(ssh, c, c->detach_close)) |
2354 | return; | 2376 | return; |
2377 | |||
2355 | debug2("channel %d: gc: notify user", c->self); | 2378 | debug2("channel %d: gc: notify user", c->self); |
2356 | c->detach_user(ssh, c->self, NULL); | 2379 | c->detach_user(ssh, c->self, NULL); |
2357 | /* if we still have a callback */ | 2380 | /* if we still have a callback */ |