www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: [libssh2] #233: libssh2 _libssh2_packet_add() in packet.c not responding properly to SSH_MSG_CHANNEL_REQUEST for openssh keepalive

[libssh2] #233: libssh2 _libssh2_packet_add() in packet.c not responding properly to SSH_MSG_CHANNEL_REQUEST for openssh keepalive

From: libssh2 Trac <trac_at_libssh2.stuge.se>
Date: Tue, 03 Jan 2012 21:35:17 -0000

#233: libssh2 _libssh2_packet_add() in packet.c not responding properly to
SSH_MSG_CHANNEL_REQUEST for openssh keepalive
----------------------+--------------------
 Reporter: engstrom | Owner:
     Type: defect | Status: new
 Priority: normal | Milestone: 1.4.0
Component: protocol | Version: 1.3.0
 Keywords: | Blocked By:
   Blocks: |
----------------------+--------------------
 Line 750 of packet.c is handling case SSH_MSG_CHANNEL_REQUEST:

 When keepalives are configured on an OpenSSH sshd there is no want_reply
 being sent. According to RFC 4254 a channel request has a default want
 reply of TRUE but line 754 of packet.c defaults the want reply to FALSE.
 I changing 754 from:

 unsigned char want_reply = 0;

 to:

 unsigned char want_reply = 1;

 Fixes the problem. Since the OpenSSH daemon is a very common ssh server
 then regardless of whether it's correctly interpreting the RFC the libssh2
 client library should support the way it send keepalives.

 Here's the section of the RFC dealing with channel requests - NOTE how it
 says "If 'want reply' is FALSE, no response will be sent to the request.
 Otherwise, the recipient responds with either SSH_MSG_CHANNEL_SUCCESS,
 SSH_MSG_CHANNEL_FAILURE, or request-specific continuation messages"
 implying that if the want reply isn't sent then the client should respond.
 :

 From 5.4. Channel-Specific Requests

 All channel-specific requests use the following format.

       byte SSH_MSG_CHANNEL_REQUEST
       uint32 recipient channel
       string request type in US-ASCII characters only
       boolean want reply
       .... type-specific data follows

    If 'want reply' is FALSE, no response will be sent to the request.
    Otherwise, the recipient responds with either
    SSH_MSG_CHANNEL_SUCCESS, SSH_MSG_CHANNEL_FAILURE, or request-specific
    continuation messages. If the request is not recognized or is not
    supported for the channel, SSH_MSG_CHANNEL_FAILURE is returned.

-- 
Ticket URL: <http://trac.libssh2.org/ticket/233>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-01-03

the libssh2 team