summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--channels.c62
-rw-r--r--nchan.c46
3 files changed, 58 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index 55b2975ba..8ef52dc25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,9 @@
12 - markus@cvs.openbsd.org 2003/08/29 10:03:15 12 - markus@cvs.openbsd.org 2003/08/29 10:03:15
13 [compat.c compat.h] 13 [compat.c compat.h]
14 SSH_BUG_K5USER is unused; ok henning@ 14 SSH_BUG_K5USER is unused; ok henning@
15 - markus@cvs.openbsd.org 2003/08/29 10:04:36
16 [channels.c nchan.c]
17 be less chatty; debug -> debug2, cleanup; ok henning@
15 18
1620030829 1920030829
17 - (bal) openbsd-compat/ clean up. Considate headers, add in Id on our 20 - (bal) openbsd-compat/ clean up. Considate headers, add in Id on our
@@ -927,4 +930,4 @@
927 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. 930 - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
928 Report from murple@murple.net, diagnosis from dtucker@zip.com.au 931 Report from murple@murple.net, diagnosis from dtucker@zip.com.au
929 932
930$Id: ChangeLog,v 1.2922 2003/09/02 12:52:00 djm Exp $ 933$Id: ChangeLog,v 1.2923 2003/09/02 12:52:31 djm Exp $
diff --git a/channels.c b/channels.c
index e5b2b8c51..65a6a7f00 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.193 2003/07/02 14:51:16 markus Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.194 2003/08/29 10:04:36 markus Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -177,7 +177,7 @@ channel_register_fds(Channel *c, int rfd, int wfd, int efd,
177 177
178 /* XXX ugly hack: nonblock is only set by the server */ 178 /* XXX ugly hack: nonblock is only set by the server */
179 if (nonblock && isatty(c->rfd)) { 179 if (nonblock && isatty(c->rfd)) {
180 debug("channel %d: rfd %d isatty", c->self, c->rfd); 180 debug2("channel %d: rfd %d isatty", c->self, c->rfd);
181 c->isatty = 1; 181 c->isatty = 1;
182 if (!isatty(c->wfd)) { 182 if (!isatty(c->wfd)) {
183 error("channel %d: wfd %d is not a tty?", 183 error("channel %d: wfd %d is not a tty?",
@@ -304,7 +304,7 @@ channel_close_fd(int *fdp)
304static void 304static void
305channel_close_fds(Channel *c) 305channel_close_fds(Channel *c)
306{ 306{
307 debug3("channel_close_fds: channel %d: r %d w %d e %d", 307 debug3("channel %d: close_fds r %d w %d e %d",
308 c->self, c->rfd, c->wfd, c->efd); 308 c->self, c->rfd, c->wfd, c->efd);
309 309
310 channel_close_fd(&c->sock); 310 channel_close_fd(&c->sock);
@@ -324,11 +324,11 @@ channel_free(Channel *c)
324 for (n = 0, i = 0; i < channels_alloc; i++) 324 for (n = 0, i = 0; i < channels_alloc; i++)
325 if (channels[i]) 325 if (channels[i])
326 n++; 326 n++;
327 debug("channel_free: channel %d: %s, nchannels %d", c->self, 327 debug("channel %d: free: %s, nchannels %d", c->self,
328 c->remote_name ? c->remote_name : "???", n); 328 c->remote_name ? c->remote_name : "???", n);
329 329
330 s = channel_open_message(); 330 s = channel_open_message();
331 debug3("channel_free: status: %s", s); 331 debug3("channel %d: status: %s", c->self, s);
332 xfree(s); 332 xfree(s);
333 333
334 if (c->sock != -1) 334 if (c->sock != -1)
@@ -596,7 +596,7 @@ channel_request_start(int id, char *service, int wantconfirm)
596 logit("channel_request_start: %d: unknown channel id", id); 596 logit("channel_request_start: %d: unknown channel id", id);
597 return; 597 return;
598 } 598 }
599 debug("channel %d: request %s", id, service) ; 599 debug2("channel %d: request %s", id, service) ;
600 packet_start(SSH2_MSG_CHANNEL_REQUEST); 600 packet_start(SSH2_MSG_CHANNEL_REQUEST);
601 packet_put_int(c->remote_id); 601 packet_put_int(c->remote_id);
602 packet_put_cstring(service); 602 packet_put_cstring(service);
@@ -739,7 +739,7 @@ channel_pre_input_draining(Channel *c, fd_set * readset, fd_set * writeset)
739 packet_put_int(c->remote_id); 739 packet_put_int(c->remote_id);
740 packet_send(); 740 packet_send();
741 c->type = SSH_CHANNEL_CLOSED; 741 c->type = SSH_CHANNEL_CLOSED;
742 debug("channel %d: closing after input drain.", c->self); 742 debug2("channel %d: closing after input drain.", c->self);
743 } 743 }
744} 744}
745 745
@@ -780,7 +780,7 @@ x11_open_helper(Buffer *b)
780 proto_len = ucp[6] + 256 * ucp[7]; 780 proto_len = ucp[6] + 256 * ucp[7];
781 data_len = ucp[8] + 256 * ucp[9]; 781 data_len = ucp[8] + 256 * ucp[9];
782 } else { 782 } else {
783 debug("Initial X11 packet contains bad byte order byte: 0x%x", 783 debug2("Initial X11 packet contains bad byte order byte: 0x%x",
784 ucp[0]); 784 ucp[0]);
785 return -1; 785 return -1;
786 } 786 }
@@ -793,14 +793,14 @@ x11_open_helper(Buffer *b)
793 /* Check if authentication protocol matches. */ 793 /* Check if authentication protocol matches. */
794 if (proto_len != strlen(x11_saved_proto) || 794 if (proto_len != strlen(x11_saved_proto) ||
795 memcmp(ucp + 12, x11_saved_proto, proto_len) != 0) { 795 memcmp(ucp + 12, x11_saved_proto, proto_len) != 0) {
796 debug("X11 connection uses different authentication protocol."); 796 debug2("X11 connection uses different authentication protocol.");
797 return -1; 797 return -1;
798 } 798 }
799 /* Check if authentication data matches our fake data. */ 799 /* Check if authentication data matches our fake data. */
800 if (data_len != x11_fake_data_len || 800 if (data_len != x11_fake_data_len ||
801 memcmp(ucp + 12 + ((proto_len + 3) & ~3), 801 memcmp(ucp + 12 + ((proto_len + 3) & ~3),
802 x11_fake_data, x11_fake_data_len) != 0) { 802 x11_fake_data, x11_fake_data_len) != 0) {
803 debug("X11 auth data does not match fake data."); 803 debug2("X11 auth data does not match fake data.");
804 return -1; 804 return -1;
805 } 805 }
806 /* Check fake data length */ 806 /* Check fake data length */
@@ -857,7 +857,7 @@ channel_pre_x11_open(Channel *c, fd_set * readset, fd_set * writeset)
857 channel_pre_open(c, readset, writeset); 857 channel_pre_open(c, readset, writeset);
858 } else if (ret == -1) { 858 } else if (ret == -1) {
859 logit("X11 connection rejected because of wrong authentication."); 859 logit("X11 connection rejected because of wrong authentication.");
860 debug("X11 rejected %d i%d/o%d", c->self, c->istate, c->ostate); 860 debug2("X11 rejected %d i%d/o%d", c->self, c->istate, c->ostate);
861 chan_read_failed(c); 861 chan_read_failed(c);
862 buffer_clear(&c->input); 862 buffer_clear(&c->input);
863 chan_ibuf_empty(c); 863 chan_ibuf_empty(c);
@@ -867,7 +867,7 @@ channel_pre_x11_open(Channel *c, fd_set * readset, fd_set * writeset)
867 chan_write_failed(c); 867 chan_write_failed(c);
868 else 868 else
869 c->type = SSH_CHANNEL_OPEN; 869 c->type = SSH_CHANNEL_OPEN;
870 debug("X11 closed %d i%d/o%d", c->self, c->istate, c->ostate); 870 debug2("X11 closed %d i%d/o%d", c->self, c->istate, c->ostate);
871 } 871 }
872} 872}
873 873
@@ -925,7 +925,7 @@ channel_decode_socks4(Channel *c, fd_set * readset, fd_set * writeset)
925 strlcpy(c->path, host, sizeof(c->path)); 925 strlcpy(c->path, host, sizeof(c->path));
926 c->host_port = ntohs(s4_req.dest_port); 926 c->host_port = ntohs(s4_req.dest_port);
927 927
928 debug("channel %d: dynamic request: socks4 host %s port %u command %u", 928 debug2("channel %d: dynamic request: socks4 host %s port %u command %u",
929 c->self, host, c->host_port, s4_req.command); 929 c->self, host, c->host_port, s4_req.command);
930 930
931 if (s4_req.command != 1) { 931 if (s4_req.command != 1) {
@@ -1002,7 +1002,7 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset)
1002 if (s5_req.version != 0x05 || 1002 if (s5_req.version != 0x05 ||
1003 s5_req.command != SSH_SOCKS5_CONNECT || 1003 s5_req.command != SSH_SOCKS5_CONNECT ||
1004 s5_req.reserved != 0x00) { 1004 s5_req.reserved != 0x00) {
1005 debug("channel %d: only socks5 connect supported", c->self); 1005 debug2("channel %d: only socks5 connect supported", c->self);
1006 return -1; 1006 return -1;
1007 } 1007 }
1008 switch(s5_req.atyp){ 1008 switch(s5_req.atyp){
@@ -1019,7 +1019,7 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset)
1019 af = AF_INET6; 1019 af = AF_INET6;
1020 break; 1020 break;
1021 default: 1021 default:
1022 debug("channel %d: bad socks5 atyp %d", c->self, s5_req.atyp); 1022 debug2("channel %d: bad socks5 atyp %d", c->self, s5_req.atyp);
1023 return -1; 1023 return -1;
1024 } 1024 }
1025 if (have < 4 + addrlen + 2) 1025 if (have < 4 + addrlen + 2)
@@ -1036,7 +1036,7 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset)
1036 return -1; 1036 return -1;
1037 c->host_port = ntohs(dest_port); 1037 c->host_port = ntohs(dest_port);
1038 1038
1039 debug("channel %d: dynamic request: socks5 host %s port %u command %u", 1039 debug2("channel %d: dynamic request: socks5 host %s port %u command %u",
1040 c->self, c->path, c->host_port, s5_req.command); 1040 c->self, c->path, c->host_port, s5_req.command);
1041 1041
1042 s5_rsp.version = 0x05; 1042 s5_rsp.version = 0x05;
@@ -1111,7 +1111,7 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
1111 addrlen = sizeof(addr); 1111 addrlen = sizeof(addr);
1112 newsock = accept(c->sock, &addr, &addrlen); 1112 newsock = accept(c->sock, &addr, &addrlen);
1113 if (c->single_connection) { 1113 if (c->single_connection) {
1114 debug("single_connection: closing X11 listener."); 1114 debug2("single_connection: closing X11 listener.");
1115 channel_close_fd(&c->sock); 1115 channel_close_fd(&c->sock);
1116 chan_mark_dead(c); 1116 chan_mark_dead(c);
1117 } 1117 }
@@ -1137,7 +1137,7 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
1137 /* originator ipaddr and port */ 1137 /* originator ipaddr and port */
1138 packet_put_cstring(remote_ipaddr); 1138 packet_put_cstring(remote_ipaddr);
1139 if (datafellows & SSH_BUG_X11FWD) { 1139 if (datafellows & SSH_BUG_X11FWD) {
1140 debug("ssh2 x11 bug compat mode"); 1140 debug2("ssh2 x11 bug compat mode");
1141 } else { 1141 } else {
1142 packet_put_int(remote_port); 1142 packet_put_int(remote_port);
1143 } 1143 }
@@ -1356,16 +1356,16 @@ channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset)
1356 if (len < 0 && (errno == EINTR || errno == EAGAIN)) 1356 if (len < 0 && (errno == EINTR || errno == EAGAIN))
1357 return 1; 1357 return 1;
1358 if (len <= 0) { 1358 if (len <= 0) {
1359 debug("channel %d: read<=0 rfd %d len %d", 1359 debug2("channel %d: read<=0 rfd %d len %d",
1360 c->self, c->rfd, len); 1360 c->self, c->rfd, len);
1361 if (c->type != SSH_CHANNEL_OPEN) { 1361 if (c->type != SSH_CHANNEL_OPEN) {
1362 debug("channel %d: not open", c->self); 1362 debug2("channel %d: not open", c->self);
1363 chan_mark_dead(c); 1363 chan_mark_dead(c);
1364 return -1; 1364 return -1;
1365 } else if (compat13) { 1365 } else if (compat13) {
1366 buffer_clear(&c->output); 1366 buffer_clear(&c->output);
1367 c->type = SSH_CHANNEL_INPUT_DRAINING; 1367 c->type = SSH_CHANNEL_INPUT_DRAINING;
1368 debug("channel %d: input draining.", c->self); 1368 debug2("channel %d: input draining.", c->self);
1369 } else { 1369 } else {
1370 chan_read_failed(c); 1370 chan_read_failed(c);
1371 } 1371 }
@@ -1373,7 +1373,7 @@ channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset)
1373 } 1373 }
1374 if (c->input_filter != NULL) { 1374 if (c->input_filter != NULL) {
1375 if (c->input_filter(c, buf, len) == -1) { 1375 if (c->input_filter(c, buf, len) == -1) {
1376 debug("channel %d: filter stops", c->self); 1376 debug2("channel %d: filter stops", c->self);
1377 chan_read_failed(c); 1377 chan_read_failed(c);
1378 } 1378 }
1379 } else { 1379 } else {
@@ -1406,12 +1406,12 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset)
1406 return 1; 1406 return 1;
1407 if (len <= 0) { 1407 if (len <= 0) {
1408 if (c->type != SSH_CHANNEL_OPEN) { 1408 if (c->type != SSH_CHANNEL_OPEN) {
1409 debug("channel %d: not open", c->self); 1409 debug2("channel %d: not open", c->self);
1410 chan_mark_dead(c); 1410 chan_mark_dead(c);
1411 return -1; 1411 return -1;
1412 } else if (compat13) { 1412 } else if (compat13) {
1413 buffer_clear(&c->output); 1413 buffer_clear(&c->output);
1414 debug("channel %d: input draining.", c->self); 1414 debug2("channel %d: input draining.", c->self);
1415 c->type = SSH_CHANNEL_INPUT_DRAINING; 1415 c->type = SSH_CHANNEL_INPUT_DRAINING;
1416 } else { 1416 } else {
1417 chan_write_failed(c); 1417 chan_write_failed(c);
@@ -1618,16 +1618,16 @@ channel_garbage_collect(Channel *c)
1618 if (c->detach_user != NULL) { 1618 if (c->detach_user != NULL) {
1619 if (!chan_is_dead(c, 0)) 1619 if (!chan_is_dead(c, 0))
1620 return; 1620 return;
1621 debug("channel %d: gc: notify user", c->self); 1621 debug2("channel %d: gc: notify user", c->self);
1622 c->detach_user(c->self, NULL); 1622 c->detach_user(c->self, NULL);
1623 /* if we still have a callback */ 1623 /* if we still have a callback */
1624 if (c->detach_user != NULL) 1624 if (c->detach_user != NULL)
1625 return; 1625 return;
1626 debug("channel %d: gc: user detached", c->self); 1626 debug2("channel %d: gc: user detached", c->self);
1627 } 1627 }
1628 if (!chan_is_dead(c, 1)) 1628 if (!chan_is_dead(c, 1))
1629 return; 1629 return;
1630 debug("channel %d: garbage collecting", c->self); 1630 debug2("channel %d: garbage collecting", c->self);
1631 channel_free(c); 1631 channel_free(c);
1632} 1632}
1633 1633
@@ -2002,7 +2002,7 @@ channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt)
2002 c->confirm(c->self, NULL); 2002 c->confirm(c->self, NULL);
2003 debug2("callback done"); 2003 debug2("callback done");
2004 } 2004 }
2005 debug("channel %d: open confirm rwindow %u rmax %u", c->self, 2005 debug2("channel %d: open confirm rwindow %u rmax %u", c->self,
2006 c->remote_window, c->remote_maxpacket); 2006 c->remote_window, c->remote_maxpacket);
2007 } 2007 }
2008 packet_check_eom(); 2008 packet_check_eom();
@@ -2514,7 +2514,7 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
2514 } 2514 }
2515#endif 2515#endif
2516 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) { 2516 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2517 debug("bind port %d: %.100s", port, strerror(errno)); 2517 debug2("bind port %d: %.100s", port, strerror(errno));
2518 close(sock); 2518 close(sock);
2519 2519
2520 if (ai->ai_next) 2520 if (ai->ai_next)
@@ -2663,12 +2663,12 @@ x11_connect_display(void)
2663 /* Create a socket. */ 2663 /* Create a socket. */
2664 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); 2664 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2665 if (sock < 0) { 2665 if (sock < 0) {
2666 debug("socket: %.100s", strerror(errno)); 2666 debug2("socket: %.100s", strerror(errno));
2667 continue; 2667 continue;
2668 } 2668 }
2669 /* Connect it to the display. */ 2669 /* Connect it to the display. */
2670 if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0) { 2670 if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2671 debug("connect %.100s port %d: %.100s", buf, 2671 debug2("connect %.100s port %d: %.100s", buf,
2672 6000 + display_number, strerror(errno)); 2672 6000 + display_number, strerror(errno));
2673 close(sock); 2673 close(sock);
2674 continue; 2674 continue;
diff --git a/nchan.c b/nchan.c
index 2935df320..3138cdd19 100644
--- a/nchan.c
+++ b/nchan.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: nchan.c,v 1.48 2003/04/08 20:21:29 itojun Exp $"); 26RCSID("$OpenBSD: nchan.c,v 1.49 2003/08/29 10:04:36 markus Exp $");
27 27
28#include "ssh1.h" 28#include "ssh1.h"
29#include "ssh2.h" 29#include "ssh2.h"
@@ -83,7 +83,7 @@ chan_set_istate(Channel *c, u_int next)
83{ 83{
84 if (c->istate > CHAN_INPUT_CLOSED || next > CHAN_INPUT_CLOSED) 84 if (c->istate > CHAN_INPUT_CLOSED || next > CHAN_INPUT_CLOSED)
85 fatal("chan_set_istate: bad state %d -> %d", c->istate, next); 85 fatal("chan_set_istate: bad state %d -> %d", c->istate, next);
86 debug("channel %d: input %s -> %s", c->self, istates[c->istate], 86 debug2("channel %d: input %s -> %s", c->self, istates[c->istate],
87 istates[next]); 87 istates[next]);
88 c->istate = next; 88 c->istate = next;
89} 89}
@@ -92,7 +92,7 @@ chan_set_ostate(Channel *c, u_int next)
92{ 92{
93 if (c->ostate > CHAN_OUTPUT_CLOSED || next > CHAN_OUTPUT_CLOSED) 93 if (c->ostate > CHAN_OUTPUT_CLOSED || next > CHAN_OUTPUT_CLOSED)
94 fatal("chan_set_ostate: bad state %d -> %d", c->ostate, next); 94 fatal("chan_set_ostate: bad state %d -> %d", c->ostate, next);
95 debug("channel %d: output %s -> %s", c->self, ostates[c->ostate], 95 debug2("channel %d: output %s -> %s", c->self, ostates[c->ostate],
96 ostates[next]); 96 ostates[next]);
97 c->ostate = next; 97 c->ostate = next;
98} 98}
@@ -104,7 +104,7 @@ chan_set_ostate(Channel *c, u_int next)
104static void 104static void
105chan_rcvd_oclose1(Channel *c) 105chan_rcvd_oclose1(Channel *c)
106{ 106{
107 debug("channel %d: rcvd oclose", c->self); 107 debug2("channel %d: rcvd oclose", c->self);
108 switch (c->istate) { 108 switch (c->istate) {
109 case CHAN_INPUT_WAIT_OCLOSE: 109 case CHAN_INPUT_WAIT_OCLOSE:
110 chan_set_istate(c, CHAN_INPUT_CLOSED); 110 chan_set_istate(c, CHAN_INPUT_CLOSED);
@@ -128,7 +128,7 @@ chan_rcvd_oclose1(Channel *c)
128void 128void
129chan_read_failed(Channel *c) 129chan_read_failed(Channel *c)
130{ 130{
131 debug("channel %d: read failed", c->self); 131 debug2("channel %d: read failed", c->self);
132 switch (c->istate) { 132 switch (c->istate) {
133 case CHAN_INPUT_OPEN: 133 case CHAN_INPUT_OPEN:
134 chan_shutdown_read(c); 134 chan_shutdown_read(c);
@@ -143,7 +143,7 @@ chan_read_failed(Channel *c)
143void 143void
144chan_ibuf_empty(Channel *c) 144chan_ibuf_empty(Channel *c)
145{ 145{
146 debug("channel %d: ibuf empty", c->self); 146 debug2("channel %d: ibuf empty", c->self);
147 if (buffer_len(&c->input)) { 147 if (buffer_len(&c->input)) {
148 error("channel %d: chan_ibuf_empty for non empty buffer", 148 error("channel %d: chan_ibuf_empty for non empty buffer",
149 c->self); 149 c->self);
@@ -169,7 +169,7 @@ chan_ibuf_empty(Channel *c)
169static void 169static void
170chan_rcvd_ieof1(Channel *c) 170chan_rcvd_ieof1(Channel *c)
171{ 171{
172 debug("channel %d: rcvd ieof", c->self); 172 debug2("channel %d: rcvd ieof", c->self);
173 switch (c->ostate) { 173 switch (c->ostate) {
174 case CHAN_OUTPUT_OPEN: 174 case CHAN_OUTPUT_OPEN:
175 chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN); 175 chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN);
@@ -186,7 +186,7 @@ chan_rcvd_ieof1(Channel *c)
186static void 186static void
187chan_write_failed1(Channel *c) 187chan_write_failed1(Channel *c)
188{ 188{
189 debug("channel %d: write failed", c->self); 189 debug2("channel %d: write failed", c->self);
190 switch (c->ostate) { 190 switch (c->ostate) {
191 case CHAN_OUTPUT_OPEN: 191 case CHAN_OUTPUT_OPEN:
192 chan_shutdown_write(c); 192 chan_shutdown_write(c);
@@ -207,7 +207,7 @@ chan_write_failed1(Channel *c)
207void 207void
208chan_obuf_empty(Channel *c) 208chan_obuf_empty(Channel *c)
209{ 209{
210 debug("channel %d: obuf empty", c->self); 210 debug2("channel %d: obuf empty", c->self);
211 if (buffer_len(&c->output)) { 211 if (buffer_len(&c->output)) {
212 error("channel %d: chan_obuf_empty for non empty buffer", 212 error("channel %d: chan_obuf_empty for non empty buffer",
213 c->self); 213 c->self);
@@ -229,7 +229,7 @@ chan_obuf_empty(Channel *c)
229static void 229static void
230chan_send_ieof1(Channel *c) 230chan_send_ieof1(Channel *c)
231{ 231{
232 debug("channel %d: send ieof", c->self); 232 debug2("channel %d: send ieof", c->self);
233 switch (c->istate) { 233 switch (c->istate) {
234 case CHAN_INPUT_OPEN: 234 case CHAN_INPUT_OPEN:
235 case CHAN_INPUT_WAIT_DRAIN: 235 case CHAN_INPUT_WAIT_DRAIN:
@@ -246,7 +246,7 @@ chan_send_ieof1(Channel *c)
246static void 246static void
247chan_send_oclose1(Channel *c) 247chan_send_oclose1(Channel *c)
248{ 248{
249 debug("channel %d: send oclose", c->self); 249 debug2("channel %d: send oclose", c->self);
250 switch (c->ostate) { 250 switch (c->ostate) {
251 case CHAN_OUTPUT_OPEN: 251 case CHAN_OUTPUT_OPEN:
252 case CHAN_OUTPUT_WAIT_DRAIN: 252 case CHAN_OUTPUT_WAIT_DRAIN:
@@ -268,7 +268,7 @@ chan_send_oclose1(Channel *c)
268static void 268static void
269chan_rcvd_close2(Channel *c) 269chan_rcvd_close2(Channel *c)
270{ 270{
271 debug("channel %d: rcvd close", c->self); 271 debug2("channel %d: rcvd close", c->self);
272 if (c->flags & CHAN_CLOSE_RCVD) 272 if (c->flags & CHAN_CLOSE_RCVD)
273 error("channel %d: protocol error: close rcvd twice", c->self); 273 error("channel %d: protocol error: close rcvd twice", c->self);
274 c->flags |= CHAN_CLOSE_RCVD; 274 c->flags |= CHAN_CLOSE_RCVD;
@@ -301,7 +301,7 @@ chan_rcvd_close2(Channel *c)
301static void 301static void
302chan_rcvd_eof2(Channel *c) 302chan_rcvd_eof2(Channel *c)
303{ 303{
304 debug("channel %d: rcvd eof", c->self); 304 debug2("channel %d: rcvd eof", c->self);
305 c->flags |= CHAN_EOF_RCVD; 305 c->flags |= CHAN_EOF_RCVD;
306 if (c->ostate == CHAN_OUTPUT_OPEN) 306 if (c->ostate == CHAN_OUTPUT_OPEN)
307 chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN); 307 chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN);
@@ -309,7 +309,7 @@ chan_rcvd_eof2(Channel *c)
309static void 309static void
310chan_write_failed2(Channel *c) 310chan_write_failed2(Channel *c)
311{ 311{
312 debug("channel %d: write failed", c->self); 312 debug2("channel %d: write failed", c->self);
313 switch (c->ostate) { 313 switch (c->ostate) {
314 case CHAN_OUTPUT_OPEN: 314 case CHAN_OUTPUT_OPEN:
315 case CHAN_OUTPUT_WAIT_DRAIN: 315 case CHAN_OUTPUT_WAIT_DRAIN:
@@ -325,7 +325,7 @@ chan_write_failed2(Channel *c)
325static void 325static void
326chan_send_eof2(Channel *c) 326chan_send_eof2(Channel *c)
327{ 327{
328 debug("channel %d: send eof", c->self); 328 debug2("channel %d: send eof", c->self);
329 switch (c->istate) { 329 switch (c->istate) {
330 case CHAN_INPUT_WAIT_DRAIN: 330 case CHAN_INPUT_WAIT_DRAIN:
331 packet_start(SSH2_MSG_CHANNEL_EOF); 331 packet_start(SSH2_MSG_CHANNEL_EOF);
@@ -342,7 +342,7 @@ chan_send_eof2(Channel *c)
342static void 342static void
343chan_send_close2(Channel *c) 343chan_send_close2(Channel *c)
344{ 344{
345 debug("channel %d: send close", c->self); 345 debug2("channel %d: send close", c->self);
346 if (c->ostate != CHAN_OUTPUT_CLOSED || 346 if (c->ostate != CHAN_OUTPUT_CLOSED ||
347 c->istate != CHAN_INPUT_CLOSED) { 347 c->istate != CHAN_INPUT_CLOSED) {
348 error("channel %d: cannot send close for istate/ostate %d/%d", 348 error("channel %d: cannot send close for istate/ostate %d/%d",
@@ -398,13 +398,13 @@ int
398chan_is_dead(Channel *c, int send) 398chan_is_dead(Channel *c, int send)
399{ 399{
400 if (c->type == SSH_CHANNEL_ZOMBIE) { 400 if (c->type == SSH_CHANNEL_ZOMBIE) {
401 debug("channel %d: zombie", c->self); 401 debug2("channel %d: zombie", c->self);
402 return 1; 402 return 1;
403 } 403 }
404 if (c->istate != CHAN_INPUT_CLOSED || c->ostate != CHAN_OUTPUT_CLOSED) 404 if (c->istate != CHAN_INPUT_CLOSED || c->ostate != CHAN_OUTPUT_CLOSED)
405 return 0; 405 return 0;
406 if (!compat20) { 406 if (!compat20) {
407 debug("channel %d: is dead", c->self); 407 debug2("channel %d: is dead", c->self);
408 return 1; 408 return 1;
409 } 409 }
410 if ((datafellows & SSH_BUG_EXTEOF) && 410 if ((datafellows & SSH_BUG_EXTEOF) &&
@@ -421,7 +421,7 @@ chan_is_dead(Channel *c, int send)
421 } else { 421 } else {
422 /* channel would be dead if we sent a close */ 422 /* channel would be dead if we sent a close */
423 if (c->flags & CHAN_CLOSE_RCVD) { 423 if (c->flags & CHAN_CLOSE_RCVD) {
424 debug("channel %d: almost dead", 424 debug2("channel %d: almost dead",
425 c->self); 425 c->self);
426 return 1; 426 return 1;
427 } 427 }
@@ -429,7 +429,7 @@ chan_is_dead(Channel *c, int send)
429 } 429 }
430 if ((c->flags & CHAN_CLOSE_SENT) && 430 if ((c->flags & CHAN_CLOSE_SENT) &&
431 (c->flags & CHAN_CLOSE_RCVD)) { 431 (c->flags & CHAN_CLOSE_RCVD)) {
432 debug("channel %d: is dead", c->self); 432 debug2("channel %d: is dead", c->self);
433 return 1; 433 return 1;
434 } 434 }
435 return 0; 435 return 0;
@@ -443,10 +443,10 @@ chan_shutdown_write(Channel *c)
443 if (compat20 && c->type == SSH_CHANNEL_LARVAL) 443 if (compat20 && c->type == SSH_CHANNEL_LARVAL)
444 return; 444 return;
445 /* shutdown failure is allowed if write failed already */ 445 /* shutdown failure is allowed if write failed already */
446 debug("channel %d: close_write", c->self); 446 debug2("channel %d: close_write", c->self);
447 if (c->sock != -1) { 447 if (c->sock != -1) {
448 if (shutdown(c->sock, SHUT_WR) < 0) 448 if (shutdown(c->sock, SHUT_WR) < 0)
449 debug("channel %d: chan_shutdown_write: " 449 debug2("channel %d: chan_shutdown_write: "
450 "shutdown() failed for fd%d: %.100s", 450 "shutdown() failed for fd%d: %.100s",
451 c->self, c->sock, strerror(errno)); 451 c->self, c->sock, strerror(errno));
452 } else { 452 } else {
@@ -461,7 +461,7 @@ chan_shutdown_read(Channel *c)
461{ 461{
462 if (compat20 && c->type == SSH_CHANNEL_LARVAL) 462 if (compat20 && c->type == SSH_CHANNEL_LARVAL)
463 return; 463 return;
464 debug("channel %d: close_read", c->self); 464 debug2("channel %d: close_read", c->self);
465 if (c->sock != -1) { 465 if (c->sock != -1) {
466 /* 466 /*
467 * shutdown(sock, SHUT_READ) may return ENOTCONN if the 467 * shutdown(sock, SHUT_READ) may return ENOTCONN if the