diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2011-09-14 22:53:01 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2011-09-14 22:53:01 +0200 |
commit | 68bab2a490b53c5e396ff0ca2ad957c052ac6547 (patch) | |
tree | d716b60d7123cca5993ff14af9795d4c1d934045 | |
parent | c4701a34d3bad592dde260673f7a0654079cc2b8 (diff) | |
download | libssh-68bab2a490b53c5e396ff0ca2ad957c052ac6547.tar.gz libssh-68bab2a490b53c5e396ff0ca2ad957c052ac6547.tar.xz libssh-68bab2a490b53c5e396ff0ca2ad957c052ac6547.zip |
SSH1: handle exit-status message (channels would not close)
-rw-r--r-- | include/libssh/channels.h | 1 | ||||
-rw-r--r-- | src/channels1.c | 13 | ||||
-rw-r--r-- | src/packet1.c | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/include/libssh/channels.h b/include/libssh/channels.h index 71f89ca5..c35daf1c 100644 --- a/include/libssh/channels.h +++ b/include/libssh/channels.h @@ -103,6 +103,7 @@ void ssh_channel_do_free(ssh_channel channel); #ifdef WITH_SSH1 SSH_PACKET_CALLBACK(ssh_packet_data1); SSH_PACKET_CALLBACK(ssh_packet_close1); +SSH_PACKET_CALLBACK(ssh_packet_exist_status1); /* channels1.c */ int channel_open_session1(ssh_channel channel); diff --git a/src/channels1.c b/src/channels1.c index f13d6334..d06a7f18 100644 --- a/src/channels1.c +++ b/src/channels1.c @@ -267,6 +267,19 @@ SSH_PACKET_CALLBACK(ssh_packet_close1){ return SSH_PACKET_USED; } +SSH_PACKET_CALLBACK(ssh_packet_exist_status1){ + ssh_channel channel = ssh_get_channel1(session); + uint32_t status; + (void)type; + (void)user; + buffer_get_u32(packet, &status); + channel->state = SSH_CHANNEL_STATE_CLOSED; + channel->remote_eof = 1; + channel->exit_status = ntohl(status); + + return SSH_PACKET_USED; +} + int channel_write1(ssh_channel channel, const void *data, int len) { ssh_session session = channel->session; diff --git a/src/packet1.c b/src/packet1.c index b115abab..ddc64a3b 100644 --- a/src/packet1.c +++ b/src/packet1.c @@ -55,7 +55,7 @@ ssh_packet_callback default_packet_handlers1[]= { ssh_packet_data1, //SSH_SMSG_STDOUT_DATA 17 ssh_packet_data1, //SSH_SMSG_STDERR_DATA 18 NULL, //SSH_CMSG_EOF 19 - NULL, //SSH_SMSG_EXITSTATUS 20 + ssh_packet_exist_status1, //SSH_SMSG_EXITSTATUS 20 NULL, //SSH_MSG_CHANNEL_OPEN_CONFIRMATION 21 NULL, //SSH_MSG_CHANNEL_OPEN_FAILURE 22 NULL, //SSH_MSG_CHANNEL_DATA 23 |