Subject: [libssh2] [ libssh2-Bugs-1916627 ] Response to keepalive@openssh.com

[libssh2] [ libssh2-Bugs-1916627 ] Response to keepalive@openssh.com

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Mon, 17 Mar 2008 05:10:41 -0700

Bugs item #1916627, was opened at 2008-03-17 05:10
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=1916627&group_id=125852

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Response to keepalive_at_openssh.com

Initial Comment:
Version 0.18 does not response to keepalive_at_openssh.com message. Here is some code you could add to make it work. (based on what PuTTY does...)

        case SSH_MSG_CHANNEL_REQUEST:
            {
                if (libssh2_ntohu32(data + 5) == sizeof("exit-status") - 1
                    && !memcmp("exit-status", data + 9,
                    sizeof("exit-status") - 1)) {

                        /* we've got "exit-status" packet. Set the session value */
                        session->packAdd_channel =
                            libssh2_channel_locate(session,
                            libssh2_ntohu32(data + 1));

                        if (session->packAdd_channel) {
                            session->packAdd_channel->exit_status =
                                libssh2_ntohu32(data + 9 + sizeof("exit-status"));
                            _libssh2_debug(session, LIBSSH2_DBG_CONN,
                                "Exit status %lu received for channel %lu/%lu",
                                session->packAdd_channel->exit_status,
                                session->packAdd_channel->local.id,
                                session->packAdd_channel->remote.id);
                        }

                        LIBSSH2_FREE(session, data);
                        session->packAdd_state = libssh2_NB_state_idle;
                        return 0;
                }
                else if(libssh2_ntohu32(data+5) == sizeof("keepalive_at_openssh.com")-1 &&
                    !memcmp("keepalive_at_openssh.com", data+9, sizeof("keepalive_at_openssh.com")-1))
                {
                    libssh2_channel_send_keepalive(session->packAdd_channel);
                    LIBSSH2_FREE(session, data);
                    session->packAdd_state = libssh2_NB_state_idle;
                    return 0;
                }
            }
            break;

LIBSSH2_API int
libssh2_channel_send_keepalive(LIBSSH2_CHANNEL * channel)
{
    LIBSSH2_SESSION *session = channel->session;
    unsigned char packet[5]; /* packet_type(1) + channelno(4) */
    int rc;
    _libssh2_debug(session, LIBSSH2_DBG_CONN, "Sending Keepalive on channel %lu/%lu",
                   channel->local.id, channel->remote.id);
    packet[0] = SSH_MSG_CHANNEL_FAILURE;
    libssh2_htonu32(packet + 1, channel->remote.id);
    rc = libssh2_packet_write(session, packet, 5);
    if (rc == PACKET_EAGAIN) {
        return PACKET_EAGAIN;
    } else if (rc) {
        libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND,
                      "Unable to send Keepalive on channel", 0);
        return -1;
    }
    //channel->local.eof = 1;
    return 0;
}

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=1916627&group_id=125852

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
Received on 2008-03-17