mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user