aboutsummaryrefslogtreecommitdiff
path: root/libssh/channels.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-01-24 21:03:03 +0100
committerAris Adamantiadis <aris@0xbadc0de.be>2010-01-24 21:03:03 +0100
commit758df265822928744ab20cec8e4929236b6b41e9 (patch)
tree42e10f836c0fbc57fb771f765caf616a69967777 /libssh/channels.c
parent6ae558b5410c0ebec6d9e3147e3b6eb6f0430f72 (diff)
downloadlibssh-758df265822928744ab20cec8e4929236b6b41e9.tar.gz
libssh-758df265822928744ab20cec8e4929236b6b41e9.tar.xz
libssh-758df265822928744ab20cec8e4929236b6b41e9.zip
Made parts of SSH asynchronous (inc kex1)
Diffstat (limited to 'libssh/channels.c')
-rw-r--r--libssh/channels.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libssh/channels.c b/libssh/channels.c
index 0a7bf38..aa31009 100644
--- a/libssh/channels.c
+++ b/libssh/channels.c
@@ -329,7 +329,8 @@ error:
}
/** @internal
- * @brief parse a channel-related packet to resolve it to a ssh_channel.
+ * @brief parse a channel-related packet to resolve it to a ssh_channel. Works on SSH1
+ * sessions too.
* @param session current SSH session.
* @param packet buffer to parse packet from. The read pointer will be moved after
* the call.
@@ -339,7 +340,11 @@ error:
static ssh_channel channel_from_msg(ssh_session session, ssh_buffer packet) {
ssh_channel channel;
uint32_t chan;
-
+#ifdef WITH_SSH1
+ /* With SSH1, the channel is always the first one */
+ if(session->version==1)
+ return session->channels;
+#endif
if (buffer_get_u32(packet, &chan) != sizeof(uint32_t)) {
ssh_set_error(session, SSH_FATAL,
"Getting channel from message: short read");
@@ -1052,7 +1057,7 @@ void channel_set_blocking(ssh_channel channel, int blocking) {
/** @internal
* @brief handle a SSH_CHANNEL_SUCCESS packet and set the channel
- * state.
+ * state. Also works on SSH1 sessions.
*/
SSH_PACKET_CALLBACK(ssh_packet_channel_success){
ssh_channel channel;
@@ -1083,7 +1088,7 @@ SSH_PACKET_CALLBACK(ssh_packet_channel_success){
/** @internal
* @brief handle a SSH_CHANNEL_FAILURE packet and set the channel
- * state.
+ * state. Also works on SSH1 sessions.
*/
SSH_PACKET_CALLBACK(ssh_packet_channel_failure){
ssh_channel channel;