Skip to content

Commit

Permalink
Echoserver Refresh
Browse files Browse the repository at this point in the history
1. Add the code from wolfsshd that initially sets up the terminal
   settings to the echoserver.
2. Add the WOLFSSH_TERM flag to the build of the echoserver.
  • Loading branch information
ejohnstown committed Jun 20, 2024
1 parent e2aadb1 commit c1e5af4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
19 changes: 19 additions & 0 deletions examples/echoserver/echoserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,25 @@ static int ssh_worker(thread_ctx_t* threadCtx)
ChildRunning = 1;
#endif

#if defined(WOLFSSH_TERM) && defined(WOLFSSH_SHELL)
/* set initial size of terminal based on saved size */
#if defined(HAVE_SYS_IOCTL_H)
wolfSSH_DoModes(ssh->modes, ssh->modesSz, childFd);
{
struct winsize s = {0};

s.ws_col = ssh->widthChar;
s.ws_row = ssh->heightRows;
s.ws_xpixel = ssh->widthPixels;
s.ws_ypixel = ssh->heightPixels;

ioctl(childFd, TIOCSWINSZ, &s);
}
#endif /* HAVE_SYS_IOCTL_H */

wolfSSH_SetTerminalResizeCtx(ssh, (void*)&childFd);
#endif /* WOLFSSH_TERM && WOLFSSH_SHELL */

while (ChildRunning) {
fd_set readFds;
WS_SOCKET_T maxFd;
Expand Down
2 changes: 1 addition & 1 deletion examples/echoserver/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ examples_echoserver_echoserver_SOURCES = examples/echoserver/echoserver.c \
examples/echoserver/echoserver.h
examples_echoserver_echoserver_LDADD = src/libwolfssh.la
examples_echoserver_echoserver_DEPENDENCIES = src/libwolfssh.la
examples_echoserver_echoserver_CFLAGS = $(AM_CFLAGS)
examples_echoserver_echoserver_CFLAGS = $(AM_CFLAGS) ${AM_CPPFLAGS}
endif
9 changes: 9 additions & 0 deletions tests/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ endif
if BUILD_SFTP
tests_unit_test_CPPFLAGS += -DWOLFSSH_SFTP
endif
if BUILD_TERM
tests_unit_test_CPPFLAGS += -DWOLFSSH_TERM
endif
if BUILD_SHELL
tests_unit_test_CPPFLAGS += -DWOLFSSH_SHELL
endif
Expand Down Expand Up @@ -45,6 +48,9 @@ endif
if BUILD_SFTP
tests_api_test_CPPFLAGS += -DWOLFSSH_SFTP
endif
if BUILD_TERM
tests_api_test_CPPFLAGS += -DWOLFSSH_TERM
endif
if BUILD_SHELL
tests_api_test_CPPFLAGS += -DWOLFSSH_SHELL
endif
Expand Down Expand Up @@ -77,6 +83,9 @@ endif
if BUILD_SFTP
tests_testsuite_test_CPPFLAGS += -DWOLFSSH_SFTP
endif
if BUILD_TERM
tests_testsuite_test_CPPFLAGS += -DWOLFSSH_TERM
endif
if BUILD_SHELL
tests_testsuite_test_CPPFLAGS += -DWOLFSSH_SHELL
endif
Expand Down

0 comments on commit c1e5af4

Please sign in to comment.