]> andersk Git - openssh.git/commitdiff
- markus@cvs.openbsd.org 2003/08/29 10:04:36
authordjm <djm>
Tue, 2 Sep 2003 12:52:31 +0000 (12:52 +0000)
committerdjm <djm>
Tue, 2 Sep 2003 12:52:31 +0000 (12:52 +0000)
     [channels.c nchan.c]
     be less chatty; debug -> debug2, cleanup; ok henning@

ChangeLog
channels.c
nchan.c

index 9ac50ac9019f478bace703c0d0cff15172ac240b..6dc4b9a2e99ecc008dcce6c1f263f350277ab983 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,9 @@
    - markus@cvs.openbsd.org 2003/08/29 10:03:15
      [compat.c compat.h]
      SSH_BUG_K5USER is unused; ok henning@
+   - markus@cvs.openbsd.org 2003/08/29 10:04:36
+     [channels.c nchan.c]
+     be less chatty; debug -> debug2, cleanup; ok henning@
 
 20030829
  - (bal) openbsd-compat/ clean up.  Considate headers, add in Id on our
index e5b2b8c515580a92c9b832cca66850430a3761ae..65a6a7f00fb70c66a7489ab473140ae211104215 100644 (file)
@@ -39,7 +39,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.193 2003/07/02 14:51:16 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.194 2003/08/29 10:04:36 markus Exp $");
 
 #include "ssh.h"
 #include "ssh1.h"
