mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
SSH1: fix build
(cherry picked from commit 3eece8ac0b)
Conflicts:
src/channels.c
src/channels1.c
This commit is contained in:
committed by
Andreas Schneider
parent
64b125700e
commit
058bb0f4ea
@@ -102,7 +102,7 @@ int channel_change_pty_size1(ssh_channel channel, int cols, int rows);
|
|||||||
int channel_request_shell1(ssh_channel channel);
|
int channel_request_shell1(ssh_channel channel);
|
||||||
int channel_request_exec1(ssh_channel channel, const char *cmd);
|
int channel_request_exec1(ssh_channel channel, const char *cmd);
|
||||||
int channel_write1(ssh_channel channel, const void *data, int len);
|
int channel_write1(ssh_channel channel, const void *data, int len);
|
||||||
|
ssh_channel ssh_get_channel1(ssh_session session);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CHANNELS_H_ */
|
#endif /* CHANNELS_H_ */
|
||||||
|
|||||||
@@ -390,10 +390,8 @@ static ssh_channel channel_from_msg(ssh_session session, ssh_buffer packet) {
|
|||||||
uint32_t chan;
|
uint32_t chan;
|
||||||
#ifdef WITH_SSH1
|
#ifdef WITH_SSH1
|
||||||
/* With SSH1, the channel is always the first one */
|
/* With SSH1, the channel is always the first one */
|
||||||
if(session->version==1) {
|
if(session->version==1)
|
||||||
struct ssh_iterator *it = ssh_list_get_iterator(session->channels);
|
return ssh_get_channel1(session);
|
||||||
return ssh_iterator_value(ssh_channel, it);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
if (buffer_get_u32(packet, &chan) != sizeof(uint32_t)) {
|
if (buffer_get_u32(packet, &chan) != sizeof(uint32_t)) {
|
||||||
ssh_set_error(session, SSH_FATAL,
|
ssh_set_error(session, SSH_FATAL,
|
||||||
|
|||||||
@@ -222,17 +222,15 @@ int channel_request_exec1(ssh_channel channel, const char *cmd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_PACKET_CALLBACK(ssh_packet_data1){
|
SSH_PACKET_CALLBACK(ssh_packet_data1){
|
||||||
ssh_channel channel;
|
ssh_channel channel = ssh_get_channel1(session);
|
||||||
ssh_string str = NULL;
|
ssh_string str = NULL;
|
||||||
int is_stderr=(type==SSH_SMSG_STDOUT_DATA ? 0 : 1);
|
int is_stderr=(type==SSH_SMSG_STDOUT_DATA ? 0 : 1);
|
||||||
struct ssh_iterator *it = ssh_list_get_iterator(session->channels);
|
|
||||||
(void)user;
|
(void)user;
|
||||||
str = buffer_get_ssh_string(packet);
|
str = buffer_get_ssh_string(packet);
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
ssh_log(session, SSH_LOG_FUNCTIONS, "Invalid data packet !\n");
|
ssh_log(session, SSH_LOG_FUNCTIONS, "Invalid data packet !\n");
|
||||||
return SSH_PACKET_USED;
|
return SSH_PACKET_USED;
|
||||||
}
|
}
|
||||||
channel = ssh_iterator_value(ssh_channel, it);
|
|
||||||
|
|
||||||
ssh_log(session, SSH_LOG_PROTOCOL,
|
ssh_log(session, SSH_LOG_PROTOCOL,
|
||||||
"Adding %" PRIdS " bytes data in %d",
|
"Adding %" PRIdS " bytes data in %d",
|
||||||
@@ -249,15 +247,12 @@ SSH_PACKET_CALLBACK(ssh_packet_data1){
|
|||||||
}
|
}
|
||||||
|
|
||||||
SSH_PACKET_CALLBACK(ssh_packet_close1){
|
SSH_PACKET_CALLBACK(ssh_packet_close1){
|
||||||
ssh_channel channel;
|
ssh_channel channel = ssh_get_channel1(session);
|
||||||
struct ssh_iterator *it = ssh_list_get_iterator(session->channels);
|
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
|
|
||||||
(void)type;
|
(void)type;
|
||||||
(void)user;
|
(void)user;
|
||||||
|
|
||||||
channel = ssh_iterator_value(ssh_channel, it);
|
|
||||||
|
|
||||||
buffer_get_u32(packet, &status);
|
buffer_get_u32(packet, &status);
|
||||||
/*
|
/*
|
||||||
* It's much more than a channel closing. spec says it's the last
|
* It's much more than a channel closing. spec says it's the last
|
||||||
@@ -303,5 +298,15 @@ int channel_write1(ssh_channel channel, const void *data, int len) {
|
|||||||
return origlen;
|
return origlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssh_channel ssh_get_channel1(ssh_session session){
|
||||||
|
struct ssh_iterator *it;
|
||||||
|
/* With SSH1, the channel is always the first one */
|
||||||
|
if(session->channels != NULL){
|
||||||
|
it = ssh_list_get_iterator(session->channels);
|
||||||
|
if(it)
|
||||||
|
return ssh_iterator_value(ssh_channel, it);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif /* WITH_SSH1 */
|
#endif /* WITH_SSH1 */
|
||||||
/* vim: set ts=2 sw=2 et cindent: */
|
/* vim: set ts=2 sw=2 et cindent: */
|
||||||
|
|||||||
Reference in New Issue
Block a user