channels: Add check if we are authenticated before we create a channel

Fixes T139

Reported-by: Jan Pazdziora <jpazdziora@redhat.com>
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Andreas Schneider
2019-04-29 10:31:20 +02:00
parent c4348c7b3c
commit 8a885f0bd3

View File

@@ -85,6 +85,11 @@ ssh_channel ssh_channel_new(ssh_session session)
return NULL;
}
/* Check if we have an authenticated session */
if (!(session->flags & SSH_SESSION_FLAG_AUTHENTICATED)) {
return NULL;
}
channel = calloc(1, sizeof(struct ssh_channel_struct));
if (channel == NULL) {
ssh_set_error_oom(session);