@@ -177,7 +177,7 @@ channel_register_fds(Channel *c, int rfd, int wfd, int efd,
 
        /* XXX ugly hack: nonblock is only set by the server */
        if (nonblock && isatty(c->rfd)) {
-               debug("channel %d: rfd %d isatty", c->self, c->rfd);
+               debug2("channel %d: rfd %d isatty", c->self, c->rfd);
                c->isatty = 1;
                if (!isatty(c->wfd)) {
                        error("channel %d: wfd %d is not a tty?",
@@ -304,7 +304,7 @@ channel_close_fd(int *fdp)
 static void
 channel_close_fds(Channel *c)
 {
-       debug3("channel_close_fds: channel %d: r %d w %d e %d",
+       debug3("channel %d: close_fds r %d w %d e %d",
            c->self, c->rfd, c->wfd, c->efd);
 
        channel_close_fd(&c->sock);
@@ -324,11 +324,11 @@ channel_free(Channel *c)
        for (n = 0, i = 0; i < channels_alloc; i++)
                if (channels[i])
                        n++;
-       debug("channel_free: channel %d: %s, nchannels %d", c->self,
+       debug("channel %d: free: %s, nchannels %d", c->self,
            c->remote_name ? c->remote_name : "???", n);
 
        s = channel_open_message();
-       debug3("channel_free: status: %s", s);
+       debug3("channel %d: status: %s", c->self, s);
        xfree(s);
 
        if (c->sock != -1)
@@ -596,7 +596,7 @@ channel_request_start(int id, char *service, int wantconfirm)
                logit("channel_request_start: %d: unknown channel id", id);
                return;
        }
-       debug("channel %d: request %s", id, service) ;
+       debug2("channel %d: request %s", id, service) ;
        packet_start(SSH2_MSG_CHANNEL_REQUEST);
        packet_put_int(c->remote_id);
        packet_put_cstring(service);
@@ -739,7 +739,7 @@ channel_pre_input_draining(Channel *c, fd_set * readset, fd_set * writeset)
                packet_put_int(c->remote_id);
                packet_send();
                c->type = SSH_CHANNEL_CLOSED;
-               debug("channel %d: closing after input drain.", c->self);
+               debug2("channel %d: closing after input drain.", c->self);
        }
 }
 
@@ -780,7 +780,7 @@ x11_open_helper(Buffer *b)
                proto_len = ucp[6] + 256 * ucp[7];
                data_len = ucp[8] + 256 * ucp[9];
        } else {
-               debug("Initial X11 packet contains bad byte order byte: 0x%x",
+               debug2("Initial X11 packet contains bad byte order byte: 0x%x",
                    ucp[0]);
                return -1;
        }
@@ -793,14 +793,14 @@ x11_open_helper(Buffer *b)
        /* Check if authentication protocol matches. */
        if (proto_len != strlen(x11_saved_proto) ||
            memcmp(ucp + 12, x11_saved_proto, proto_len) != 0) {
-               debug("X11 connection uses different authentication protocol.");
+               debug2("X11 connection uses different authentication protocol.");
                return -1;
        }
        /* Check if authentication data matches our fake data. */
        if (data_len != x11_fake_data_len ||
            memcmp(ucp + 12 + ((proto_len + 3) & ~3),
                x11_fake_data, x11_fake_data_len) != 0) {
-               debug("X11 auth data does not match fake data.");
+               debug2("X11 auth data does not match fake data.");
                return -1;
        }
        /* Check fake data length */
@@ -857,7 +857,7 @@ channel_pre_x11_open(Channel *c, fd_set * readset, fd_set * writeset)
                channel_pre_open(c, readset, writeset);
        } else if (ret == -1) {
                logit("X11 connection rejected because of wrong authentication.");
-               debug("X11 rejected %d i%d/o%d", c->self, c->istate, c->ostate);
+               debug2("X11 rejected %d i%d/o%d", c->self, c->istate, c->ostate);
                chan_read_failed(c);
                buffer_clear(&c->input);
                chan_ibuf_empty(c);
@@ -867,7 +867,7 @@ channel_pre_x11_open(Channel *c, fd_set * readset, fd_set * writeset)
                        chan_write_failed(c);
                else
                        c->type = SSH_CHANNEL_OPEN;
-               debug("X11 closed %d i%d/o%d", c->self, c->istate, c->ostate);
+               debug2("X11 closed %d i%d/o%d", c->self, c->istate, c->ostate);
        }
 }
 
@@ -925,7 +925,7 @@ channel_decode_socks4(Channel *c, fd_set * readset, fd_set * writeset)
        strlcpy(c->path, host, sizeof(c->path));
        c->host_port = ntohs(s4_req.dest_port);
 
-       debug("channel %d: dynamic request: socks4 host %s port %u command %u",
+       debug2("channel %d: dynamic request: socks4 host %s port %u command %u",
            c->self, host, c->host_port, s4_req.command);
 
        if (s4_req.command != 1) {
@@ -1002,7 +1002,7 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset)
        if (s5_req.version != 0x05 ||
            s5_req.command != SSH_SOCKS5_CONNECT ||
            s5_req.reserved != 0x00) {
-               debug("channel %d: only socks5 connect supported", c->self);
+               debug2("channel %d: only socks5 connect supported", c->self);
                return -1;
        }
        switch(s5_req.atyp){
@@ -1019,7 +1019,7 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset)
                af = AF_INET6;
                break;
        default:
-               debug("channel %d: bad socks5 atyp %d", c->self, s5_req.atyp);
+               debug2("channel %d: bad socks5 atyp %d", c->self, s5_req.atyp);
                return -1;
        }
        if (have < 4 + addrlen + 2)
@@ -1036,7 +1036,7 @@ channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset)
                return -1;
        c->host_port = ntohs(dest_port);
        
-       debug("channel %d: dynamic request: socks5 host %s port %u command %u",
+       debug2("channel %d: dynamic request: socks5 host %s port %u command %u",
            c->self, c->path, c->host_port, s5_req.command);
 
        s5_rsp.version = 0x05;
@@ -1111,7 +1111,7 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
                addrlen = sizeof(addr);
                newsock = accept(c->sock, &addr, &addrlen);
                if (c->single_connection) {
-                       debug("single_connection: closing X11 listener.");
+                       debug2("single_connection: closing X11 listener.");
                        channel_close_fd(&c->sock);
                        chan_mark_dead(c);
                }
@@ -1137,7 +1137,7 @@ channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)
                        /* originator ipaddr and port */
                        packet_put_cstring(remote_ipaddr);
                        if (datafellows & SSH_BUG_X11FWD) {
-                               debug("ssh2 x11 bug compat mode");
+                               debug2("ssh2 x11 bug compat mode");
                        } else {
                                packet_put_int(remote_port);
                        }
@@ -1356,16 +1356,16 @@ channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset)
                if (len < 0 && (errno == EINTR || errno == EAGAIN))
                        return 1;
                if (len <= 0) {
-                       debug("channel %d: read<=0 rfd %d len %d",
+                       debug2("channel %d: read<=0 rfd %d len %d",
                            c->self, c->rfd, len);
                        if (c->type != SSH_CHANNEL_OPEN) {
-                               debug("channel %d: not open", c->self);
+                               debug2("channel %d: not open", c->self);
                                chan_mark_dead(c);
                                return -1;
                        } else if (compat13) {
                                buffer_clear(&c->output);
                                c->type = SSH_CHANNEL_INPUT_DRAINING;
-                               debug("channel %d: input draining.", c->self);
+                               debug2("channel %d: input draining.", c->self);
                        } else {
                                chan_read_failed(c);
                        }
@@ -1373,7 +1373,7 @@ channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset)
                }
                if (c->input_filter != NULL) {
                        if (c->input_filter(c, buf, len) == -1) {
-                               debug("channel %d: filter stops", c->self);
+                               debug2("channel %d: filter stops", c->self);
                                chan_read_failed(c);
                        }
                } else {
@@ -1406,12 +1406,12 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset)
                        return 1;
                if (len <= 0) {
                        if (c->type != SSH_CHANNEL_OPEN) {
-                               debug("channel %d: not open", c->self);
+                               debug2("channel %d: not open", c->self);
                                chan_mark_dead(c);
                                return -1;
                        } else if (compat13) {
                                buffer_clear(&c->output);
-                               debug("channel %d: input draining.", c->self);
+                               debug2("channel %d: input draining.", c->self);
                                c->type = SSH_CHANNEL_INPUT_DRAINING;
                        } else {
                                chan_write_failed(c);
@@ -1618,16 +1618,16 @@ channel_garbage_collect(Channel *c)
        if (c->detach_user != NULL) {
                if (!chan_is_dead(c, 0))
                        return;
-               debug("channel %d: gc: notify user", c->self);
+               debug2("channel %d: gc: notify user", c->self);
                c->detach_user(c->self, NULL);
                /* if we still have a callback */
                if (c->detach_user != NULL)
                        return;
-               debug("channel %d: gc: user detached", c->self);
+               debug2("channel %d: gc: user detached", c->self);
        }
        if (!chan_is_dead(c, 1))
                return;
-       debug("channel %d: garbage collecting", c->self);
+       debug2("channel %d: garbage collecting", c->self);
        channel_free(c);
 }
 
@@ -2002,7 +2002,7 @@ channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt)
                        c->confirm(c->self, NULL);
                        debug2("callback done");
                }
