mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 18:04:25 +09:00
Add error checking to ssh_message_channel_request_open_reply_default().
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@447 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -429,14 +429,33 @@ error:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ssh_message_channel_request_open_reply_default(SSH_MESSAGE *msg){
|
static int ssh_message_channel_request_open_reply_default(SSH_MESSAGE *msg) {
|
||||||
ssh_log(msg->session, SSH_LOG_FUNCTIONS, "Refusing a channel");
|
ssh_log(msg->session, SSH_LOG_FUNCTIONS, "Refusing a channel");
|
||||||
buffer_add_u8(msg->session->out_buffer,SSH2_MSG_CHANNEL_OPEN_FAILURE);
|
|
||||||
buffer_add_u32(msg->session->out_buffer,htonl(msg->channel_request_open.sender));
|
if (buffer_add_u8(msg->session->out_buffer
|
||||||
buffer_add_u32(msg->session->out_buffer,htonl(SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED));
|
, SSH2_MSG_CHANNEL_OPEN_FAILURE) < 0) {
|
||||||
buffer_add_u32(msg->session->out_buffer,0); // reason is an empty string
|
goto error;
|
||||||
buffer_add_u32(msg->session->out_buffer,0); // language too
|
}
|
||||||
return packet_send(msg->session);
|
if (buffer_add_u32(msg->session->out_buffer,
|
||||||
|
htonl(msg->channel_request_open.sender)) < 0) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if (buffer_add_u32(msg->session->out_buffer,
|
||||||
|
htonl(SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED)) < 0) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
/* reason is an empty string */
|
||||||
|
if (buffer_add_u32(msg->session->out_buffer, 0) < 0) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
/* language too */
|
||||||
|
if (buffer_add_u32(msg->session->out_buffer, 0) < 0) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return packet_send(msg->session);
|
||||||
|
error:
|
||||||
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSH_MESSAGE *handle_channel_request(SSH_SESSION *session){
|
static SSH_MESSAGE *handle_channel_request(SSH_SESSION *session){
|
||||||
|
|||||||
Reference in New Issue
Block a user