summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Hesse <mail@eworm.de>2019-07-30 08:15:59 +0200
committerNicolas Viennot <nicolas@viennot.biz>2019-07-30 09:38:02 -0400
commit299c7c670c3d56ad6eaf73618dcf0c3c5d6fa2ec (patch)
tree962741ea924c46a17f35a10679cfd7d2f98f4230
parentfd4ac27d59604aae0117ad578b1a7e6dccf97bf7 (diff)
add new channel after authentication
With libssh commit 8a885f0b ("channels: Add check if we are authenticated before we create a channel") connection fails if channel is added before successful authentication. So add the channel after authentication. Fixes #154
-rw-r--r--tmate-ssh-client.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tmate-ssh-client.c b/tmate-ssh-client.c
index 96da14c8..2a9afee0 100644
--- a/tmate-ssh-client.c
+++ b/tmate-ssh-client.c
@@ -241,12 +241,6 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
ssh_set_callbacks(session, &client->ssh_callbacks);
- client->channel = channel = ssh_channel_new(session);
- if (!channel) {
- tmate_fatal("cannot initialize");
- return;
- }
-
ssh_set_blocking(session, 0);
ssh_options_set(session, SSH_OPTIONS_HOST, client->server_ip);
ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
@@ -370,6 +364,12 @@ static void on_ssh_client_event(struct tmate_ssh_client *client)
case SSH_AUTH_SUCCESS:
tmate_debug("Auth successful");
client->state = SSH_OPEN_CHANNEL;
+
+ client->channel = channel = ssh_channel_new(session);
+ if (!channel) {
+ tmate_fatal("cannot initialize");
+ return;
+ }
/* fall through */
}