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
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([lbbs],[1.3.6])
AC_INIT([lbbs],[1.3.7])
AC_CONFIG_SRCDIR([src/])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE([foreign])
Expand Down
15 changes: 15 additions & 0 deletions src/net_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ static ssh_channel new_session_channel(ssh_session session, void *userdata)
static int fork_server(void)
{
ssh_event event;
long int ssh_timeout = 0;
int pid;
int i;
int ret;
Expand Down Expand Up @@ -176,6 +177,13 @@ static int fork_server(void)
ssh_callbacks_init(&cb);
ssh_set_server_callbacks(SSH_session, &cb);

ssh_timeout = 60; // second
if (ssh_options_set(SSH_session, SSH_OPTIONS_TIMEOUT, &ssh_timeout) < 0)
{
log_error("Error setting SSH options: %s\n", ssh_get_error(SSH_session));
goto cleanup;
}

if (ssh_handle_key_exchange(SSH_session))
{
log_error("ssh_handle_key_exchange() error: %s\n", ssh_get_error(SSH_session));
Expand All @@ -201,6 +209,13 @@ static int fork_server(void)
log_error("SSH auth error, tried %d times\n", cb_data.tries);
goto cleanup;
}

ssh_timeout = 0;
if (ssh_options_set(SSH_session, SSH_OPTIONS_TIMEOUT, &ssh_timeout) < 0)
{
log_error("Error setting SSH options: %s\n", ssh_get_error(SSH_session));
goto cleanup;
}
}

// Redirect Input
Expand Down
21 changes: 20 additions & 1 deletion src/test_ssh_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ int ssh_server(const char *hostaddr, unsigned int port)
.auth_password_function = auth_password,
.channel_open_request_session_function = new_session_channel};

long int ssh_timeout = 0;

char buf[BUF_SIZE];
char host[128] = "";
int i, r;
Expand Down Expand Up @@ -163,10 +165,19 @@ int ssh_server(const char *hostaddr, unsigned int port)
ssh_callbacks_init(&cb);
ssh_set_server_callbacks(session, &cb);

ssh_timeout = 60; // second
if (ssh_options_set(session, SSH_OPTIONS_TIMEOUT, &ssh_timeout) < 0)
{
log_error("Error setting SSH options: %s\n", ssh_get_error(session));
ssh_disconnect(session);
_exit(1);
}

if (ssh_handle_key_exchange(session))
{
log_error("ssh_handle_key_exchange: %s\n", ssh_get_error(session));
return 1;
ssh_disconnect(session);
_exit(1);
}
ssh_set_auth_methods(session, SSH_AUTH_METHOD_PASSWORD | SSH_AUTH_METHOD_GSSAPI_MIC);

Expand Down Expand Up @@ -196,6 +207,14 @@ int ssh_server(const char *hostaddr, unsigned int port)
log_common("Authenticated and got a channel\n");
}

ssh_timeout = 0;
if (ssh_options_set(session, SSH_OPTIONS_TIMEOUT, &ssh_timeout) < 0)
{
log_error("Error setting SSH options: %s\n", ssh_get_error(session));
ssh_disconnect(session);
_exit(1);
}

snprintf(buf, sizeof(buf), "Hello, welcome to the Sample SSH proxy.\r\nPlease select your destination: ");
ssh_channel_write(SSH_channel, buf, (uint32_t)strlen(buf));
do
Expand Down