Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -8739,6 +8739,12 @@ static int DoChannelOpen(WOLFSSH* ssh,
ssh->fwdCbCtx, NULL, newChannel->channel);
}
}
else {
WLOG(WS_LOG_WARN, "No forward callback set for direct-tcpip channel,"
" failing channel open");
Comment thread
yosuke-wolfssl marked this conversation as resolved.
fail_reason = OPEN_ADMINISTRATIVELY_PROHIBITED;
ret = WS_ERROR;
}
}
#endif /* WOLFSSH_FWD */
if (ret == WS_SUCCESS) {
Expand Down
24 changes: 24 additions & 0 deletions tests/regress.c
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,29 @@ static void TestDirectTcpipRejectSendsOpenFail(void)

FreeChannelOpenHarness(&harness);
}

static void TestDirectTcpipNoFwdCbSendsOpenFail(void)
{
ChannelOpenHarness harness;
byte extra[128];
byte in[192];
word32 extraSz;
word32 inSz;
int ret;

extraSz = BuildDirectTcpipExtra("127.0.0.1", 8080, "127.0.0.1", 2222,
extra, sizeof(extra));
inSz = BuildChannelOpenPacket("direct-tcpip", 9, 0x4000, 0x8000,
extra, extraSz, in, sizeof(in));

InitChannelOpenHarness(&harness, in, inSz);
/* Intentionally do NOT register fwdCb */

ret = DoReceive(harness.ssh);
AssertChannelOpenFailResponse(&harness, ret);

FreeChannelOpenHarness(&harness);
}
#endif

#ifdef WOLFSSH_AGENT
Expand Down Expand Up @@ -1648,6 +1671,7 @@ int main(int argc, char** argv)
TestChannelOpenCallbackRejectSendsOpenFail();
#ifdef WOLFSSH_FWD
TestDirectTcpipRejectSendsOpenFail();
TestDirectTcpipNoFwdCbSendsOpenFail();
#endif
#ifdef WOLFSSH_AGENT
TestAgentChannelNullAgentSendsOpenFail();
Expand Down
Loading