From ac83245cbe8c698b86f777b8ff5bb7fbb3c432f2 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Mon, 26 Mar 2018 04:40:49 +0000 Subject: [PATCH] Since much more than the number of bytes we're reading can be sent on a channel we ignore/close, we would get a separate warning for each chunk of data on that channel until we read past the close. Instead, if we're closing a channel, we note the channel ID, and simply discard the information immediately on the most recently closed channel. A remote could still cause a bunch of log output by multiplexing two or more writes to invalid channels, but nobody seems to do that, so this should be good for now. --- src/sbbs3/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index 20550615d6..4f1bfe03ff 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -1754,6 +1754,7 @@ static int crypt_pop_channel_data(sbbs_t *sbbs, char *inbuf, int want, int *got) int cid; char *cname; int ret; + int closing_channel = -1; *got=0; while(sbbs->online && sbbs->client_socket!=INVALID_SOCKET @@ -1762,6 +1763,8 @@ static int crypt_pop_channel_data(sbbs_t *sbbs, char *inbuf, int want, int *got) if (ret == CRYPT_OK) { status = cryptGetAttribute(sbbs->ssh_session, CRYPT_SESSINFO_SSH_CHANNEL, &cid); if (status == CRYPT_OK) { + if (cid == closing_channel) + continue; if (cid != sbbs->session_channel) { if (cryptStatusError(status = cryptSetAttribute(sbbs->ssh_session, CRYPT_SESSINFO_SSH_CHANNEL, cid))) { GCESS(status, sbbs->client_socket, sbbs->ssh_session, "setting channel"); @@ -1771,6 +1774,7 @@ static int crypt_pop_channel_data(sbbs_t *sbbs, char *inbuf, int want, int *got) lprintf(LOG_WARNING, "%04d SSH ERROR attempt to use channel '%s' (%d != %d)", sbbs->client_socket, cname ? cname : "<unknown>", cid, sbbs->session_channel); if (cname) free_crypt_attrstr(cname); + closing_channel = cid; if (cryptStatusError(status = cryptSetAttribute(sbbs->ssh_session, CRYPT_SESSINFO_SSH_CHANNEL_ACTIVE, 0))) { GCESS(status, sbbs->client_socket, sbbs->ssh_session, "closing channel"); return status; -- GitLab