-               debug("channel %d: open confirm rwindow %u rmax %u", c->self,
+               debug2("channel %d: open confirm rwindow %u rmax %u", c->self,
                    c->remote_window, c->remote_maxpacket);
        }
        packet_check_eom();
@@ -2514,7 +2514,7 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
                        }
 #endif
                        if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
-                               debug("bind port %d: %.100s", port, strerror(errno));
+                               debug2("bind port %d: %.100s", port, strerror(errno));
                                close(sock);
 
                                if (ai->ai_next)
@@ -2663,12 +2663,12 @@ x11_connect_display(void)
                /* Create a socket. */
                sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
                if (sock < 0) {
-                       debug("socket: %.100s", strerror(errno));
+                       debug2("socket: %.100s", strerror(errno));
                        continue;
                }
                /* Connect it to the display. */
                if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
-                       debug("connect %.100s port %d: %.100s", buf,
+                       debug2("connect %.100s port %d: %.100s", buf,
                            6000 + display_number, strerror(errno));
                        close(sock);
                        continue;
diff --git a/nchan.c b/nchan.c
index 2935df3205ed2abab8eb4c54252d74f5cf907c34..3138cdd195b89d86a80223c202cf9d11aa086855 100644 (file)
--- a/nchan.c
+++ b/nchan.c
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: nchan.c,v 1.48 2003/04/08 20:21:29 itojun Exp $");
+RCSID("$OpenBSD: nchan.c,v 1.49 2003/08/29 10:04:36 markus Exp $");
 
 #include "ssh1.h"
 #include "ssh2.h"
@@ -83,7 +83,7 @@ chan_set_istate(Channel *c, u_int next)
 {
        if (c->istate > CHAN_INPUT_CLOSED || next > CHAN_INPUT_CLOSED)
                fatal("chan_set_istate: bad state %d -> %d", c->istate, next);
-       debug("channel %d: input %s -> %s", c->self, istates[c->istate],
+       debug2("channel %d: input %s -> %s", c->self, istates[c->istate],
            istates[next]);
        c->istate = next;
 }
@@ -92,7 +92,7 @@ chan_set_ostate(Channel *c, u_int next)
 {
        if (c->ostate > CHAN_OUTPUT_CLOSED || next > CHAN_OUTPUT_CLOSED)
                fatal("chan_set_ostate: bad state %d -> %d", c->ostate, next);
-       debug("channel %d: output %s -> %s", c->self, ostates[c->ostate],
+       debug2("channel %d: output %s -> %s", c->self, ostates[c->ostate],
            ostates[next]);
        c->ostate = next;
 }
@@ -104,7 +104,7 @@ chan_set_ostate(Channel *c, u_int next)
 static void
 chan_rcvd_oclose1(Channel *c)
 {
-       debug("channel %d: rcvd oclose", c->self);
+       debug2("channel %d: rcvd oclose", c->self);
        switch (c->istate) {
        case CHAN_INPUT_WAIT_OCLOSE:
                chan_set_istate(c, CHAN_INPUT_CLOSED);
@@ -128,7 +128,7 @@ chan_rcvd_oclose1(Channel *c)
 void
 chan_read_failed(Channel *c)
 {
-       debug("channel %d: read failed", c->self);
+       debug2("channel %d: read failed", c->self);
        switch (c->istate) {
        case CHAN_INPUT_OPEN:
                chan_shutdown_read(c);
@@ -143,7 +143,7 @@ chan_read_failed(Channel *c)
 void
 chan_ibuf_empty(Channel *c)
 {
-       debug("channel %d: ibuf empty", c->self);
+       debug2("channel %d: ibuf empty", c->self);
        if (buffer_len(&c->input)) {
                error("channel %d: chan_ibuf_empty for non empty buffer",
                    c->self);
@@ -169,7 +169,7 @@ chan_ibuf_empty(Channel *c)
 static void
 chan_rcvd_ieof1(Channel *c)
 {
-       debug("channel %d: rcvd ieof", c->self);
+       debug2("channel %d: rcvd ieof", c->self);
        switch (c->ostate) {
        case CHAN_OUTPUT_OPEN:
                chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN);
@@ -186,7 +186,7 @@ chan_rcvd_ieof1(Channel *c)
 static void
 chan_write_failed1(Channel *c)
 {
-       debug("channel %d: write failed", c->self);
+       debug2("channel %d: write failed", c->self);
        switch (c->ostate) {
        case CHAN_OUTPUT_OPEN:
                chan_shutdown_write(c);
@@ -207,7 +207,7 @@ chan_write_failed1(Channel *c)
 void
 chan_obuf_empty(Channel *c)
 {
-       debug("channel %d: obuf empty", c->self);
+       debug2("channel %d: obuf empty", c->self);
        if (buffer_len(&c->output)) {
                error("channel %d: chan_obuf_empty for non empty buffer",
                    c->self);
@@ -229,7 +229,7 @@ chan_obuf_empty(Channel *c)
 static void
 chan_send_ieof1(Channel *c)
 {
-       debug("channel %d: send ieof", c->self);
+       debug2("channel %d: send ieof", c->self);
        switch (c->istate) {
        case CHAN_INPUT_OPEN:
        case CHAN_INPUT_WAIT_DRAIN:
@@ -246,7 +246,7 @@ chan_send_ieof1(Channel *c)
 static void
 chan_send_oclose1(Channel *c)
 {
-       debug("channel %d: send oclose", c->self);
+       debug2("channel %d: send oclose", c->self);
        switch (c->ostate) {
        case CHAN_OUTPUT_OPEN:
        case CHAN_OUTPUT_WAIT_DRAIN:
@@ -268,7 +268,7 @@ chan_send_oclose1(Channel *c)
 static void
 chan_rcvd_close2(Channel *c)
 {
-       debug("channel %d: rcvd close", c->self);
+       debug2("channel %d: rcvd close", c->self);
        if (c->flags & CHAN_CLOSE_RCVD)
                error("channel %d: protocol error: close rcvd twice", c->self);
        c->flags |= CHAN_CLOSE_RCVD;
@@ -301,7 +301,7 @@ chan_rcvd_close2(Channel *c)
 static void
 chan_rcvd_eof2(Channel *c)
 {
-       debug("channel %d: rcvd eof", c->self);
+       debug2("channel %d: rcvd eof", c->self);
        c->flags |= CHAN_EOF_RCVD;
        if (c->ostate == CHAN_OUTPUT_OPEN)
                chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN);
@@ -309,7 +309,7 @@ chan_rcvd_eof2(Channel *c)
 static void
 chan_write_failed2(Channel *c)
 {
-       debug("channel %d: write failed", c->self);
+       debug2("channel %d: write failed", c->self);
        switch (c->ostate) {
        case CHAN_OUTPUT_OPEN:
        case CHAN_OUTPUT_WAIT_DRAIN:
@@ -325,7 +325,7 @@ chan_write_failed2(Channel *c)
 static void
 chan_send_eof2(Channel *c)
 {
-       debug("channel %d: send eof", c->self);
+       debug2("channel %d: send eof", c->self);
        switch (c->istate) {
        case CHAN_INPUT_WAIT_DRAIN:
                packet_start(SSH2_MSG_CHANNEL_EOF);
@@ -342,7 +342,7 @@ chan_send_eof2(Channel *c)
 static void
 chan_send_close2(Channel *c)
 {
-       debug("channel %d: send close", c->self);
+       debug2("channel %d: send close", c->self);
        if (c->ostate != CHAN_OUTPUT_CLOSED ||
            c->istate != CHAN_INPUT_CLOSED) {
                error("channel %d: cannot send close for istate/ostate %d/%d",
@@ -398,13 +398,13 @@ int
 chan_is_dead(Channel *c, int send)
 {
        if (c->type == SSH_CHANNEL_ZOMBIE) {
-               debug("channel %d: zombie", c->self);
+               debug2("channel %d: zombie", c->self);
                return 1;
        }
        if (c->istate != CHAN_INPUT_CLOSED || c->ostate != CHAN_OUTPUT_CLOSED)
                return 0;
        if (!compat20) {
-               debug("channel %d: is dead", c->self);
+               debug2("channel %d: is dead", c->self);
                return 1;
        }
        if ((datafellows & SSH_BUG_EXTEOF) &&
@@ -421,7 +421,7 @@ chan_is_dead(Channel *c, int send)
                } else {
                        /* channel would be dead if we sent a close */
                        if (c->flags & CHAN_CLOSE_RCVD) {
-                               debug("channel %d: almost dead",
+                               debug2("channel %d: almost dead",
                                    c->self);
                                return 1;
                        }
@@ -429,7 +429,7 @@ chan_is_dead(Channel *c, int send)
        }
        if ((c->flags & CHAN_CLOSE_SENT) &&
            (c->flags & CHAN_CLOSE_RCVD)) {
-               debug("channel %d: is dead", c->self);
+               debug2("channel %d: is dead", c->self);
                return 1;
        }
        return 0;
@@ -443,10 +443,10 @@ chan_shutdown_write(Channel *c)
        if (compat20 && c->type == SSH_CHANNEL_LARVAL)
                return;
        /* shutdown failure is allowed if write failed already */
-       debug("channel %d: close_write", c->self);
+       debug2("channel %d: close_write", c->self);
        if (c->sock != -1) {
                if (shutdown(c->sock, SHUT_WR) < 0)
-                       debug("channel %d: chan_shutdown_write: "
+                       debug2("channel %d: chan_shutdown_write: "
                            "shutdown() failed for fd%d: %.100s",
                            c->self, c->sock, strerror(errno));
        } else {
@@ -461,7 +461,7 @@ chan_shutdown_read(Channel *c)
 {
        if (compat20 && c->type == SSH_CHANNEL_LARVAL)
                return;
-       debug("channel %d: close_read", c->self);
+       debug2("channel %d: close_read", c->self);
        if (c->sock != -1) {
                /*
                 * shutdown(sock, SHUT_READ) may return ENOTCONN if the
This page took 0.519092 seconds and 5 git commands to generate.