1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-29 01:03:57 +03:00

callbacks: make the channel accept callback more logical

Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Aris Adamantiadis
2013-03-13 20:44:55 +01:00
committed by Andreas Schneider
parent e76442b650
commit e933d1e1b1
2 changed files with 7 additions and 12 deletions

View File

@@ -121,16 +121,12 @@ static int ssh_execute_server_callbacks(ssh_session session, ssh_message msg){
case SSH_REQUEST_CHANNEL_OPEN:
if (msg->channel_request_open.type == SSH_CHANNEL_SESSION){
if(ssh_callbacks_exists(session->server_callbacks, channel_open_request_session_function)){
channel = ssh_channel_new(session);
rc = session->server_callbacks->channel_open_request_session_function(session, channel,
channel = session->server_callbacks->channel_open_request_session_function(session,
session->server_callbacks->userdata);
if(rc==0) {
if(channel != NULL) {
rc = ssh_message_channel_request_open_reply_accept_channel(msg, channel);
if (rc == SSH_ERROR)
ssh_channel_free(channel);
return SSH_OK;
} else {
ssh_channel_free(channel);
ssh_message_reply_default(msg);
}
return SSH_OK;