From libssh2-devel-bounces@cool.haxx.se  Mon May  2 00:22:02 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p41MLcC4020744;
	Mon, 2 May 2011 00:21:58 +0200
Received: from mail-px0-f182.google.com (mail-px0-f182.google.com
	[209.85.212.182])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p41MLZsT020603
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Mon, 2 May 2011 00:21:37 +0200
Received: by pxi20 with SMTP id 20so1608922pxi.13
	for <libssh2-devel@cool.haxx.se>; Sun, 01 May 2011 15:21:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:date:message-id:subject:from:to
	:content-type; bh=gYESgrrVtkVRA8aqYe4+kstnP1Qx4h31aXYep0QuXTc=;
	b=YzgYJ7secbc3LcDnF+pYPGqQUfEu0/A7E9Y7TSzvX3uM9BRC2v2SiLxLDePoph/UUm
	tyJRlYbXDNHjUf1FqaT/5DWwZH0Bn3qtqgcEm0FdDH1YcX7pK/Tl9aWOJXiJGPXge0kS
	5mxjMFGh8JhtQvCNdaKEZDcGCMZhEP8Gnxo0U=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=tTHvc7Am5YrxHN8iBly/XmWEv0elxCHyUFIgt8DAPLz12tuxZb888xkAcZ9WtwLYxT
	H9Zz7S6baL2PoLQjUt48CzsmE3fImZCRymQy6DYwagLKlKGenGDobQ1I7Xv9BLWkhUl2
	XYqZzMYwB2d33PoEi9tiEF8bbMEPUnolqZajA=
MIME-Version: 1.0
Received: by 10.68.8.225 with SMTP id u1mr5408439pba.409.1304288497300; Sun,
	01 May 2011 15:21:37 -0700 (PDT)
Received: by 10.68.40.198 with HTTP; Sun, 1 May 2011 15:21:37 -0700 (PDT)
Date: Sun, 1 May 2011 15:21:37 -0700
Message-ID: <BANLkTimCJaaAa6UYusBu8cGhEu8OTd2dyg@mail.gmail.com>
Subject: Attempting to wrap sftp in Qt
From: Mark Roden <mmroden@gmail.com>
To: libssh2-devel@cool.haxx.se
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Mon, 02 May 2011 00:22:02 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Mon, 02 May 2011 00:21:37 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

Hi all,

I'm getting an error with trying to copy a file using sftp with
libssh2 from a windows 7 machine to a linux machine using libssh2.
The error number is 2, and from this thread here:
https://bugs.launchpad.net/paramiko/+bug/492238, there's a suggestion
that it might be a permissions error.  But it's still a problem, and
I'm hoping for some help here.

My test code looks like this:

    SSHFunctions theFunctions;
    QString hostname = "<IPAddress>";
    QString username = "<username>";
    QString pass = "<password>";
    bool isConnected = theFunctions.StartSession(hostname, username, pass, 222);
    QVERIFY2(isConnected, "Unable to log in as <username>");

    bool isInIncoming = theFunctions.ChangeDirectory("/incoming");
    QVERIFY2(isInIncoming, "Unable to change to the incoming directory");

    //create a garbage file
    int theGarbageSize = 1024;
    QByteArray theGarbage(1024, 100);
    for (int i = 0; i < theGarbageSize; i++){
        theGarbage[i] = rand()%256;
    }
    //write the garbage to a local directory
    QFile theGarbageFile("testgarbage.txt");
    bool canOpenFile = theGarbageFile.open(QIODevice::ReadWrite |
QIODevice::Text);
    QVERIFY2(canOpenFile, "Unable to open garbage test file");

    bool wroteTestFile = theGarbageFile.write(theGarbage);
    QVERIFY2(wroteTestFile, "Unable to write to the garbage test file");

    theGarbageFile.close();
    bool wroteToTheRemote =
theFunctions.PutFile(theGarbageFile.fileName(),
"/home/audrey/incoming/garbage.txt");
    QVERIFY2(wroteToTheRemote, "Unable to put file");

Essentially, I'm creating a garbage file, going to send it, and then
retrieving it to make sure that everything's working.  Logging in is
done by code that looks very similar to the example code, because it's
copied from the example code.

The line that fails is:


        sftp_handle =
            libssh2_sftp_open_ex(sftp_session,
theSendRemotePath.data(), theSendRemotePath.size(),
                          LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC,
                                 LIBSSH2_SFTP_S_IFREG,LIBSSH2_SFTP_OPENFILE);

and the login code looks like:


bool SFTPSession::LogIn(const QString& inHostName, const int& inPort,
                        const QString& inUsername, const QString& inPass)
{

#ifdef WIN32
    WSADATA wsadata;

    WSAStartup(MAKEWORD(2,0), &wsadata);
#endif

    int sock, auth_pw = 1, rc;
    struct sockaddr_in sin;

    unsigned long hostaddr;
    //if you don't do .data on a toAscii, then you'll get some
    //garbage about Ubuntu in your strings instead
    QByteArray theHostNameArray = inHostName.toAscii();
    hostaddr = inet_addr(theHostNameArray.data());

    QByteArray theUsername = inUsername.toAscii();
    const char* username = theUsername.data();
    QByteArray thePassword = inPass.toAscii();
    const char* password = thePassword.data();

    rc = libssh2_init (0);

    if (rc != 0) {
        fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
        return false;
    }

    /*
     * The application code is responsible for creating the socket
     * and establishing the connection
     */
    sock = socket(AF_INET, SOCK_STREAM, 0);

    sin.sin_family = AF_INET;
    sin.sin_port = htons(inPort);
    sin.sin_addr.s_addr = hostaddr;
    if (connect(sock, (struct sockaddr*)(&sin),
            sizeof(struct sockaddr_in)) != 0) {
        fprintf(stderr, "failed to connect!\n");
        return false;
    }

    /* Create a session instance
     */
    ssh_session = libssh2_session_init();

    if(!ssh_session){
        fprintf(stderr, "Unable to start ssh_session");
        return false;
    }

    /* ... start it up. This will trade welcome banners, exchange keys,
     * and setup crypto, compression, and MAC layers
     */
    rc = libssh2_session_startup(ssh_session, sock);

    if(rc) {
        fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
        return false;
    }

    /* At this point we havn't yet authenticated.  The first thing to do
     * is check the hostkey's fingerprint against our known hosts Your app
     * may have it hard coded, may go to a file, may present it to the
     * user, that's your call
     */
    const char* fingerprint = libssh2_hostkey_hash(ssh_session,
LIBSSH2_HOSTKEY_HASH_SHA1);

    mFingerprint.fromAscii(fingerprint, 40);

    printf("Fingerprint: ");
    for(int i = 0; i < 20; i++) {
        fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
    }
    printf("\n");

    if (auth_pw) {
        /* We could authenticate via password */
        if (libssh2_userauth_password(ssh_session, username, password)) {

            libssh2_session_disconnect(ssh_session,  "Authentication
by password failed\n");
            libssh2_session_free(ssh_session);
            ssh_session = NULL;
            return false;
        }
    } else {
        /* Or by public key */
        if (libssh2_userauth_publickey_fromfile(ssh_session, username,

                            "/home/username/.ssh/id_rsa.pub",
                            "/home/username/.ssh/id_rsa",
                            password)) {
            libssh2_session_disconnect(ssh_session,  "Authentication
by public key failed\n");
            libssh2_session_free(ssh_session);
            ssh_session = NULL;
            return false;
        }
    }

    fprintf(stderr, "libssh2_sftp_init()!\n");
    if (ssh_session == NULL){
        return false;
    }
    sftp_session = libssh2_sftp_init(ssh_session);


    if (!sftp_session) {
        libssh2_session_disconnect(ssh_session,  "Unable to init SFTP
session\n");
        libssh2_session_free(ssh_session);
        return false;
    }

    /* Since we have not set non-blocking, tell libssh2 we are blocking */
    libssh2_session_set_blocking(ssh_session, 1);

    return true;
}



Any thoughts here?

Thanks!
Mark
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon May  2 07:29:05 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p425Sirn005319;
	Mon, 2 May 2011 07:29:02 +0200
Received: from smtp02.local (mail.sss.co.nz [202.36.44.228])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p425SdsE005268
	for <libssh2-devel@cool.haxx.se>; Mon, 2 May 2011 07:28:41 +0200
Message-ID: <4DBE40D6.9010703@securitease.com>
Date: Mon, 02 May 2011 17:27:50 +1200
From: Matt Lilley <matt.lilley@securitease.com>
MIME-Version: 1.0
To: libssh2-devel@cool.haxx.se, Mike Elston <mike.elston@securitease.com>
Subject: timeouts in libssh2 blocking-mode
Content-Type: multipart/mixed; boundary="------------000503040209090300030305"
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Mon, 02 May 2011 07:29:05 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Mon, 02 May 2011 07:28:42 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

This is a multi-part message in MIME format.

--------------000503040209090300030305
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Hello,

We've been using libssh2 for a while in some internal tests. It 
generally works very well, but there's an annoying problem where badly 
behaved ssh servers can cause lockups inside libssh2. Jan Van Boghout 
posted some patches to implement a simple workaround for this last year 
(http://www.libssh2.org/mail/libssh2-devel-archive-2010-02/0073.shtml), 
and I see there's a bug (http://trac.libssh2.org/ticket/160) for it as 
well, currently partially complete but not fully integrated (and now 
almost a year old)

I've attached an updated patch against the tip of the master git 
repository which preserves the recently added keepalive support, while 
ensuring in the end we don't block forever. While the keepalive support 
works very well after the session is established, until that point, it 
seems that sending keepalives will cause the server to boot us off; that 
means we are exposed to potential endless blocking during a session 
creation.

Since I'm new to the mailing list, I may have missed recent discussion, 
but the bug hasn't really moved in a year, so I thought it might be 
worth reinvorigating debate - comments very welcome.

Regards,
Matt

-- 
_____________________________________________
Matt Lilley
Software Engineer
SecuritEase

Tel:    +64 4 912-2100
Fax:    +64 4 912-2101
E-mail: matt.lilley@securitease.com
Web:    http://www.securitease.com
_____________________________________________

This e-mail has passed our content security scan.
It is covered by the confidentiality clauses at http://www.securitease.com/content_and_confidentiality


--------------000503040209090300030305
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; 
    name="0001-Implement-timeout-as-per-Jan-Van-Boghout-s-suggestio.patch"
Content-Disposition: attachment; 
    filename*0="0001-Implement-timeout-as-per-Jan-Van-Boghout-s-suggestio.pa";
     filename*1="tch"

From 2acaa39fd4681f505b62dc4faf34c23d3d4c4ca3 Mon Sep 17 00:00:00 2001
From: Matt Lilley <matt.lilley@securitease.com>
Date: Mon, 2 May 2011 17:21:19 +1200
Subject: [PATCH] Implement timeout as per Jan Van Boghout's suggestion in 2010

---
 include/libssh2.h  |    4 ++++
 src/libssh2_priv.h |    3 +++
 src/session.c      |   43 ++++++++++++++++++++++++++++++++++++++-----
 3 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/include/libssh2.h b/include/libssh2.h
index e207411..9462360 100644
--- a/include/libssh2.h
+++ b/include/libssh2.h
@@ -705,6 +705,10 @@ LIBSSH2_API int libssh2_session_get_blocking(LIBSSH2_SESSION* session);
 LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel,
                                               int blocking);
 
+LIBSSH2_API void libssh2_session_set_timeout(LIBSSH2_SESSION* session,
+                                             long timeout);
+LIBSSH2_API long libssh2_session_get_timeout(LIBSSH2_SESSION* session);
+
 /* libssh2_channel_handle_extended_data is DEPRECATED, do not use! */
 LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel,
                                                       int ignore_mode);
diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h
index 231401e..5a697c7 100644
--- a/src/libssh2_priv.h
+++ b/src/libssh2_priv.h
@@ -559,6 +559,9 @@ struct _LIBSSH2_SESSION
     /* this is set to TRUE if a blocking API behavior is requested */
     int api_block_mode;
 
+    /* Timeout used when blocking API behavior is active */
+    long api_timeout;
+
     /* Server's public key */
     const LIBSSH2_HOSTKEY_METHOD *hostkey;
     void *server_hostkey_abstract;
diff --git a/src/session.c b/src/session.c
index e4714e8..cc5e23a 100644
--- a/src/session.c
+++ b/src/session.c
@@ -481,6 +481,7 @@ libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)),
         session->free = local_free;
         session->realloc = local_realloc;
         session->abstract = abstract;
+        session->api_timeout = 0; /* timeout-free API by default */
         session->api_block_mode = 1; /* blocking API by default */
         _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
                        "New session resource allocated");
@@ -547,6 +548,7 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
     int rc;
     int seconds_to_next;
     int dir;
+    int has_timeout;
 
     /* since libssh2 often sets EAGAIN internally before this function is
        called, we can decrease some amount of confusion in user programs by
@@ -592,8 +594,19 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
             fd_set *readfd = NULL;
             struct timeval tv;
 
-            tv.tv_sec = seconds_to_next;
-            tv.tv_usec = 0;
+            if (seconds_to_next > 0) {
+                tv.tv_sec = seconds_to_next;
+                tv.tv_usec = 0;
+                has_timeout = 1;
+            } else if (session->api_timeout > 0) {
+                /* Seconds */
+                tv.tv_sec = session->api_timeout / 1000;
+                /* Microseconds */
+                tv.tv_usec = (session->api_timeout % 1000) * 1000;
+                has_timeout = 1;
+            } else {
+                has_timeout = 0;
+            }
 
             if(dir & LIBSSH2_SESSION_BLOCK_INBOUND) {
                 FD_ZERO(&rfd);
@@ -607,10 +620,8 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
                 writefd = &wfd;
             }
 
-            /* Note that this COULD be made to use a timeout that perhaps
-               could be customizable by the app or something... */
             rc = select(session->socket_fd + 1, readfd, writefd, NULL,
-                        seconds_to_next ? &tv : NULL);
+                        has_timeout ? &tv : NULL);
 #endif
         }
     }
@@ -1281,6 +1292,28 @@ libssh2_session_get_blocking(LIBSSH2_SESSION * session)
     return session->api_block_mode;
 }
 
+
+/* libssh2_session_set_timeout
+ *
+ * Set a session's timeout (in msec) for blocking mode, 
+ * or 0 to disable timeouts.
+ */
+LIBSSH2_API void
+libssh2_session_set_timeout(LIBSSH2_SESSION * session, long timeout)
+{
+    session->api_timeout = timeout;
+}
+
+/* libssh2_session_get_timeout
+ *
+ * Returns a session's timeout, or 0 if disabled
+ */
+LIBSSH2_API long
+libssh2_session_get_timeout(LIBSSH2_SESSION * session)
+{
+    return session->api_timeout;
+}
+
 /*
  * libssh2_poll_channel_read
  *
-- 
1.7.2.3.msysgit.0


--------------000503040209090300030305
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--------------000503040209090300030305--

From libssh2-devel-bounces@cool.haxx.se  Mon May  2 08:33:57 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p426XY2c008422;
	Mon, 2 May 2011 08:33:54 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.181.44.140])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with SMTP id p426XXZK008416
	for <libssh2-devel@cool.haxx.se>; Mon, 2 May 2011 08:33:33 +0200
Received: (qmail 20481 invoked by uid 501); 2 May 2011 06:33:35 -0000
Message-ID: <20110502063335.20480.qmail@stuge.se>
Date: Mon, 2 May 2011 08:33:35 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: timeouts in libssh2 blocking-mode
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <4DBE40D6.9010703@securitease.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <4DBE40D6.9010703@securitease.com>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Mon, 02 May 2011 08:33:57 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Mon, 02 May 2011 08:33:34 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

Matt Lilley wrote:
> badly behaved ssh servers can cause lockups inside libssh2
> http://trac.libssh2.org/ticket/160
..
> I've attached an updated patch against the tip of the master git
> repository which preserves the recently added keepalive support,
> while ensuring in the end we don't block forever.

Nice!


> Since I'm new to the mailing list, I may have missed recent
> discussion,

No discussion.


> but the bug hasn't really moved in a year, so I thought it might be
> worth reinvorigating debate - comments very welcome.

I'm happy to commit this. I would like to touch up the commit message
slightly however. In particular it should include some variation of
"fixes #160" so that the ticket gets closed.


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon May  2 09:06:36 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4276RWC027938;
	Mon, 2 May 2011 09:06:35 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4276Q2Q027927; 
	Mon, 2 May 2011 09:06:26 +0200
Date: Mon, 2 May 2011 09:06:26 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: timeouts in libssh2 blocking-mode
In-Reply-To: <4DBE40D6.9010703@securitease.com>
Message-ID: <alpine.DEB.2.00.1105020902200.22668@tvnag.unkk.fr>
References: <4DBE40D6.9010703@securitease.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Mon, 02 May 2011 09:06:36 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Mon, 02 May 2011 09:06:27 +0200 (CEST)
Cc: Mike Elston <mike.elston@securitease.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Mon, 2 May 2011, Matt Lilley wrote:

> I've attached an updated patch against the tip of the master git repository

I would prefer to have the timeout value to be the max time allowed for the 
libssh2 function to stay blocked rather than this approach which sets the 
maximum time for each individual select(). That will make it a lot more 
deterministic and understandable to users.

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon May  2 09:14:49 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p427Ekr0030905;
	Mon, 2 May 2011 09:14:48 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p427EjVH030898
	for <libssh2-devel@cool.haxx.se>; Mon, 2 May 2011 09:14:45 +0200
Date: Mon, 2 May 2011 09:14:45 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: Attempting to wrap sftp in Qt
In-Reply-To: <BANLkTimCJaaAa6UYusBu8cGhEu8OTd2dyg@mail.gmail.com>
Message-ID: <alpine.DEB.2.00.1105020912480.22668@tvnag.unkk.fr>
References: <BANLkTimCJaaAa6UYusBu8cGhEu8OTd2dyg@mail.gmail.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Mon, 02 May 2011 09:14:49 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Mon, 02 May 2011 09:14:45 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Sun, 1 May 2011, Mark Roden wrote:

> I'm getting an error with trying to copy a file using sftp with
> libssh2 from a windows 7 machine to a linux machine using libssh2.
> The error number is 2

which error number?

> and from this thread here:

I failed to see how that was relevant to libssh2. Maybe I'm just dense.

> The line that fails is:
>
>
>        sftp_handle =
>            libssh2_sftp_open_ex(sftp_session,
> theSendRemotePath.data(), theSendRemotePath.size(),
>                          LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC,
>                                 LIBSSH2_SFTP_S_IFREG,LIBSSH2_SFTP_OPENFILE);

And that returns NULL and you then call libssh2_sftp_last_error() which 
returns 2?

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon May  2 17:58:30 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42FvuQB023132;
	Mon, 2 May 2011 17:58:25 +0200
Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com
	[209.85.160.54])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42Fvrmu023024
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Mon, 2 May 2011 17:57:55 +0200
Received: by pwj8 with SMTP id 8so3322770pwj.41
	for <libssh2-devel@cool.haxx.se>; Mon, 02 May 2011 08:57:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type:content-transfer-encoding;
	bh=YjrX/EG+Ht+MG5xNkT56f/cuJv2gi/nnZbXbcuv2MpI=;
	b=dqZ/AyIgZ+2ReulClwqQnScwFoElvE20avJMenYrYWdkYbYRTrDenuMY6fLpJctVpL
	NGShAOmG/FvhAWntZZWXQzkTUl8PvB7X/91g+U6l6MU7/gWvhz3QbW1ZUjRQnjYRlRVm
	qlTptMxRZRC16ZgIpDBq9FUXVeq/AXdEekw4I=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:content-type:content-transfer-encoding;
	b=W2MydHo8BVOisv2L33uR3gg1kprShcoHxpzc3E9vfbvpsdbRHJkEa7UjPVGhhd+iw5
	E3aMLesqyrwKWOl9tFNhiQ3H4SdGHr8gah2Oc14zinfcKKlz2fv1EDA0EqTnkY188gP0
	sRSXAEwyYG3hGgO0KnPInuCFMI32JZzWFk72w=
MIME-Version: 1.0
Received: by 10.68.8.225 with SMTP id u1mr6280654pba.409.1304351872923; Mon,
	02 May 2011 08:57:52 -0700 (PDT)
Received: by 10.68.40.198 with HTTP; Mon, 2 May 2011 08:57:52 -0700 (PDT)
In-Reply-To: <alpine.DEB.2.00.1105020912480.22668@tvnag.unkk.fr>
References: <BANLkTimCJaaAa6UYusBu8cGhEu8OTd2dyg@mail.gmail.com>
	<alpine.DEB.2.00.1105020912480.22668@tvnag.unkk.fr>
Date: Mon, 2 May 2011 08:57:52 -0700
Message-ID: <BANLkTikAb4HJC-RfUTeVMawapBLaKaSkBw@mail.gmail.com>
Subject: Re: Attempting to wrap sftp in Qt
From: Mark Roden <mmroden@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Mon, 02 May 2011 17:58:30 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Mon, 02 May 2011 17:57:55 +0200 (CEST)
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id
	p42Fvrmu023024
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="iso-8859-1"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id p42FvuQB023132

On Mon, May 2, 2011 at 12:14 AM, Daniel Stenberg <daniel@haxx.se> wrote:
> On Sun, 1 May 2011, Mark Roden wrote:
>
>> I'm getting an error with trying to copy a file using sftp with
>> libssh2 from a windows 7 machine to a linux machine using libssh2.
>> The error number is 2
>
> which error number?

Sorry, I don't think I was specific enough about the libssh2-ness.

From debugging into the libssh2_sftp_open_ex, I get into sftp_open.
From there, I get to

        rc = sftp_packet_requirev(sftp, 2, fopen_responses,
                                  sftp->open_request_id, &data,
                                  &data_len);

(line 946 of sftp.c)

Inside that function is a while statement on line 391 of sftp.c.  The
while statement executes once, apparently with no initial return, and
then on the second go-through, the second valid response if statement
is entered on line 393.

Essentially, the server returns an error code, '2'.

Back out into the sftp_open function, that causes the 'badness' flag
to be set to 1 (line 965), presumably because that's not a good
response (the comment indicates that it's a 'status' response, which
is generally bad).

No handle is created as a result.
>
>> and from this thread here:
>
> I failed to see how that was relevant to libssh2. Maybe I'm just dense.

I don't know if it's a libssh2 error or not.  I do know that I can
upload files via an sftp client using the same username/password, so I
suspect that I've misconfigured the connection somehow.  I also know
that I can get a directory listing (as per the example code), I just
can't seem to be able to write using sftp.  I tried using the exact
code from the sftp write example, and that gave the same result.  I've
started experimenting with the flags, but I do believe that
something's been incorrectly set up during the establishment of the
connection, and was hoping for some insight there.

>
>> The line that fails is:
>>
>>
>>       sftp_handle =
>>           libssh2_sftp_open_ex(sftp_session,
>> theSendRemotePath.data(), theSendRemotePath.size(),
>>
>> LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC,
>>
>>  LIBSSH2_SFTP_S_IFREG,LIBSSH2_SFTP_OPENFILE);
>
> And that returns NULL and you then call libssh2_sftp_last_error() which
> returns 2?

I traced the error, as described above.  I haven't figured out how to
see fprintf's from Qt's debugging interface in their designer.

Thanks,
Mark

>
> --
>
>  / daniel.haxx.se
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon May  2 20:42:17 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42IftO0012863;
	Mon, 2 May 2011 20:42:14 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.181.44.140])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with SMTP id p42IfsX5012848
	for <libssh2-devel@cool.haxx.se>; Mon, 2 May 2011 20:41:55 +0200
Received: (qmail 28214 invoked by uid 501); 2 May 2011 18:42:00 -0000
Message-ID: <20110502184200.28213.qmail@stuge.se>
Date: Mon, 2 May 2011 20:42:00 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: Attempting to wrap sftp in Qt
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <BANLkTimCJaaAa6UYusBu8cGhEu8OTd2dyg@mail.gmail.com>
	<alpine.DEB.2.00.1105020912480.22668@tvnag.unkk.fr>
	<BANLkTikAb4HJC-RfUTeVMawapBLaKaSkBw@mail.gmail.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <BANLkTikAb4HJC-RfUTeVMawapBLaKaSkBw@mail.gmail.com>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Mon, 02 May 2011 20:42:17 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Mon, 02 May 2011 20:41:55 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

Mark Roden wrote:
> Essentially, the server returns an error code, '2'.

The server sometimes also returns a text message.

If this is indeed the error code from the server then it should be
well defined in the SFTP spec. Likewise the error message may provide
hints on what is going wrong.

Both the error code and the error message are retrievable using
libssh2 API after libssh2_sftp_open (or another function call) fails.


> I don't know if it's a libssh2 error or not.

Is the home directory for your user writable by the user? Maybe there
is just a path missing somewhere to specify the upload directory.


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon May  2 21:42:32 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42JgAXd025079;
	Mon, 2 May 2011 21:42:29 +0200
Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com
	[74.125.83.182])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42Jg6ui024777
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Mon, 2 May 2011 21:42:08 +0200
Received: by pvg11 with SMTP id 11so4121137pvg.41
	for <libssh2-devel@cool.haxx.se>; Mon, 02 May 2011 12:42:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type;
	bh=0rDUQK2fPFf+moMnajf5wVExwT5H2WMzFB/WNhmHxkM=;
	b=w0Yyjgq+NHFvXOda1OBi0xa5UR31TiAIlzZph9O8ov00/fFeTPzEi9b+0fVb1Opp7l
	X2WHpHQ/5AUsefSg28gfVPgj54i/2VOJR+FKsRqk0NWGuy/1mi5nmCeFHweQT5ByOuTD
	VLl3x1d+tpi5y72IfIz7t9rOAo+Eyt5e8uuFI=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:content-type;
	b=CjWxmXROG60Xo0v3sORe6iHuEnVTpEq/pT5Va41xh3z/iihu2YaSma3UGYusYqhkOH
	QuCDGtR2iyqr3Cn+S30VKT5koQYiIH+KuWZuFXw0OWroSz/+fmKM5KAEHpty7egZm1yE
	R9idEzJLKv1s0/G7xD76eK/IF7/ZRxRa7lTrM=
MIME-Version: 1.0
Received: by 10.68.8.225 with SMTP id u1mr6515738pba.409.1304365324471; Mon,
	02 May 2011 12:42:04 -0700 (PDT)
Received: by 10.68.40.198 with HTTP; Mon, 2 May 2011 12:42:04 -0700 (PDT)
In-Reply-To: <20110502184200.28213.qmail@stuge.se>
References: <BANLkTimCJaaAa6UYusBu8cGhEu8OTd2dyg@mail.gmail.com>
	<alpine.DEB.2.00.1105020912480.22668@tvnag.unkk.fr>
	<BANLkTikAb4HJC-RfUTeVMawapBLaKaSkBw@mail.gmail.com>
	<20110502184200.28213.qmail@stuge.se>
Date: Mon, 2 May 2011 12:42:04 -0700
Message-ID: <BANLkTi=Pt+URML8XOW0mkCirvAcaFXSjmg@mail.gmail.com>
Subject: Re: Attempting to wrap sftp in Qt
From: Mark Roden <mmroden@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Mon, 02 May 2011 21:42:32 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Mon, 02 May 2011 21:42:08 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

After further testing, it appears that it worked once, and then has
stopped working.

It looks like I'm not able to overwrite the file, despite setting the flags:
LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC

The first time, the writing works, and if I delete the file from the
server using a separate session, then the writing works again.

Are there other flags or things to check so that a file can be
overwritten, some unix permission I'm not setting when the file is
initially created?

On Mon, May 2, 2011 at 11:42 AM, Peter Stuge <peter@stuge.se> wrote:
> Mark Roden wrote:
>> Essentially, the server returns an error code, '2'.
>
> The server sometimes also returns a text message.
>
> If this is indeed the error code from the server then it should be
> well defined in the SFTP spec. Likewise the error message may provide
> hints on what is going wrong.
>
> Both the error code and the error message are retrievable using
> libssh2 API after libssh2_sftp_open (or another function call) fails.
>
>
>> I don't know if it's a libssh2 error or not.
>
> Is the home directory for your user writable by the user? Maybe there
> is just a path missing somewhere to specify the upload directory.
>
>
> //Peter
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon May  2 22:14:02 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42KDqXG030745;
	Mon, 2 May 2011 22:13:59 +0200
Received: from smtp02.local (mail.sss.co.nz [202.36.44.228])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42KDmFN030663
	for <libssh2-devel@cool.haxx.se>; Mon, 2 May 2011 22:13:50 +0200
Message-ID: <4DBF104B.2010508@securitease.com>
Date: Tue, 03 May 2011 08:12:59 +1200
From: Matt Lilley <matt.lilley@securitease.com>
MIME-Version: 1.0
To: libssh2-devel@cool.haxx.se, Mike Elston <mike.elston@securitease.com>
Subject: Re: timeouts in libssh2 blocking-mode
References: <4DBE40D6.9010703@securitease.com> 
	<20110502063335.20480.qmail@stuge.se>
In-Reply-To: <20110502063335.20480.qmail@stuge.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Mon, 02 May 2011 22:14:02 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Mon, 02 May 2011 22:13:50 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se


> I'm happy to commit this. I would like to touch up the commit message
> slightly however. In particular it should include some variation of
> "fixes #160" so that the ticket gets closed.
>
>
> //Peter
Ok, that sounds fine to me. Daniel has commented that he'd prefer the 
timeout to be the maximum time that any libssh2 function can remain 
blocked, which I agree would be nice, but I'm not sure how to implement 
- I guess each entry point could reset a counter, and then the recv() 
could have a 1 second timeout, which increments this counter until it 
reaches the specified limit, at which point the function returns with a 
timeout error. This is a lot of work though; every function would have 
to be modified (or perhaps the BLOCK_ADJUST macro?) and I'm not sure 
there are significant gains - after all, the keepalive code does 
something similar to this. All I want is a safety net to prevent our 
application locking up when it connects to an ssh server that we have no 
administrative control over.

If I've missed some simple way of achieving Daniel's approach, feel free 
to point it out to me, and if I understand, I can have a go at 
implementing it.

Matt

-- 
_____________________________________________
Matt Lilley
Software Engineer
SecuritEase

Tel:    +64 4 912-2100
Fax:    +64 4 912-2101
E-mail: matt.lilley@securitease.com
Web:    http://www.securitease.com
_____________________________________________

This e-mail has passed our content security scan.
It is covered by the confidentiality clauses at http://www.securitease.com/content_and_confidentiality

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon May  2 22:38:26 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42KJXGB003084;
	Mon, 2 May 2011 22:19:35 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42KJWYo003071; 
	Mon, 2 May 2011 22:19:32 +0200
Date: Mon, 2 May 2011 22:19:32 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: timeouts in libssh2 blocking-mode
In-Reply-To: <4DBF104B.2010508@securitease.com>
Message-ID: <alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>
References: <4DBE40D6.9010703@securitease.com>
	<20110502063335.20480.qmail@stuge.se>
	<4DBF104B.2010508@securitease.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Mon, 02 May 2011 22:19:36 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Mon, 02 May 2011 22:19:32 +0200 (CEST)
Cc: Mike Elston <mike.elston@securitease.com>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Tue, 3 May 2011, Matt Lilley wrote:

> Ok, that sounds fine to me. Daniel has commented that he'd prefer the timeout 
> to be the maximum time that any libssh2 function can remain blocked, which I 
> agree would be nice, but I'm not sure how to implement

I suggest we:

A) mark the time when the function is first entered.

B) when select() is about to be called, we can check how long time that
    has elapsed since the entry time and just do the math on how long the
    select timeout may be (this time).

--

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May  3 01:27:47 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42NRQ8Q018075;
	Tue, 3 May 2011 01:27:43 +0200
Received: from smtp02.local (mail.sss.co.nz [202.36.44.228])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42NRH3u017999
	for <libssh2-devel@cool.haxx.se>; Tue, 3 May 2011 01:27:23 +0200
Message-ID: <4DBF3D9D.7080800@securitease.com>
Date: Tue, 03 May 2011 11:26:21 +1200
From: Matt Lilley <matt.lilley@securitease.com>
MIME-Version: 1.0
To: libssh2 development <libssh2-devel@cool.haxx.se>,
        Mike Elston 
	<mike.elston@securitease.com>
Subject: Re: timeouts in libssh2 blocking-mode
References: <4DBE40D6.9010703@securitease.com>	<20110502063335.20480.qmail@stuge.se>	<4DBF104B.2010508@securitease.com>
	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>
In-Reply-To: <alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>
Content-Type: multipart/mixed; boundary="------------020105070508070107040902"
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 03 May 2011 01:27:47 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 03 May 2011 01:27:24 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

This is a multi-part message in MIME format.

--------------020105070508070107040902
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=ISO-8859-1; format=flowed


> I suggest we:
>
> A) mark the time when the function is first entered.
>
> B) when select() is about to be called, we can check how long time that
>    has elapsed since the entry time and just do the math on how long the
>    select timeout may be (this time).
Ok, that seems reasonable to me. I've attached a new patch that does 
this (I think), and still passes my test cases. I assumed that because 
the macro BLOCK_ADJUST (and BLOCK_ADJUST_ERRNO) were the only places 
we'd end up in _libssh2_wait_socket, that this was as good a place as 
any to mark the entry time, and they all seem to be at the beginning of 
exposed API functions.

Any further thoughts?

Matt

>
> -- 
>
>  / daniel.haxx.se
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>


-- 
_____________________________________________
Matt Lilley
Software Engineer
SecuritEase

Tel:    +64 4 912-2100
Fax:    +64 4 912-2101
E-mail: matt.lilley@securitease.com
Web:    http://www.securitease.com
_____________________________________________

This e-mail has passed our content security scan.
It is covered by the confidentiality clauses at http://www.securitease.com/content_and_confidentiality


--------------020105070508070107040902
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; 
    name="0001-Fixes-bug-160-as-per-Daniel-s-suggestion.patch"
Content-Disposition: attachment; 
    filename="0001-Fixes-bug-160-as-per-Daniel-s-suggestion.patch"

From dae57c891dd99cff7b8811b05a39593f9237ba55 Mon Sep 17 00:00:00 2001
From: Matt Lilley <matt.lilley@securitease.com>
Date: Tue, 3 May 2011 11:20:24 +1200
Subject: [PATCH] Fixes bug #160 as per Daniel's suggestion

---
 include/libssh2.h  |    4 ++++
 src/libssh2_priv.h |    3 +++
 src/session.c      |   51 +++++++++++++++++++++++++++++++++++++++++++++------
 src/session.h      |   19 ++++++++++++-------
 4 files changed, 64 insertions(+), 13 deletions(-)

diff --git a/include/libssh2.h b/include/libssh2.h
index e207411..9462360 100644
--- a/include/libssh2.h
+++ b/include/libssh2.h
@@ -705,6 +705,10 @@ LIBSSH2_API int libssh2_session_get_blocking(LIBSSH2_SESSION* session);
 LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel,
                                               int blocking);
 
+LIBSSH2_API void libssh2_session_set_timeout(LIBSSH2_SESSION* session,
+                                             long timeout);
+LIBSSH2_API long libssh2_session_get_timeout(LIBSSH2_SESSION* session);
+
 /* libssh2_channel_handle_extended_data is DEPRECATED, do not use! */
 LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel,
                                                       int ignore_mode);
diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h
index 231401e..5a697c7 100644
--- a/src/libssh2_priv.h
+++ b/src/libssh2_priv.h
@@ -559,6 +559,9 @@ struct _LIBSSH2_SESSION
     /* this is set to TRUE if a blocking API behavior is requested */
     int api_block_mode;
 
+    /* Timeout used when blocking API behavior is active */
+    long api_timeout;
+
     /* Server's public key */
     const LIBSSH2_HOSTKEY_METHOD *hostkey;
     void *server_hostkey_abstract;
diff --git a/src/session.c b/src/session.c
index e4714e8..edf98d8 100644
--- a/src/session.c
+++ b/src/session.c
@@ -481,6 +481,7 @@ libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)),
         session->free = local_free;
         session->realloc = local_realloc;
         session->abstract = abstract;
+        session->api_timeout = 0; /* timeout-free API by default */
         session->api_block_mode = 1; /* blocking API by default */
         _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
                        "New session resource allocated");
@@ -542,11 +543,12 @@ libssh2_session_callback_set(LIBSSH2_SESSION * session,
  * Utility function that waits for action on the socket. Returns 0 when ready
  * to run again or error on timeout.
  */
-int _libssh2_wait_socket(LIBSSH2_SESSION *session)
+int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t start_time)
 {
     int rc;
     int seconds_to_next;
     int dir;
+    int has_timeout;
 
     /* since libssh2 often sets EAGAIN internally before this function is
        called, we can decrease some amount of confusion in user programs by
@@ -592,8 +594,25 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
             fd_set *readfd = NULL;
             struct timeval tv;
 
-            tv.tv_sec = seconds_to_next;
-            tv.tv_usec = 0;
+            if (seconds_to_next > 0) {
+                tv.tv_sec = seconds_to_next;
+                tv.tv_usec = 0;
+                has_timeout = 1;
+            } else if (session->api_timeout > 0) {
+                time_t now = time (NULL);
+                long elapsed_ms = (long)(1000*difftime(start_time, now));                
+                if (elapsed_ms > session->api_timeout) {
+                    session->err_code = LIBSSH2_ERROR_TIMEOUT;
+                    return LIBSSH2_ERROR_TIMEOUT;
+                }
+                /* Seconds */
+                tv.tv_sec = (session->api_timeout - elapsed_ms) / 1000;
+                /* Microseconds */
+                tv.tv_usec = ((session->api_timeout - elapsed_ms) % 1000) * 1000;
+                has_timeout = 1;
+            } else {
+                has_timeout = 0;
+            }
 
             if(dir & LIBSSH2_SESSION_BLOCK_INBOUND) {
                 FD_ZERO(&rfd);
@@ -607,10 +626,8 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
                 writefd = &wfd;
             }
 
-            /* Note that this COULD be made to use a timeout that perhaps
-               could be customizable by the app or something... */
             rc = select(session->socket_fd + 1, readfd, writefd, NULL,
-                        seconds_to_next ? &tv : NULL);
+                        has_timeout ? &tv : NULL);
 #endif
         }
     }
@@ -1281,6 +1298,28 @@ libssh2_session_get_blocking(LIBSSH2_SESSION * session)
     return session->api_block_mode;
 }
 
+
+/* libssh2_session_set_timeout
+ *
+ * Set a session's timeout (in msec) for blocking mode, 
+ * or 0 to disable timeouts.
+ */
+LIBSSH2_API void
+libssh2_session_set_timeout(LIBSSH2_SESSION * session, long timeout)
+{
+    session->api_timeout = timeout;
+}
+
+/* libssh2_session_get_timeout
+ *
+ * Returns a session's timeout, or 0 if disabled
+ */
+LIBSSH2_API long
+libssh2_session_get_timeout(LIBSSH2_SESSION * session)
+{
+    return session->api_timeout;
+}
+
 /*
  * libssh2_poll_channel_read
  *
diff --git a/src/session.h b/src/session.h
index 4eac3a6..c7e01e9 100644
--- a/src/session.h
+++ b/src/session.h
@@ -51,17 +51,20 @@
    function.
 
 */
-#define BLOCK_ADJUST(rc,sess,x) \
+#define BLOCK_ADJUST(rc,sess,x)          { \
+    time_t entry_time = time (NULL); \
     do { \
        rc = x; \
        /* the order of the check below is important to properly deal with the
           case when the 'sess' is freed */ \
        if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode)  \
            break; \
-       rc = _libssh2_wait_socket(sess); \
+       rc = _libssh2_wait_socket(sess, entry_time);     \
        if(rc) \
            break; \
-    } while(1)
+    } while(1); \
+}
+
 
 /*
  * For functions that returns a pointer, we need to check if the API is
@@ -69,7 +72,8 @@
  * immediately. If the API is blocking and we get a NULL we check the errno
  * and *only* if that is EAGAIN we loop and wait for socket action.
  */
-#define BLOCK_ADJUST_ERRNO(ptr,sess,x)          \
+#define BLOCK_ADJUST_ERRNO(ptr,sess,x)          { \
+    time_t entry_time = time (NULL); \
     do { \
        int rc; \
        ptr = x; \
@@ -77,13 +81,14 @@
           (ptr != NULL) || \
           (libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
            break;                                                  \
-       rc = _libssh2_wait_socket(sess); \
+       rc = _libssh2_wait_socket(sess, entry_time);                           \
        if(rc) \
            break; \
-    } while(1)
+    } while(1);   \
+}
 
 
-int _libssh2_wait_socket(LIBSSH2_SESSION *session);
+int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t entry_time);
 
 /* this is the lib-internal set blocking function */
 int _libssh2_session_set_blocking(LIBSSH2_SESSION * session, int blocking);
-- 
1.7.2.3.msysgit.0


--------------020105070508070107040902
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--------------020105070508070107040902--

From libssh2-devel-bounces@cool.haxx.se  Tue May  3 01:59:40 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p42NxVoX003230;
	Tue, 3 May 2011 01:59:39 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.181.44.140])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with SMTP id p42NxTw9003227
	for <libssh2-devel@cool.haxx.se>; Tue, 3 May 2011 01:59:29 +0200
Received: (qmail 32307 invoked by uid 501); 2 May 2011 23:59:37 -0000
Message-ID: <20110502235937.32306.qmail@stuge.se>
Date: Tue, 3 May 2011 01:59:37 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: timeouts in libssh2 blocking-mode
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <4DBE40D6.9010703@securitease.com>
	<20110502063335.20480.qmail@stuge.se>
	<4DBF104B.2010508@securitease.com>
	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>
	<4DBF3D9D.7080800@securitease.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <4DBF3D9D.7080800@securitease.com>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 03 May 2011 01:59:40 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 03 May 2011 01:59:29 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

Matt Lilley wrote:
> Ok, that seems reasonable to me. I've attached a new patch that does this 
> (I think), and still passes my test cases.

I'll let you and Daniel sort the implementation details. Just one
comment:


> +++ b/src/session.h
> @@ -51,17 +51,20 @@
>     function.
>  
>  */
> -#define BLOCK_ADJUST(rc,sess,x) \
> +#define BLOCK_ADJUST(rc,sess,x)          { \
> +    time_t entry_time = time (NULL); \
>      do { \
>         rc = x; \
>         /* the order of the check below is important to properly deal with the
>            case when the 'sess' is freed */ \
>         if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode)  \
>             break; \
> -       rc = _libssh2_wait_socket(sess); \
> +       rc = _libssh2_wait_socket(sess, entry_time);     \
>         if(rc) \
>             break; \
> -    } while(1)
> +    } while(1); \
> +}
> +

No. Using do {} while() must not change (you add braces) since it
allows the macro to successfully be used as a function in all
circumstances in C code. In this case you would add an outer
do {} while() as such:

#define BLOCK_ADJUST(rc,sess,x) { \
  do { \
    time_t entry_time ... \
    do { \
       ...
    } while(1);
  } while(0)


Also, please make sure to maintain code style (whitespace changes) in
the code that you work on. Thanks!

Btw, it doesn't make sense to have while(1) immediately preceded by a
conditional break IMO. Might as well fix that too while touching
this:

  .. while(!rc);


> @@ -69,7 +72,8 @@
>   * immediately. If the API is blocking and we get a NULL we check the errno
>   * and *only* if that is EAGAIN we loop and wait for socket action.
>   */
> -#define BLOCK_ADJUST_ERRNO(ptr,sess,x)          \
> +#define BLOCK_ADJUST_ERRNO(ptr,sess,x)          { \

Same comment as above.


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May  3 02:20:17 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p430KABo017140;
	Tue, 3 May 2011 02:20:16 +0200
Received: from smtp02.local (mail.sss.co.nz [202.36.44.228])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p430K5Zh016435
	for <libssh2-devel@cool.haxx.se>; Tue, 3 May 2011 02:20:08 +0200
Message-ID: <4DBF4A05.9050403@securitease.com>
Date: Tue, 03 May 2011 12:19:17 +1200
From: Matt Lilley <matt.lilley@securitease.com>
MIME-Version: 1.0
To: libssh2 development <libssh2-devel@cool.haxx.se>,
        Mike Elston 
	<mike.elston@securitease.com>
Subject: Re: timeouts in libssh2 blocking-mode
References: <4DBE40D6.9010703@securitease.com>	<20110502063335.20480.qmail@stuge.se>	<4DBF104B.2010508@securitease.com>	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>	<4DBF3D9D.7080800@securitease.com>
	<20110502235937.32306.qmail@stuge.se>
In-Reply-To: <20110502235937.32306.qmail@stuge.se>
Content-Type: multipart/mixed; boundary="------------060502080100020503010701"
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 03 May 2011 02:20:17 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 03 May 2011 02:20:08 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

This is a multi-part message in MIME format.

--------------060502080100020503010701
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=ISO-8859-1; format=flowed


> No. Using do {} while() must not change (you add braces) since it
> allows the macro to successfully be used as a function in all
> circumstances in C code. In this case you would add an outer
> do {} while() as such:
Ok, that's fair enough. Changed
> Also, please make sure to maintain code style (whitespace changes) in
> the code that you work on. Thanks!
I assume you're talking about the spaces between the backslash and the 
code in the macro? If so, I think I've fixed that now (I didn't notice 
my editor had done it). If it's something else, can you be more specific 
so I can fix that as well?
> Btw, it doesn't make sense to have while(1) immediately preceded by a
> conditional break IMO.
Agreed, changed.

Matt


-- 
_____________________________________________
Matt Lilley
Software Engineer
SecuritEase

Tel:    +64 4 912-2100
Fax:    +64 4 912-2101
E-mail: matt.lilley@securitease.com
Web:    http://www.securitease.com
_____________________________________________

This e-mail has passed our content security scan.
It is covered by the confidentiality clauses at http://www.securitease.com/content_and_confidentiality


--------------060502080100020503010701
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; 
    name="0001-Fixes-bug-160-as-per-Daniel-s-suggestion.patch"
Content-Disposition: attachment; 
    filename="0001-Fixes-bug-160-as-per-Daniel-s-suggestion.patch"

From 1af4d98907ac318e0cee8675306a05e4d223de65 Mon Sep 17 00:00:00 2001
From: Matt Lilley <matt.lilley@securitease.com>
Date: Tue, 3 May 2011 11:20:24 +1200
Subject: [PATCH] Fixes bug #160 as per Daniel's suggestion

---
 include/libssh2.h  |    4 ++++
 src/libssh2_priv.h |    3 +++
 src/session.c      |   51 +++++++++++++++++++++++++++++++++++++++++++++------
 src/session.h      |   44 +++++++++++++++++++++++---------------------
 4 files changed, 75 insertions(+), 27 deletions(-)

diff --git a/include/libssh2.h b/include/libssh2.h
index e207411..9462360 100644
--- a/include/libssh2.h
+++ b/include/libssh2.h
@@ -705,6 +705,10 @@ LIBSSH2_API int libssh2_session_get_blocking(LIBSSH2_SESSION* session);
 LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel,
                                               int blocking);
 
+LIBSSH2_API void libssh2_session_set_timeout(LIBSSH2_SESSION* session,
+                                             long timeout);
+LIBSSH2_API long libssh2_session_get_timeout(LIBSSH2_SESSION* session);
+
 /* libssh2_channel_handle_extended_data is DEPRECATED, do not use! */
 LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel,
                                                       int ignore_mode);
diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h
index 231401e..5a697c7 100644
--- a/src/libssh2_priv.h
+++ b/src/libssh2_priv.h
@@ -559,6 +559,9 @@ struct _LIBSSH2_SESSION
     /* this is set to TRUE if a blocking API behavior is requested */
     int api_block_mode;
 
+    /* Timeout used when blocking API behavior is active */
+    long api_timeout;
+
     /* Server's public key */
     const LIBSSH2_HOSTKEY_METHOD *hostkey;
     void *server_hostkey_abstract;
diff --git a/src/session.c b/src/session.c
index e4714e8..edf98d8 100644
--- a/src/session.c
+++ b/src/session.c
@@ -481,6 +481,7 @@ libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)),
         session->free = local_free;
         session->realloc = local_realloc;
         session->abstract = abstract;
+        session->api_timeout = 0; /* timeout-free API by default */
         session->api_block_mode = 1; /* blocking API by default */
         _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
                        "New session resource allocated");
@@ -542,11 +543,12 @@ libssh2_session_callback_set(LIBSSH2_SESSION * session,
  * Utility function that waits for action on the socket. Returns 0 when ready
  * to run again or error on timeout.
  */
-int _libssh2_wait_socket(LIBSSH2_SESSION *session)
+int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t start_time)
 {
     int rc;
     int seconds_to_next;
     int dir;
+    int has_timeout;
 
     /* since libssh2 often sets EAGAIN internally before this function is
        called, we can decrease some amount of confusion in user programs by
@@ -592,8 +594,25 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
             fd_set *readfd = NULL;
             struct timeval tv;
 
-            tv.tv_sec = seconds_to_next;
-            tv.tv_usec = 0;
+            if (seconds_to_next > 0) {
+                tv.tv_sec = seconds_to_next;
+                tv.tv_usec = 0;
+                has_timeout = 1;
+            } else if (session->api_timeout > 0) {
+                time_t now = time (NULL);
+                long elapsed_ms = (long)(1000*difftime(start_time, now));                
+                if (elapsed_ms > session->api_timeout) {
+                    session->err_code = LIBSSH2_ERROR_TIMEOUT;
+                    return LIBSSH2_ERROR_TIMEOUT;
+                }
+                /* Seconds */
+                tv.tv_sec = (session->api_timeout - elapsed_ms) / 1000;
+                /* Microseconds */
+                tv.tv_usec = ((session->api_timeout - elapsed_ms) % 1000) * 1000;
+                has_timeout = 1;
+            } else {
+                has_timeout = 0;
+            }
 
             if(dir & LIBSSH2_SESSION_BLOCK_INBOUND) {
                 FD_ZERO(&rfd);
@@ -607,10 +626,8 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
                 writefd = &wfd;
             }
 
-            /* Note that this COULD be made to use a timeout that perhaps
-               could be customizable by the app or something... */
             rc = select(session->socket_fd + 1, readfd, writefd, NULL,
-                        seconds_to_next ? &tv : NULL);
+                        has_timeout ? &tv : NULL);
 #endif
         }
     }
@@ -1281,6 +1298,28 @@ libssh2_session_get_blocking(LIBSSH2_SESSION * session)
     return session->api_block_mode;
 }
 
+
+/* libssh2_session_set_timeout
+ *
+ * Set a session's timeout (in msec) for blocking mode, 
+ * or 0 to disable timeouts.
+ */
+LIBSSH2_API void
+libssh2_session_set_timeout(LIBSSH2_SESSION * session, long timeout)
+{
+    session->api_timeout = timeout;
+}
+
+/* libssh2_session_get_timeout
+ *
+ * Returns a session's timeout, or 0 if disabled
+ */
+LIBSSH2_API long
+libssh2_session_get_timeout(LIBSSH2_SESSION * session)
+{
+    return session->api_timeout;
+}
+
 /*
  * libssh2_poll_channel_read
  *
diff --git a/src/session.h b/src/session.h
index 4eac3a6..aa022fb 100644
--- a/src/session.h
+++ b/src/session.h
@@ -53,15 +53,16 @@
 */
 #define BLOCK_ADJUST(rc,sess,x) \
     do { \
-       rc = x; \
-       /* the order of the check below is important to properly deal with the
-          case when the 'sess' is freed */ \
-       if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode)  \
-           break; \
-       rc = _libssh2_wait_socket(sess); \
-       if(rc) \
-           break; \
-    } while(1)
+       time_t entry_time = time (NULL); \
+       do { \
+          rc = x; \
+          /* the order of the check below is important to properly deal with the
+             case when the 'sess' is freed */ \
+          if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode) \
+              break; \
+          rc = _libssh2_wait_socket(sess, entry_time);  \
+       } while(rc);   \
+    } while(0)
 
 /*
  * For functions that returns a pointer, we need to check if the API is
@@ -69,21 +70,22 @@
  * immediately. If the API is blocking and we get a NULL we check the errno
  * and *only* if that is EAGAIN we loop and wait for socket action.
  */
-#define BLOCK_ADJUST_ERRNO(ptr,sess,x)          \
+#define BLOCK_ADJUST_ERRNO(ptr,sess,x) \
     do { \
-       int rc; \
-       ptr = x; \
-       if(!sess->api_block_mode || \
-          (ptr != NULL) || \
-          (libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
-           break;                                                  \
-       rc = _libssh2_wait_socket(sess); \
-       if(rc) \
-           break; \
-    } while(1)
+       time_t entry_time = time (NULL); \
+       do { \
+           int rc; \
+           ptr = x; \
+           if(!sess->api_block_mode || \
+              (ptr != NULL) || \
+              (libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
+               break; \
+           rc = _libssh2_wait_socket(sess, entry_time); \
+        } while(!rc); \
+    } while(0)
 
 
-int _libssh2_wait_socket(LIBSSH2_SESSION *session);
+int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t entry_time);
 
 /* this is the lib-internal set blocking function */
 int _libssh2_session_set_blocking(LIBSSH2_SESSION * session, int blocking);
-- 
1.7.2.3.msysgit.0


--------------060502080100020503010701
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--------------060502080100020503010701--

From libssh2-devel-bounces@cool.haxx.se  Tue May  3 02:48:33 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p430mIxd004241;
	Tue, 3 May 2011 02:48:32 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.181.44.140])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with SMTP id p430mHhl004228
	for <libssh2-devel@cool.haxx.se>; Tue, 3 May 2011 02:48:17 +0200
Received: (qmail 5080 invoked by uid 501); 3 May 2011 00:48:25 -0000
Message-ID: <20110503004825.5079.qmail@stuge.se>
Date: Tue, 3 May 2011 02:48:25 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: timeouts in libssh2 blocking-mode
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <4DBE40D6.9010703@securitease.com>
	<20110502063335.20480.qmail@stuge.se>
	<4DBF104B.2010508@securitease.com>
	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>
	<4DBF3D9D.7080800@securitease.com>
	<20110502235937.32306.qmail@stuge.se>
	<4DBF4A05.9050403@securitease.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <4DBF4A05.9050403@securitease.com>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 03 May 2011 02:48:33 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 03 May 2011 02:48:18 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

Matt Lilley wrote:
>> Btw, it doesn't make sense to have while(1) immediately preceded by a
>> conditional break IMO.
> Agreed, changed.
..
> +++ b/src/session.h
> @@ -53,15 +53,16 @@
..
> -       if(rc) \
> -           break; \
> -    } while(1)
..
> +       } while(rc);   \

I think you inverted the logic. Add the ! I wrote. :)


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May  3 03:03:13 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43137xA018555;
	Tue, 3 May 2011 03:03:12 +0200
Received: from smtp02.local (mail.sss.co.nz [202.36.44.228])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43130qo018141
	for <libssh2-devel@cool.haxx.se>; Tue, 3 May 2011 03:03:04 +0200
Message-ID: <4DBF5418.4040706@securitease.com>
Date: Tue, 03 May 2011 13:02:16 +1200
From: Matt Lilley <matt.lilley@securitease.com>
MIME-Version: 1.0
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: timeouts in libssh2 blocking-mode
References: <4DBE40D6.9010703@securitease.com>	<20110502063335.20480.qmail@stuge.se>	<4DBF104B.2010508@securitease.com>	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>	<4DBF3D9D.7080800@securitease.com>	<20110502235937.32306.qmail@stuge.se>	<4DBF4A05.9050403@securitease.com>
	<20110503004825.5079.qmail@stuge.se>
In-Reply-To: <20110503004825.5079.qmail@stuge.se>
Content-Type: multipart/mixed; boundary="------------050005080900000902000907"
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 03 May 2011 03:03:13 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 03 May 2011 03:03:05 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

This is a multi-part message in MIME format.

--------------050005080900000902000907
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Wow. I need more coffee, I think. I got one of the two, at least. 50% 
isn't bad?
> Matt Lilley wrote:
>>> Btw, it doesn't make sense to have while(1) immediately preceded by a
>>> conditional break IMO.
>> Agreed, changed.
> ..
>> +++ b/src/session.h
>> @@ -53,15 +53,16 @@
> ..
>> -       if(rc) \
>> -           break; \
>> -    } while(1)
> ..
>> +       } while(rc);   \
> I think you inverted the logic. Add the ! I wrote. :)
>
>
> //Peter
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>


-- 
_____________________________________________
Matt Lilley
Software Engineer
SecuritEase

Tel:    +64 4 912-2100
Fax:    +64 4 912-2101
E-mail: matt.lilley@securitease.com
Web:    http://www.securitease.com
_____________________________________________

This e-mail has passed our content security scan.
It is covered by the confidentiality clauses at http://www.securitease.com/content_and_confidentiality


--------------050005080900000902000907
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; 
    name="0001-Fixes-bug-160-as-per-Daniel-s-suggestion.patch"
Content-Disposition: attachment; 
    filename="0001-Fixes-bug-160-as-per-Daniel-s-suggestion.patch"

From 9b6453b373f40e49ada7696c39a9fa9f777fc48a Mon Sep 17 00:00:00 2001
From: Matt Lilley <matt.lilley@securitease.com>
Date: Tue, 3 May 2011 11:20:24 +1200
Subject: [PATCH] Fixes bug #160 as per Daniel's suggestion

---
 include/libssh2.h  |    4 ++++
 src/libssh2_priv.h |    3 +++
 src/session.c      |   51 +++++++++++++++++++++++++++++++++++++++++++++------
 src/session.h      |   44 +++++++++++++++++++++++---------------------
 4 files changed, 75 insertions(+), 27 deletions(-)

diff --git a/include/libssh2.h b/include/libssh2.h
index e207411..9462360 100644
--- a/include/libssh2.h
+++ b/include/libssh2.h
@@ -705,6 +705,10 @@ LIBSSH2_API int libssh2_session_get_blocking(LIBSSH2_SESSION* session);
 LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel,
                                               int blocking);
 
+LIBSSH2_API void libssh2_session_set_timeout(LIBSSH2_SESSION* session,
+                                             long timeout);
+LIBSSH2_API long libssh2_session_get_timeout(LIBSSH2_SESSION* session);
+
 /* libssh2_channel_handle_extended_data is DEPRECATED, do not use! */
 LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel,
                                                       int ignore_mode);
diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h
index 231401e..5a697c7 100644
--- a/src/libssh2_priv.h
+++ b/src/libssh2_priv.h
@@ -559,6 +559,9 @@ struct _LIBSSH2_SESSION
     /* this is set to TRUE if a blocking API behavior is requested */
     int api_block_mode;
 
+    /* Timeout used when blocking API behavior is active */
+    long api_timeout;
+
     /* Server's public key */
     const LIBSSH2_HOSTKEY_METHOD *hostkey;
     void *server_hostkey_abstract;
diff --git a/src/session.c b/src/session.c
index e4714e8..edf98d8 100644
--- a/src/session.c
+++ b/src/session.c
@@ -481,6 +481,7 @@ libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)),
         session->free = local_free;
         session->realloc = local_realloc;
         session->abstract = abstract;
+        session->api_timeout = 0; /* timeout-free API by default */
         session->api_block_mode = 1; /* blocking API by default */
         _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
                        "New session resource allocated");
@@ -542,11 +543,12 @@ libssh2_session_callback_set(LIBSSH2_SESSION * session,
  * Utility function that waits for action on the socket. Returns 0 when ready
  * to run again or error on timeout.
  */
-int _libssh2_wait_socket(LIBSSH2_SESSION *session)
+int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t start_time)
 {
     int rc;
     int seconds_to_next;
     int dir;
+    int has_timeout;
 
     /* since libssh2 often sets EAGAIN internally before this function is
        called, we can decrease some amount of confusion in user programs by
@@ -592,8 +594,25 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
             fd_set *readfd = NULL;
             struct timeval tv;
 
-            tv.tv_sec = seconds_to_next;
-            tv.tv_usec = 0;
+            if (seconds_to_next > 0) {
+                tv.tv_sec = seconds_to_next;
+                tv.tv_usec = 0;
+                has_timeout = 1;
+            } else if (session->api_timeout > 0) {
+                time_t now = time (NULL);
+                long elapsed_ms = (long)(1000*difftime(start_time, now));                
+                if (elapsed_ms > session->api_timeout) {
+                    session->err_code = LIBSSH2_ERROR_TIMEOUT;
+                    return LIBSSH2_ERROR_TIMEOUT;
+                }
+                /* Seconds */
+                tv.tv_sec = (session->api_timeout - elapsed_ms) / 1000;
+                /* Microseconds */
+                tv.tv_usec = ((session->api_timeout - elapsed_ms) % 1000) * 1000;
+                has_timeout = 1;
+            } else {
+                has_timeout = 0;
+            }
 
             if(dir & LIBSSH2_SESSION_BLOCK_INBOUND) {
                 FD_ZERO(&rfd);
@@ -607,10 +626,8 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
                 writefd = &wfd;
             }
 
-            /* Note that this COULD be made to use a timeout that perhaps
-               could be customizable by the app or something... */
             rc = select(session->socket_fd + 1, readfd, writefd, NULL,
-                        seconds_to_next ? &tv : NULL);
+                        has_timeout ? &tv : NULL);
 #endif
         }
     }
@@ -1281,6 +1298,28 @@ libssh2_session_get_blocking(LIBSSH2_SESSION * session)
     return session->api_block_mode;
 }
 
+
+/* libssh2_session_set_timeout
+ *
+ * Set a session's timeout (in msec) for blocking mode, 
+ * or 0 to disable timeouts.
+ */
+LIBSSH2_API void
+libssh2_session_set_timeout(LIBSSH2_SESSION * session, long timeout)
+{
+    session->api_timeout = timeout;
+}
+
+/* libssh2_session_get_timeout
+ *
+ * Returns a session's timeout, or 0 if disabled
+ */
+LIBSSH2_API long
+libssh2_session_get_timeout(LIBSSH2_SESSION * session)
+{
+    return session->api_timeout;
+}
+
 /*
  * libssh2_poll_channel_read
  *
diff --git a/src/session.h b/src/session.h
index 4eac3a6..2866fcb 100644
--- a/src/session.h
+++ b/src/session.h
@@ -53,15 +53,16 @@
 */
 #define BLOCK_ADJUST(rc,sess,x) \
     do { \
-       rc = x; \
-       /* the order of the check below is important to properly deal with the
-          case when the 'sess' is freed */ \
-       if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode)  \
-           break; \
-       rc = _libssh2_wait_socket(sess); \
-       if(rc) \
-           break; \
-    } while(1)
+       time_t entry_time = time (NULL); \
+       do { \
+          rc = x; \
+          /* the order of the check below is important to properly deal with the
+             case when the 'sess' is freed */ \
+          if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode) \
+              break; \
+          rc = _libssh2_wait_socket(sess, entry_time);  \
+       } while(!rc);   \
+    } while(0)
 
 /*
  * For functions that returns a pointer, we need to check if the API is
@@ -69,21 +70,22 @@
  * immediately. If the API is blocking and we get a NULL we check the errno
  * and *only* if that is EAGAIN we loop and wait for socket action.
  */
-#define BLOCK_ADJUST_ERRNO(ptr,sess,x)          \
+#define BLOCK_ADJUST_ERRNO(ptr,sess,x) \
     do { \
-       int rc; \
-       ptr = x; \
-       if(!sess->api_block_mode || \
-          (ptr != NULL) || \
-          (libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
-           break;                                                  \
-       rc = _libssh2_wait_socket(sess); \
-       if(rc) \
-           break; \
-    } while(1)
+       time_t entry_time = time (NULL); \
+       do { \
+           int rc; \
+           ptr = x; \
+           if(!sess->api_block_mode || \
+              (ptr != NULL) || \
+              (libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
+               break; \
+           rc = _libssh2_wait_socket(sess, entry_time); \
+        } while(!rc); \
+    } while(0)
 
 
-int _libssh2_wait_socket(LIBSSH2_SESSION *session);
+int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t entry_time);
 
 /* this is the lib-internal set blocking function */
 int _libssh2_session_set_blocking(LIBSSH2_SESSION * session, int blocking);
-- 
1.7.2.3.msysgit.0


--------------050005080900000902000907
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--------------050005080900000902000907--

From libssh2-devel-bounces@cool.haxx.se  Tue May  3 14:24:44 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43COPSJ011855;
	Tue, 3 May 2011 14:24:41 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43CONMh011850
	for <libssh2-devel@cool.haxx.se>; Tue, 3 May 2011 14:24:23 +0200
Date: Tue, 3 May 2011 14:24:23 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: timeouts in libssh2 blocking-mode
In-Reply-To: <4DBF5418.4040706@securitease.com>
Message-ID: <alpine.DEB.2.00.1105031421340.23604@tvnag.unkk.fr>
References: <4DBE40D6.9010703@securitease.com>
	<20110502063335.20480.qmail@stuge.se>
	<4DBF104B.2010508@securitease.com>
	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>
	<4DBF3D9D.7080800@securitease.com>
	<20110502235937.32306.qmail@stuge.se>
	<4DBF4A05.9050403@securitease.com> <20110503004825.5079.qmail@stuge.se>
	<4DBF5418.4040706@securitease.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 03 May 2011 14:24:44 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 03 May 2011 14:24:23 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Tue, 3 May 2011, Matt Lilley wrote:

I like it! I only have this little thought. The patch has this section:

+            if (seconds_to_next > 0) {
+                tv.tv_sec = seconds_to_next;
+                tv.tv_usec = 0;
+                has_timeout = 1;
+            } else if (session->api_timeout > 0) {
+                time_t now = time (NULL);
+                long elapsed_ms = (long)(1000*difftime(start_time, now));

... which then basically makes it _not_ obey the timeout if there's a 
keep-alive timeout in action, which I'm not sure is desirable. Just because 
there's a possible keep-alive timer firing off in the future doesn't mean your 
timeout is no longer valid.

I think the maximum time allowed to select() should also affect the timeout 
even if seconds_to_next is non-zero.

Thoughts?

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May  3 14:27:21 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43CRJqp014942;
	Tue, 3 May 2011 14:27:20 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43CRI3P014935
	for <libssh2-devel@cool.haxx.se>; Tue, 3 May 2011 14:27:18 +0200
Date: Tue, 3 May 2011 14:27:18 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: Attempting to wrap sftp in Qt
In-Reply-To: <BANLkTi=Pt+URML8XOW0mkCirvAcaFXSjmg@mail.gmail.com>
Message-ID: <alpine.DEB.2.00.1105031425140.23604@tvnag.unkk.fr>
References: <BANLkTimCJaaAa6UYusBu8cGhEu8OTd2dyg@mail.gmail.com>
	<alpine.DEB.2.00.1105020912480.22668@tvnag.unkk.fr>
	<BANLkTikAb4HJC-RfUTeVMawapBLaKaSkBw@mail.gmail.com>
	<20110502184200.28213.qmail@stuge.se>
	<BANLkTi=Pt+URML8XOW0mkCirvAcaFXSjmg@mail.gmail.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 03 May 2011 14:27:21 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 03 May 2011 14:27:18 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Mon, 2 May 2011, Mark Roden wrote:

> It looks like I'm not able to overwrite the file, despite setting the flags: 
> LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC
>
> The first time, the writing works, and if I delete the file from the server 
> using a separate session, then the writing works again.
>
> Are there other flags or things to check so that a file can be overwritten, 
> some unix permission I'm not setting when the file is initially created?

If the server refuses the operation then so it does, there's not a lot libssh2 
can do about to convince that it should do something else. If there would be 
permission problems then surely you shouldn't be allowed to remove it either?

I would look into the server logs for clues.

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May  3 15:22:37 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43DMMPX017918;
	Tue, 3 May 2011 15:22:35 +0200
Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com
	[209.85.160.54])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43DMIAJ017877
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 3 May 2011 15:22:20 +0200
Received: by pwj8 with SMTP id 8so53089pwj.41
	for <libssh2-devel@cool.haxx.se>; Tue, 03 May 2011 06:22:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type:content-transfer-encoding;
	bh=MOyzC22WeDKbpo1oDWkHWZ+JPs00wZrjzPvM7LLRUWI=;
	b=BdpU5b9/B8WN5qMMHGQGJMwmtoemTRmEFZTNV08OJnYhZUooIxOqOf/QAiejLtDnM5
	cPOpEWo7Pu9aZBGo5pz6sAzHYxrY9kkc/1yH1BHUruURzN2vbqK1OkNxY5bocQ5jGkUR
	FRURhhyw+sXjDNlFoWZVfjb6pH4EnniKZ6mJM=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:content-type:content-transfer-encoding;
	b=p5dcqiQ7RepbnfWwc1QVsx/l/gS8o1baK6V+2am6oiVeR1AjDx7L6vCzfR2wiWBtlJ
	hINj8LwIG1zoTWLXe5pUVTbKJytfHtB7zZ18q/zGGjDfz8VYMOBwiFyTExMAiXqvoIMj
	bhRylMUcFVf7151P2FCAHaM1xRy6fB7ziQCBo=
MIME-Version: 1.0
Received: by 10.68.8.225 with SMTP id u1mr7734421pba.409.1304428937798; Tue,
	03 May 2011 06:22:17 -0700 (PDT)
Received: by 10.68.40.198 with HTTP; Tue, 3 May 2011 06:22:17 -0700 (PDT)
In-Reply-To: <alpine.DEB.2.00.1105031425140.23604@tvnag.unkk.fr>
References: <BANLkTimCJaaAa6UYusBu8cGhEu8OTd2dyg@mail.gmail.com>
	<alpine.DEB.2.00.1105020912480.22668@tvnag.unkk.fr>
	<BANLkTikAb4HJC-RfUTeVMawapBLaKaSkBw@mail.gmail.com>
	<20110502184200.28213.qmail@stuge.se>
	<BANLkTi=Pt+URML8XOW0mkCirvAcaFXSjmg@mail.gmail.com>
	<alpine.DEB.2.00.1105031425140.23604@tvnag.unkk.fr>
Date: Tue, 3 May 2011 06:22:17 -0700
Message-ID: <BANLkTimx2waiT0kqxGvHuHGDN55_jCDaKg@mail.gmail.com>
Subject: Re: Attempting to wrap sftp in Qt
From: Mark Roden <mmroden@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 03 May 2011 15:22:37 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 03 May 2011 15:22:20 +0200 (CEST)
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id
	p43DMIAJ017877
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="iso-8859-1"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id p43DMMPX017918

Yeah, you're right.  This is a server-side issue.

I thought I was establishing the connections incorrectly, and I was.
I needed to be more careful about the way that I handled the handles,
as well as making sure that I was going to the right path.

It's now working, and all the tests are working as welll.

Thanks for the feedback,
Mark

On Tue, May 3, 2011 at 5:27 AM, Daniel Stenberg <daniel@haxx.se> wrote:
> On Mon, 2 May 2011, Mark Roden wrote:
>
>> It looks like I'm not able to overwrite the file, despite setting the
>> flags: LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC
>>
>> The first time, the writing works, and if I delete the file from the
>> server using a separate session, then the writing works again.
>>
>> Are there other flags or things to check so that a file can be
>> overwritten, some unix permission I'm not setting when the file is initially
>> created?
>
> If the server refuses the operation then so it does, there's not a lot
> libssh2 can do about to convince that it should do something else. If there
> would be permission problems then surely you shouldn't be allowed to remove
> it either?
>
> I would look into the server logs for clues.
>
> --
>
>  / daniel.haxx.se
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May  3 22:57:14 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43KuuD7022101;
	Tue, 3 May 2011 22:57:11 +0200
Received: from smtp02.local (mail.sss.co.nz [202.36.44.228])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43Kureo021992
	for <libssh2-devel@cool.haxx.se>; Tue, 3 May 2011 22:56:55 +0200
Message-ID: <4DC06BDA.2040605@securitease.com>
Date: Wed, 04 May 2011 08:55:54 +1200
From: Matt Lilley <matt.lilley@securitease.com>
MIME-Version: 1.0
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: timeouts in libssh2 blocking-mode
References: <4DBE40D6.9010703@securitease.com>	<20110502063335.20480.qmail@stuge.se>	<4DBF104B.2010508@securitease.com>	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>	<4DBF3D9D.7080800@securitease.com>	<20110502235937.32306.qmail@stuge.se>	<4DBF4A05.9050403@securitease.com>
	<20110503004825.5079.qmail@stuge.se>	<4DBF5418.4040706@securitease.com>
	<alpine.DEB.2.00.1105031421340.23604@tvnag.unkk.fr>
In-Reply-To: <alpine.DEB.2.00.1105031421340.23604@tvnag.unkk.fr>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 03 May 2011 22:57:14 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 03 May 2011 22:56:56 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se


> ... which then basically makes it _not_ obey the timeout if there's a 
> keep-alive timeout in action, which I'm not sure is desirable. Just 
> because there's a possible keep-alive timer firing off in the future 
> doesn't mean your timeout is no longer valid.
>
> I think the maximum time allowed to select() should also affect the 
> timeout even if seconds_to_next is non-zero.
>
> Thoughts?

Well, for my puposes, the timeout is a safety-net. I don't really care 
when it triggers the call to exit with an error, so long as it does /at 
some point/ (and that this point can be configured to be on the order of 
seconds or minutes, rather than hours or days!). This is why my original 
approach was on a per-select rather than per-call basis - I only really 
cared about preventing endless blocking, not maintaining a guaranteed 
maximum time inside the library.

If you'd prefer the api_timeout to have precedence over the keep-alive, 
that's fine by me, or we could take the minimum of the two if you want. 
I'm happy with either; if you have a preference, let me know and I can 
modify the patch, or feel free to make the change yourself as you see fit.

Matt

-- 
_____________________________________________
Matt Lilley
Software Engineer
SecuritEase

Tel:    +64 4 912-2100
Fax:    +64 4 912-2101
E-mail: matt.lilley@securitease.com
Web:    http://www.securitease.com
_____________________________________________

This e-mail has passed our content security scan.
It is covered by the confidentiality clauses at http://www.securitease.com/content_and_confidentiality

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May  3 23:10:15 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43LA5Fc002324;
	Tue, 3 May 2011 23:10:13 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43LA3WB002133
	for <libssh2-devel@cool.haxx.se>; Tue, 3 May 2011 23:10:03 +0200
Date: Tue, 3 May 2011 23:10:03 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: timeouts in libssh2 blocking-mode
In-Reply-To: <4DC06BDA.2040605@securitease.com>
Message-ID: <alpine.DEB.2.00.1105032301040.30916@tvnag.unkk.fr>
References: <4DBE40D6.9010703@securitease.com>
	<20110502063335.20480.qmail@stuge.se>
	<4DBF104B.2010508@securitease.com>
	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>
	<4DBF3D9D.7080800@securitease.com>
	<20110502235937.32306.qmail@stuge.se>
	<4DBF4A05.9050403@securitease.com> <20110503004825.5079.qmail@stuge.se>
	<4DBF5418.4040706@securitease.com>
	<alpine.DEB.2.00.1105031421340.23604@tvnag.unkk.fr>
	<4DC06BDA.2040605@securitease.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 03 May 2011 23:10:14 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 03 May 2011 23:10:03 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Wed, 4 May 2011, Matt Lilley wrote:

> Well, for my puposes, the timeout is a safety-net. I don't really care when 
> it triggers the call to exit with an error, so long as it does /at some 
> point/ (and that this point can be configured to be on the order of seconds 
> or minutes, rather than hours or days!). This is why my original approach 
> was on a per-select rather than per-call basis - I only really cared about 
> preventing endless blocking, not maintaining a guaranteed maximum time 
> inside the library.

I figured that, and I realize I'm arguing about a really odd edge-case that 
probably won't ever happen to most users. I'm just striving to make the API as 
clear as possible and offer as few surprises as possible to the user of it. It 
also makes it easier to document and describe.

> If you'd prefer the api_timeout to have precedence over the keep-alive, 
> that's fine by me, or we could take the minimum of the two if you want. I'm 
> happy with either; if you have a preference, let me know and I can modify 
> the patch, or feel free to make the change yourself as you see fit.

I'd like that if the user-set timeout is less than the keep-alive timer has 
left, it should use the api_timeout and return an error if it hits that 
timeout.

If you update the patch, I'll offer to write the first draft of the man pages 
for the two new functions!

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May  3 23:52:22 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43LqDdZ014633;
	Tue, 3 May 2011 23:52:20 +0200
Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com
	[74.125.83.182])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43Lq9do014510
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 3 May 2011 23:52:11 +0200
Received: by pvg11 with SMTP id 11so293568pvg.41
	for <libssh2-devel@cool.haxx.se>; Tue, 03 May 2011 14:52:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:date:message-id:subject:from:to
	:content-type; bh=G4+PL376+Xp7CpD5BShTJQ3W+A0GQQYRxTL2OVMdMPk=;
	b=SQ3et1zCmomM/cNEyUONx4qCRJ6hWq3XyVt9mEussqIWidEwjRXbSyRd7nyJuuZG7O
	E5AL50N9g0V1VgVhpgTdc6semXS2IfKtRKaWCcLrEyDwVC7F99sPVp/Um0cjVOqZ02Z1
	iG45GdnNJbY/8031cDT+qaEyTSE5QAOKLF5ig=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=iLrmsb8YBl56DFWKuVXf8ErPMq6buS6EJfEr6WEWYf+kxyigbbS4BZo3+PhcMRwbR9
	U1kLlk42KDA4LlmR7oW04eMPsKRCoPQGCrV6sg3XflRABZnvfb1v4EO5O+Cshd0rTVcr
	nxJxeB8a93t1TCJxw5zen4eEVJyG8lcokJxys=
MIME-Version: 1.0
Received: by 10.142.128.9 with SMTP id a9mr183357wfd.173.1304459531508; Tue,
	03 May 2011 14:52:11 -0700 (PDT)
Received: by 10.142.212.16 with HTTP; Tue, 3 May 2011 14:52:11 -0700 (PDT)
Date: Tue, 3 May 2011 17:52:11 -0400
Message-ID: <BANLkTimUbk6tCLFp4m_xCVSrcDuv6x7MBQ@mail.gmail.com>
Subject: libssh2_channel_exec guidance
From: bayan <nayab9@gmail.com>
To: libssh2-devel@cool.haxx.se
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 03 May 2011 23:52:22 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 03 May 2011 23:52:12 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1144358550=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

--===============1144358550==
Content-Type: multipart/alternative; boundary=000e0cd32fd2ffdbe304a2662690

--000e0cd32fd2ffdbe304a2662690
Content-Type: text/plain; charset=ISO-8859-1

Hi all,

I am new here, and would like to thank the people who work hard to provide
this awesome library for us!!

I have a question that I have been unable to figure out, after searching
around and not coming up with anything, I was hoping to get guidance from
the hive-mind.

I seem to be having an issue using libssh2_channel_exec when sending X
amount of data across the channel.

To be more specific, the code looks like this:

ssh_channel = libssh2_channel_open_session(ssh_session);
libssh2_channel_exec(m_ssh_channel, command);

"command" here, will simply execute something that pumps data to the
location I want it.

Everything is working all fine and dandy (oh ya, dandy!), up until I
transfer X amount of (large?) data.  The amount of data transferred is
exactly the same every time, at which point it completely halts all
transfer.

It does take a while - it is a decent size of information.  What I am
wondering is if this is something that is known, or if I am doing something
incorrectly.

Alternatively to test this, what I have done is fire up Putty, and use that
to manually send the "command", to see what happens.  It is able to execute
correctly, seemingly infinitely.

What I would like, is for the data stream to not just stop at X amount of
data transferred, I would like it to continue infinitely similar to how it
works when I manually send the command using Putty.

Please let me know if there is anything else I can provide for more help!

Cheers!
Ben

--000e0cd32fd2ffdbe304a2662690
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div>Hi all,</div><div><br></div><div>I am new here, and would like to than=
k the people who work hard to provide this awesome library for us!!<br><br>=
I have a question that I have been unable to figure out, after searching ar=
ound and not coming up with anything, I was hoping to get guidance from the=
=A0hive-mind.</div>
<div><br></div><div>I seem to be having an issue using libssh2_channel_exec=
 when sending X amount of data across the channel.</div><div><br></div><div=
>To be more specific, the code looks like this:</div><div><br></div><div>
ssh_channel =3D libssh2_channel_open_session(ssh_session);</div><div>libssh=
2_channel_exec(m_ssh_channel, command);</div><div><br></div><div>&quot;comm=
and&quot; here, will simply execute something that pumps data to the locati=
on I want it.</div>
<div><br></div><div>Everything is working all fine and dandy (oh ya, dandy!=
), up until I transfer X amount of (large?) data. =A0The amount of data tra=
nsferred is exactly the same=A0every time, at which point it completely hal=
ts all transfer.<br>
<br>It does take a while - it is a decent size of information. =A0What I am=
 wondering is if this is something that is known, or if I am doing somethin=
g incorrectly.<br><br></div><div>Alternatively=A0to test this, what I have =
done is fire up Putty, and use that to manually send the &quot;command&quot=
;, to see what happens. =A0It is able to execute correctly, seemingly infin=
itely.</div>
<div><br></div><div>What I would like, is for the data stream to not just s=
top at X amount of data transferred, I would like it to continue=A0infinite=
ly similar to how it works when I manually send the command using Putty.<br=
>
<br>Please let me know if there is anything else I can provide for more hel=
p!<br><br>Cheers!<br>Ben</div><div><br></div><div><br></div>

--000e0cd32fd2ffdbe304a2662690--

--===============1144358550==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============1144358550==--

From libssh2-devel-bounces@cool.haxx.se  Wed May  4 00:14:53 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43MEe75030419;
	Wed, 4 May 2011 00:14:51 +0200
Received: from smtp02.local (mail.sss.co.nz [202.36.44.228])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p43MEZCu030366
	for <libssh2-devel@cool.haxx.se>; Wed, 4 May 2011 00:14:38 +0200
Message-ID: <4DC07E17.7080106@securitease.com>
Date: Wed, 04 May 2011 10:13:43 +1200
From: Matt Lilley <matt.lilley@securitease.com>
MIME-Version: 1.0
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: timeouts in libssh2 blocking-mode
References: <4DBE40D6.9010703@securitease.com>	<20110502063335.20480.qmail@stuge.se>	<4DBF104B.2010508@securitease.com>	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>	<4DBF3D9D.7080800@securitease.com>	<20110502235937.32306.qmail@stuge.se>	<4DBF4A05.9050403@securitease.com>
	<20110503004825.5079.qmail@stuge.se>	<4DBF5418.4040706@securitease.com>	<alpine.DEB.2.00.1105031421340.23604@tvnag.unkk.fr>	<4DC06BDA.2040605@securitease.com>
	<alpine.DEB.2.00.1105032301040.30916@tvnag.unkk.fr>
In-Reply-To: <alpine.DEB.2.00.1105032301040.30916@tvnag.unkk.fr>
Content-Type: multipart/mixed; boundary="------------050805060307030407040301"
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 04 May 2011 00:14:53 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 04 May 2011 00:14:38 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

This is a multi-part message in MIME format.

--------------050805060307030407040301
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=ISO-8859-1; format=flowed


> I figured that, and I realize I'm arguing about a really odd edge-case 
> that probably won't ever happen to most users. I'm just striving to 
> make the API as clear as possible and offer as few surprises as 
> possible to the user of it. It also makes it easier to document and 
> describe.
Yes, I can appreciate that.
>
> I'd like that if the user-set timeout is less than the keep-alive 
> timer has left, it should use the api_timeout and return an error if 
> it hits that timeout.
>
> If you update the patch, I'll offer to write the first draft of the 
> man pages for the two new functions!
Deal ;-)

I think this patch does that - but it's early in the morning still. Let 
me know what you think




-- 
_____________________________________________
Matt Lilley
Software Engineer
SecuritEase

Tel:    +64 4 912-2100
Fax:    +64 4 912-2101
E-mail: matt.lilley@securitease.com
Web:    http://www.securitease.com
_____________________________________________

This e-mail has passed our content security scan.
It is covered by the confidentiality clauses at http://www.securitease.com/content_and_confidentiality


--------------050805060307030407040301
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; 
    name="0001-Fixes-bug-160-as-per-Daniel-s-suggestion.patch"
Content-Disposition: attachment; 
    filename="0001-Fixes-bug-160-as-per-Daniel-s-suggestion.patch"

From 684f6d16cfd46b535d29010e406f8fce457962b2 Mon Sep 17 00:00:00 2001
From: Matt Lilley <matt.lilley@securitease.com>
Date: Tue, 3 May 2011 11:20:24 +1200
Subject: [PATCH] Fixes bug #160 as per Daniel's suggestion

---
 include/libssh2.h  |    4 ++++
 src/libssh2_priv.h |    3 +++
 src/session.c      |   52 +++++++++++++++++++++++++++++++++++++++++++++-------
 src/session.h      |   44 +++++++++++++++++++++++---------------------
 4 files changed, 75 insertions(+), 28 deletions(-)

diff --git a/include/libssh2.h b/include/libssh2.h
index e207411..9462360 100644
--- a/include/libssh2.h
+++ b/include/libssh2.h
@@ -705,6 +705,10 @@ LIBSSH2_API int libssh2_session_get_blocking(LIBSSH2_SESSION* session);
 LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel,
                                               int blocking);
 
+LIBSSH2_API void libssh2_session_set_timeout(LIBSSH2_SESSION* session,
+                                             long timeout);
+LIBSSH2_API long libssh2_session_get_timeout(LIBSSH2_SESSION* session);
+
 /* libssh2_channel_handle_extended_data is DEPRECATED, do not use! */
 LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel,
                                                       int ignore_mode);
diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h
index 231401e..5a697c7 100644
--- a/src/libssh2_priv.h
+++ b/src/libssh2_priv.h
@@ -559,6 +559,9 @@ struct _LIBSSH2_SESSION
     /* this is set to TRUE if a blocking API behavior is requested */
     int api_block_mode;
 
+    /* Timeout used when blocking API behavior is active */
+    long api_timeout;
+
     /* Server's public key */
     const LIBSSH2_HOSTKEY_METHOD *hostkey;
     void *server_hostkey_abstract;
diff --git a/src/session.c b/src/session.c
index e4714e8..ef64cf6 100644
--- a/src/session.c
+++ b/src/session.c
@@ -481,6 +481,7 @@ libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)),
         session->free = local_free;
         session->realloc = local_realloc;
         session->abstract = abstract;
+        session->api_timeout = 0; /* timeout-free API by default */
         session->api_block_mode = 1; /* blocking API by default */
         _libssh2_debug(session, LIBSSH2_TRACE_TRANS,
                        "New session resource allocated");
@@ -542,11 +543,12 @@ libssh2_session_callback_set(LIBSSH2_SESSION * session,
  * Utility function that waits for action on the socket. Returns 0 when ready
  * to run again or error on timeout.
  */
-int _libssh2_wait_socket(LIBSSH2_SESSION *session)
+int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t start_time)
 {
     int rc;
     int seconds_to_next;
     int dir;
+    int has_timeout;
 
     /* since libssh2 often sets EAGAIN internally before this function is
        called, we can decrease some amount of confusion in user programs by
@@ -591,9 +593,25 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
             fd_set *writefd = NULL;
             fd_set *readfd = NULL;
             struct timeval tv;
-
-            tv.tv_sec = seconds_to_next;
-            tv.tv_usec = 0;
+            
+            if (session->api_timeout > 0 && 
+                (seconds_to_next == 0 || seconds_to_next > session->api_timeout)) {
+                time_t now = time (NULL);
+                long elapsed_ms = (long)(1000*difftime(start_time, now));                
+                if (elapsed_ms > session->api_timeout) {
+                    session->err_code = LIBSSH2_ERROR_TIMEOUT;
+                    return LIBSSH2_ERROR_TIMEOUT;
+                }
+                tv.tv_sec = (session->api_timeout - elapsed_ms) / 1000;
+                tv.tv_usec = ((session->api_timeout - elapsed_ms) % 1000) * 1000;
+                has_timeout = 1;
+            } else if (seconds_to_next > 0) {
+                tv.tv_sec = seconds_to_next;
+                tv.tv_usec = 0;
+                has_timeout = 1;
+            } else {
+                has_timeout = 0;
+            }
 
             if(dir & LIBSSH2_SESSION_BLOCK_INBOUND) {
                 FD_ZERO(&rfd);
@@ -607,10 +625,8 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session)
                 writefd = &wfd;
             }
 
-            /* Note that this COULD be made to use a timeout that perhaps
-               could be customizable by the app or something... */
             rc = select(session->socket_fd + 1, readfd, writefd, NULL,
-                        seconds_to_next ? &tv : NULL);
+                        has_timeout ? &tv : NULL);
 #endif
         }
     }
@@ -1281,6 +1297,28 @@ libssh2_session_get_blocking(LIBSSH2_SESSION * session)
     return session->api_block_mode;
 }
 
+
+/* libssh2_session_set_timeout
+ *
+ * Set a session's timeout (in msec) for blocking mode, 
+ * or 0 to disable timeouts.
+ */
+LIBSSH2_API void
+libssh2_session_set_timeout(LIBSSH2_SESSION * session, long timeout)
+{
+    session->api_timeout = timeout;
+}
+
+/* libssh2_session_get_timeout
+ *
+ * Returns a session's timeout, or 0 if disabled
+ */
+LIBSSH2_API long
+libssh2_session_get_timeout(LIBSSH2_SESSION * session)
+{
+    return session->api_timeout;
+}
+
 /*
  * libssh2_poll_channel_read
  *
diff --git a/src/session.h b/src/session.h
index 4eac3a6..2866fcb 100644
--- a/src/session.h
+++ b/src/session.h
@@ -53,15 +53,16 @@
 */
 #define BLOCK_ADJUST(rc,sess,x) \
     do { \
-       rc = x; \
-       /* the order of the check below is important to properly deal with the
-          case when the 'sess' is freed */ \
-       if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode)  \
-           break; \
-       rc = _libssh2_wait_socket(sess); \
-       if(rc) \
-           break; \
-    } while(1)
+       time_t entry_time = time (NULL); \
+       do { \
+          rc = x; \
+          /* the order of the check below is important to properly deal with the
+             case when the 'sess' is freed */ \
+          if((rc != LIBSSH2_ERROR_EAGAIN) || !sess->api_block_mode) \
+              break; \
+          rc = _libssh2_wait_socket(sess, entry_time);  \
+       } while(!rc);   \
+    } while(0)
 
 /*
  * For functions that returns a pointer, we need to check if the API is
@@ -69,21 +70,22 @@
  * immediately. If the API is blocking and we get a NULL we check the errno
  * and *only* if that is EAGAIN we loop and wait for socket action.
  */
-#define BLOCK_ADJUST_ERRNO(ptr,sess,x)          \
+#define BLOCK_ADJUST_ERRNO(ptr,sess,x) \
     do { \
-       int rc; \
-       ptr = x; \
-       if(!sess->api_block_mode || \
-          (ptr != NULL) || \
-          (libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
-           break;                                                  \
-       rc = _libssh2_wait_socket(sess); \
-       if(rc) \
-           break; \
-    } while(1)
+       time_t entry_time = time (NULL); \
+       do { \
+           int rc; \
+           ptr = x; \
+           if(!sess->api_block_mode || \
+              (ptr != NULL) || \
+              (libssh2_session_last_errno(sess) != LIBSSH2_ERROR_EAGAIN) ) \
+               break; \
+           rc = _libssh2_wait_socket(sess, entry_time); \
+        } while(!rc); \
+    } while(0)
 
 
-int _libssh2_wait_socket(LIBSSH2_SESSION *session);
+int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t entry_time);
 
 /* this is the lib-internal set blocking function */
 int _libssh2_session_set_blocking(LIBSSH2_SESSION * session, int blocking);
-- 
1.7.2.3.msysgit.0


--------------050805060307030407040301
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--------------050805060307030407040301--

From libssh2-devel-bounces@cool.haxx.se  Wed May  4 02:55:13 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p440sns5015988;
	Wed, 4 May 2011 02:55:09 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.181.44.140])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with SMTP id p440slSH015974
	for <libssh2-devel@cool.haxx.se>; Wed, 4 May 2011 02:54:47 +0200
Received: (qmail 26307 invoked by uid 501); 4 May 2011 00:54:54 -0000
Message-ID: <20110504005454.26306.qmail@stuge.se>
Date: Wed, 4 May 2011 02:54:54 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: libssh2_channel_exec guidance
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <BANLkTimUbk6tCLFp4m_xCVSrcDuv6x7MBQ@mail.gmail.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <BANLkTimUbk6tCLFp4m_xCVSrcDuv6x7MBQ@mail.gmail.com>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 04 May 2011 02:55:13 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 04 May 2011 02:54:47 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

bayan wrote:
> ssh_channel = libssh2_channel_open_session(ssh_session);
> libssh2_channel_exec(m_ssh_channel, command);
..
> Everything is working all fine and dandy (oh ya, dandy!), up until I
> transfer X amount of (large?) data.  The amount of data transferred is
> exactly the same every time, at which point it completely halts all
> transfer.
..
> Please let me know if there is anything else I can provide for more help!

For starters make X known.

It would also be very useful if you could enable tracing and provide
the output from that. (You may have to build a version of libssh2
that includes the debug messages.)


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed May  4 09:01:55 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4471PA2015812;
	Wed, 4 May 2011 09:01:49 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4471NRF015772
	for <libssh2-devel@cool.haxx.se>; Wed, 4 May 2011 09:01:23 +0200
Date: Wed, 4 May 2011 09:01:23 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: libssh2_channel_exec guidance
In-Reply-To: <BANLkTimUbk6tCLFp4m_xCVSrcDuv6x7MBQ@mail.gmail.com>
Message-ID: <alpine.DEB.2.00.1105040900500.8687@tvnag.unkk.fr>
References: <BANLkTimUbk6tCLFp4m_xCVSrcDuv6x7MBQ@mail.gmail.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 04 May 2011 09:01:55 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 04 May 2011 09:01:23 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Tue, 3 May 2011, bayan wrote:

> I have a question that I have been unable to figure out, after searching 
> around and not coming up with anything, I was hoping to get guidance from 
> the hive-mind.

It'll also be very useful to know which libssh2 version on what platform 
you're using!

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed May  4 11:05:35 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4495Jul020015;
	Wed, 4 May 2011 11:05:33 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4495IYC019996
	for <libssh2-devel@cool.haxx.se>; Wed, 4 May 2011 11:05:18 +0200
Received: (qmail 17296 invoked from network); 4 May 2011 09:05:18 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
	by localhost with SMTP; 4 May 2011 09:05:18 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 0.12
Precedence: bulk
Cc: libssh2-devel@cool.haxx.se
Auto-Submitted: auto-generated
X-Mailer: Trac 0.12, by Edgewall Software
X-Trac-Project: libssh2
Date: Wed, 04 May 2011 09:05:18 -0000
X-URL: http://trac.libssh2.org/
Subject: [libssh2] #217: not multi-threaded safe
X-Trac-Ticket-URL: http://trac.libssh2.org/ticket/217
Message-ID: <048.be9e45dd6f70415e904487518592a6b7@libssh2.stuge.se>
X-Trac-Ticket-ID: 217
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 04 May 2011 11:05:35 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 04 May 2011 11:05:18 +0200 (CEST)
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id p4495IYC019996
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

#217: not multi-threaded safe
---------------------------+------------------------------------------------
  Reporter:  jianjingchen  |       Owner:       
      Type:  defect        |      Status:  new  
  Priority:  normal        |   Milestone:  1.2.9
 Component:  API           |     Version:  1.2.8
  Keywords:                |      Blocks:       
Blocked By:                |  
---------------------------+------------------------------------------------
 I find function make_ctr_evp in file openssl.c is not is not thread safe,
 only one EVP_CIPHER is used for some threads concurrently.

 Function _libssh2_transport_read in file transport.c use function decrypt
 two times. for first time, p->payload should be NULL, then
 LIBSSH2_FREE(session, p->payload) will caught exception.

-- 
Ticket URL: <http://trac.libssh2.org/ticket/217>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed May  4 11:09:49 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4499lDf023479;
	Wed, 4 May 2011 11:09:49 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4499ktk023454
	for <libssh2-devel@cool.haxx.se>; Wed, 4 May 2011 11:09:46 +0200
Received: (qmail 18012 invoked from network); 4 May 2011 09:09:49 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
	by localhost with SMTP; 4 May 2011 09:09:49 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 0.12
Precedence: bulk
Cc: libssh2-devel@cool.haxx.se
Auto-Submitted: auto-generated
X-Mailer: Trac 0.12, by Edgewall Software
X-Trac-Project: libssh2
Date: Wed, 04 May 2011 09:09:49 -0000
X-URL: http://trac.libssh2.org/
Subject: Re: [libssh2] #217: not multi-threaded safe
X-Trac-Ticket-URL: http://trac.libssh2.org/ticket/217#comment:1
Message-ID: <063.498c4a2427a7a525c604b9a2dc9af5dd@libssh2.stuge.se>
References: <048.be9e45dd6f70415e904487518592a6b7@libssh2.stuge.se>
X-Trac-Ticket-ID: 217
In-Reply-To: <048.be9e45dd6f70415e904487518592a6b7@libssh2.stuge.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 04 May 2011 11:09:49 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 04 May 2011 11:09:46 +0200 (CEST)
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id p4499ktk023454
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

#217: not multi-threaded safe
---------------------------+------------------------------------------------
  Reporter:  jianjingchen  |        Owner:        
      Type:  defect        |       Status:  closed
  Priority:  normal        |    Milestone:  1.2.9 
 Component:  API           |      Version:  1.2.8 
Resolution:  invalid       |     Keywords:        
    Blocks:                |   Blocked By:        
---------------------------+------------------------------------------------
Changes (by bagder):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 OpenSSL requires the application to register two mutex callbacks when used
 multi-threaded, and if you do so then libssh2 should work fine.

 This is not a libssh2 bug.

-- 
Ticket URL: <http://trac.libssh2.org/ticket/217#comment:1>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed May  4 18:04:42 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p44G4BhP001168;
	Wed, 4 May 2011 18:04:37 +0200
Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com
	[209.85.210.54])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p44G477s000860
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Wed, 4 May 2011 18:04:08 +0200
Received: by pzk27 with SMTP id 27so707725pzk.41
	for <libssh2-devel@cool.haxx.se>; Wed, 04 May 2011 09:04:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type;
	bh=AnsXs/grLk65y7qfRhPX5JSQn9vqW3p+HS5MyLhhd+k=;
	b=p4gbTAVix5PSMC0tLXJ2aJ4MuuL5FNhAzxNwwbaAu2ieeNUAu6da0Y0H1GEYN46NdF
	Tm2HMUd/6jtmzHBEiEt7JiwXtHELo+yG5BvKMw2/+UpODL+PQwyWpGOh5OQapLiROFWG
	/jt9suh1pTk3+PTTTkgfRMvidCm3czHeiAgr4=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:content-type;
	b=k41vbYNPi1cQktGgxARSpP6sdwwfFa5vK75QTjqMZ86ecXArJnpK6bz89DQSBv1k8C
	rAnQkpZ9YLD/ESEbSV3uycDlh/avV/YBmZWBgFoWXnrRShaaTwRnrcEcRMZe79RTY3XL
	o5o0+SrUV2/v6miLfmQdpxNAI63TnipMLBy0E=
MIME-Version: 1.0
Received: by 10.142.62.42 with SMTP id k42mr685986wfa.230.1304525043301; Wed,
	04 May 2011 09:04:03 -0700 (PDT)
Received: by 10.142.212.16 with HTTP; Wed, 4 May 2011 09:04:03 -0700 (PDT)
In-Reply-To: <20110504005454.26306.qmail@stuge.se>
References: <BANLkTimUbk6tCLFp4m_xCVSrcDuv6x7MBQ@mail.gmail.com>
	<20110504005454.26306.qmail@stuge.se>
Date: Wed, 4 May 2011 12:04:03 -0400
Message-ID: <BANLkTikgOD2OOV4UHGuWEVvpAwMhAAhQOw@mail.gmail.com>
Subject: Re: libssh2_channel_exec guidance
From: bayan <nayab9@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 04 May 2011 18:04:42 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 04 May 2011 18:04:09 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1162767767=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

--===============1162767767==
Content-Type: multipart/alternative; boundary=001636e0adb8ce82e004a2756758

--001636e0adb8ce82e004a2756758
Content-Type: text/plain; charset=ISO-8859-1

Hi Peter,

Thanks for the reply!

I will go ahead and attempt the tracing compile, hopefully that will provide
some more information that i can post when I get a chance.

For now, I kept track of the number of characters transferred each time
which totals to ~73000 characters (give or take a few, I suppose due to the
way I am measuring it)

Replacing my "command" libssh2 exec call, with simply putting "command" into
putty, I am able to keep going well beyond this 73k character point where it
dies through libssh2 everytime.

As Daniel suggested, here is some more information:

libssh2 version: #define LIBSSH2_VERSION "1.2.7"

libssh2 compiled and running on Windows XP, connecting to a Unix machine.

Cheers!
Ben

On Tue, May 3, 2011 at 8:54 PM, Peter Stuge <peter@stuge.se> wrote:

> bayan wrote:
> > ssh_channel = libssh2_channel_open_session(ssh_session);
> > libssh2_channel_exec(m_ssh_channel, command);
> ..
> > Everything is working all fine and dandy (oh ya, dandy!), up until I
> > transfer X amount of (large?) data.  The amount of data transferred is
> > exactly the same every time, at which point it completely halts all
> > transfer.
> ..
> > Please let me know if there is anything else I can provide for more help!
>
> For starters make X known.
>
> It would also be very useful if you could enable tracing and provide
> the output from that. (You may have to build a version of libssh2
> that includes the debug messages.)
>
>
> //Peter
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>

--001636e0adb8ce82e004a2756758
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Peter,<div><br>Thanks for the reply!<br><br>I will go ahead and attempt =
the tracing compile, hopefully that will provide some more information that=
 i can post when I get a chance.<br><br>For now, I kept track of the number=
 of characters transferred each time which totals to ~73000 characters (giv=
e or take a few, I suppose due to the way I am measuring it)<br>
<br>Replacing my &quot;command&quot; libssh2 exec call, with simply putting=
 &quot;command&quot; into putty, I am able to keep going well beyond this 7=
3k character point where it dies through libssh2 everytime.<br><br></div>
<div>As Daniel suggested, here is some more information:</div><div><br>libs=
sh2 version: #define LIBSSH2_VERSION &quot;1.2.7&quot;</div><div><br></div>=
<div>libssh2 compiled and running on Windows XP, connecting to a Unix machi=
ne.<br>
<br></div><div>Cheers!</div><div>Ben</div><div><br><div class=3D"gmail_quot=
e">On Tue, May 3, 2011 at 8:54 PM, Peter Stuge <span dir=3D"ltr">&lt;<a hre=
f=3D"mailto:peter@stuge.se">peter@stuge.se</a>&gt;</span> wrote:<br><blockq=
uote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc =
solid;padding-left:1ex;">
<div class=3D"im">bayan wrote:<br>
&gt; ssh_channel =3D libssh2_channel_open_session(ssh_session);<br>
&gt; libssh2_channel_exec(m_ssh_channel, command);<br>
</div><div class=3D"im">..<br>
&gt; Everything is working all fine and dandy (oh ya, dandy!), up until I<b=
r>
&gt; transfer X amount of (large?) data. =A0The amount of data transferred =
is<br>
&gt; exactly the same every time, at which point it completely halts all<br=
>
&gt; transfer.<br>
</div><div class=3D"im">..<br>
&gt; Please let me know if there is anything else I can provide for more he=
lp!<br>
<br>
</div>For starters make X known.<br>
<br>
It would also be very useful if you could enable tracing and provide<br>
the output from that. (You may have to build a version of libssh2<br>
that includes the debug messages.)<br>
<br>
<br>
//Peter<br>
_______________________________________________<br>
libssh2-devel <a href=3D"http://cool.haxx.se/cgi-bin/mailman/listinfo/libss=
h2-devel" target=3D"_blank">http://cool.haxx.se/cgi-bin/mailman/listinfo/li=
bssh2-devel</a><br>
</blockquote></div><br></div>

--001636e0adb8ce82e004a2756758--

--===============1162767767==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============1162767767==--

From libssh2-devel-bounces@cool.haxx.se  Wed May  4 18:37:03 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p44GatEX030328;
	Wed, 4 May 2011 18:37:01 +0200
Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com
	[74.125.83.182])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p44GaplX030270
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Wed, 4 May 2011 18:36:53 +0200
Received: by pvg11 with SMTP id 11so724684pvg.41
	for <libssh2-devel@cool.haxx.se>; Wed, 04 May 2011 09:36:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type;
	bh=04khK/JRWvCbu4QbFxGTwTfcinBFL8+4E4EN6Vq7g/U=;
	b=p/E+hPUGPsOmBt49ITxIJ+rgL+yDi3+h3COmP+xEfU2NG38qsy58s/Qt3xEfAqwsM/
	TLzOqDbozZ5f4Wuk4AucKIuCGQXWrtLYz62j2rDVJoeKjoWsbjl/vOC9SiVdVRgHMwkP
	Bq4c+eZg9CnF8tc5XwnAeI2q8Ossof+ahQL28=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:content-type;
	b=m87TFsnfWH03KeXoJkWG0trcd44u2/9BCBB1EcL+eZjgrPwkhr3/SLLBT7AYPfStIx
	x3tfi1CjUs3pT8BU92BIWPd+8+suMq0LOa+EEMqcCPxjUlv7TveBHXgygVlxJVeiP2fp
	+RzjLk/l14n81RMCzFOljFqvlrA7HI/U5R4Rs=
MIME-Version: 1.0
Received: by 10.142.52.8 with SMTP id z8mr646864wfz.401.1304527011408; Wed, 04
	May 2011 09:36:51 -0700 (PDT)
Received: by 10.142.212.16 with HTTP; Wed, 4 May 2011 09:36:51 -0700 (PDT)
In-Reply-To: <BANLkTikgOD2OOV4UHGuWEVvpAwMhAAhQOw@mail.gmail.com>
References: <BANLkTimUbk6tCLFp4m_xCVSrcDuv6x7MBQ@mail.gmail.com>
	<20110504005454.26306.qmail@stuge.se>
	<BANLkTikgOD2OOV4UHGuWEVvpAwMhAAhQOw@mail.gmail.com>
Date: Wed, 4 May 2011 12:36:51 -0400
Message-ID: <BANLkTik1K32hc9OWAxQNezPmUZq8Ge+OYA@mail.gmail.com>
Subject: Re: libssh2_channel_exec guidance
From: bayan <nayab9@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 04 May 2011 18:37:03 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 04 May 2011 18:36:53 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1246390308=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

--===============1246390308==
Content-Type: multipart/alternative; boundary=000e0cd2e1101d6dfd04a275ddf8

--000e0cd2e1101d6dfd04a275ddf8
Content-Type: text/plain; charset=ISO-8859-1

Major typo on my part, the number of characters transferred needs another 0
appended to it: 730000

Its not 73k, its 730k.  It transfers quite a decent amount before the
disconnect.

I also just attempted using a shell and write() instead of using exec, and
it has the same behavior.

I will compile a debug version to get some trace statements pumped out!

On Wed, May 4, 2011 at 12:04 PM, bayan <nayab9@gmail.com> wrote:

> Hi Peter,
>
> Thanks for the reply!
>
> I will go ahead and attempt the tracing compile, hopefully that will
> provide some more information that i can post when I get a chance.
>
> For now, I kept track of the number of characters transferred each time
> which totals to ~73000 characters (give or take a few, I suppose due to the
> way I am measuring it)
>
> Replacing my "command" libssh2 exec call, with simply putting "command"
> into putty, I am able to keep going well beyond this 73k character point
> where it dies through libssh2 everytime.
>
> As Daniel suggested, here is some more information:
>
> libssh2 version: #define LIBSSH2_VERSION "1.2.7"
>
> libssh2 compiled and running on Windows XP, connecting to a Unix machine.
>
> Cheers!
> Ben
>
> On Tue, May 3, 2011 at 8:54 PM, Peter Stuge <peter@stuge.se> wrote:
>
>> bayan wrote:
>> > ssh_channel = libssh2_channel_open_session(ssh_session);
>> > libssh2_channel_exec(m_ssh_channel, command);
>> ..
>> > Everything is working all fine and dandy (oh ya, dandy!), up until I
>> > transfer X amount of (large?) data.  The amount of data transferred is
>> > exactly the same every time, at which point it completely halts all
>> > transfer.
>> ..
>> > Please let me know if there is anything else I can provide for more
>> help!
>>
>> For starters make X known.
>>
>> It would also be very useful if you could enable tracing and provide
>> the output from that. (You may have to build a version of libssh2
>> that includes the debug messages.)
>>
>>
>> //Peter
>> _______________________________________________
>> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>>
>
>

--000e0cd2e1101d6dfd04a275ddf8
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Major typo on my part, the number of characters=A0transferred=A0needs anoth=
er 0 appended to it: 730000<br><br>Its not 73k, its 730k. =A0It transfers q=
uite a decent amount before the disconnect.<div><br></div><div>I also just =
attempted using a shell and write() instead of using exec, and it has the s=
ame behavior.<br>
<br>I will compile a debug version to get some trace statements pumped out!=
<br><br><div class=3D"gmail_quote">On Wed, May 4, 2011 at 12:04 PM, bayan <=
span dir=3D"ltr">&lt;<a href=3D"mailto:nayab9@gmail.com">nayab9@gmail.com</=
a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex;">Hi Peter,<div><br>Thanks for the reply!<br>=
<br>I will go ahead and attempt the tracing compile, hopefully that will pr=
ovide some more information that i can post when I get a chance.<br>
<br>For now, I kept track of the number of characters transferred each time=
 which totals to ~73000 characters (give or take a few, I suppose due to th=
e way I am measuring it)<br>
<br>Replacing my &quot;command&quot; libssh2 exec call, with simply putting=
 &quot;command&quot; into putty, I am able to keep going well beyond this 7=
3k character point where it dies through libssh2 everytime.<br><br></div>

<div>As Daniel suggested, here is some more information:</div><div><br>libs=
sh2 version: #define LIBSSH2_VERSION &quot;1.2.7&quot;</div><div><br></div>=
<div>libssh2 compiled and running on Windows XP, connecting to a Unix machi=
ne.<br>

<br></div><div>Cheers!</div><div>Ben</div><div><div></div><div class=3D"h5"=
><div><br><div class=3D"gmail_quote">On Tue, May 3, 2011 at 8:54 PM, Peter =
Stuge <span dir=3D"ltr">&lt;<a href=3D"mailto:peter@stuge.se" target=3D"_bl=
ank">peter@stuge.se</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
<div>bayan wrote:<br>
&gt; ssh_channel =3D libssh2_channel_open_session(ssh_session);<br>
&gt; libssh2_channel_exec(m_ssh_channel, command);<br>
</div><div>..<br>
&gt; Everything is working all fine and dandy (oh ya, dandy!), up until I<b=
r>
&gt; transfer X amount of (large?) data. =A0The amount of data transferred =
is<br>
&gt; exactly the same every time, at which point it completely halts all<br=
>
&gt; transfer.<br>
</div><div>..<br>
&gt; Please let me know if there is anything else I can provide for more he=
lp!<br>
<br>
</div>For starters make X known.<br>
<br>
It would also be very useful if you could enable tracing and provide<br>
the output from that. (You may have to build a version of libssh2<br>
that includes the debug messages.)<br>
<br>
<br>
//Peter<br>
_______________________________________________<br>
libssh2-devel <a href=3D"http://cool.haxx.se/cgi-bin/mailman/listinfo/libss=
h2-devel" target=3D"_blank">http://cool.haxx.se/cgi-bin/mailman/listinfo/li=
bssh2-devel</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>

--000e0cd2e1101d6dfd04a275ddf8--

--===============1246390308==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============1246390308==--

From libssh2-devel-bounces@cool.haxx.se  Wed May  4 19:06:06 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p44H5mRn026889;
	Wed, 4 May 2011 19:06:05 +0200
Received: from foo.stuge.se (qmailr@foo.stuge.se [212.181.44.140])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with SMTP id p44H5koW026857
	for <libssh2-devel@cool.haxx.se>; Wed, 4 May 2011 19:05:46 +0200
Received: (qmail 26399 invoked by uid 501); 4 May 2011 17:05:51 -0000
Message-ID: <20110504170551.26398.qmail@stuge.se>
Date: Wed, 4 May 2011 19:05:51 +0200
From: Peter Stuge <peter@stuge.se>
To: libssh2-devel@cool.haxx.se
Subject: Re: libssh2_channel_exec guidance
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <BANLkTimUbk6tCLFp4m_xCVSrcDuv6x7MBQ@mail.gmail.com>
	<20110504005454.26306.qmail@stuge.se>
	<BANLkTikgOD2OOV4UHGuWEVvpAwMhAAhQOw@mail.gmail.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <BANLkTikgOD2OOV4UHGuWEVvpAwMhAAhQOw@mail.gmail.com>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 04 May 2011 19:06:06 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 04 May 2011 19:05:46 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

bayan wrote:
> > bayan wrote:
> > > The amount of data transferred is exactly the same every time,
> > > at which point it completely halts all transfer.
..
> I kept track of the number of characters transferred each time
> which totals to ~73000 characters (give or take a few,

So which is it? Exactly the same every time, or give or take a few?
Please try not to contradict yourself.


> I suppose due to the way I am measuring it)

This makes absolutely no sense at all. We are talking about discrete
entities (bytes) and there can really only be one way to measure what
you have sent.

There are two metrics that would be interesting:

1. How many bytes of data you have passed to libssh2 on the channel.
2. How many bytes are succesfully received by the server side.

Nothing but byte level detail is useful.


> As Daniel suggested, here is some more information:
> 
> libssh2 version: #define LIBSSH2_VERSION "1.2.7"

Ok. This should be a sane version, but it would still be good for you
to try out the latest code in git.


> libssh2 compiled and running on Windows XP, connecting to a Unix machine.

"Unix" doesn't say much. In particular it says nothing about the
relevant software; the ssh daemon. OpenSSH-x.ypz with $distro patches
is the level information you need to provide.

It could also be very useful to provide debug output from the SSH server.


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Thu May  5 01:07:44 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p44LS2OW020350;
	Wed, 4 May 2011 23:28:18 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p44LS1aP020293
	for <libssh2-devel@cool.haxx.se>; Wed, 4 May 2011 23:28:01 +0200
Date: Wed, 4 May 2011 23:28:00 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: timeouts in libssh2 blocking-mode
In-Reply-To: <4DC07E17.7080106@securitease.com>
Message-ID: <alpine.DEB.2.00.1105042327230.3006@tvnag.unkk.fr>
References: <4DBE40D6.9010703@securitease.com>
	<20110502063335.20480.qmail@stuge.se>
	<4DBF104B.2010508@securitease.com>
	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>
	<4DBF3D9D.7080800@securitease.com>
	<20110502235937.32306.qmail@stuge.se>
	<4DBF4A05.9050403@securitease.com> <20110503004825.5079.qmail@stuge.se>
	<4DBF5418.4040706@securitease.com>
	<alpine.DEB.2.00.1105031421340.23604@tvnag.unkk.fr>
	<4DC06BDA.2040605@securitease.com>
	<alpine.DEB.2.00.1105032301040.30916@tvnag.unkk.fr>
	<4DC07E17.7080106@securitease.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 04 May 2011 23:28:21 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 04 May 2011 23:28:01 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Wed, 4 May 2011, Matt Lilley wrote:

> I think this patch does that - but it's early in the morning still. Let me 
> know what you think

Thanks, I've now committed and pushed your patch with my little fix and two 
new man pages for the new functions.

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Thu May  5 19:11:08 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p45HAaxL024199;
	Thu, 5 May 2011 19:11:04 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p45HAZRo024191
	for <libssh2-devel@cool.haxx.se>; Thu, 5 May 2011 19:10:35 +0200
Received: (qmail 6615 invoked from network); 5 May 2011 17:10:38 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
	by localhost with SMTP; 5 May 2011 17:10:38 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 0.12
Precedence: bulk
Cc: libssh2-devel@cool.haxx.se
Auto-Submitted: auto-generated
X-Mailer: Trac 0.12, by Edgewall Software
X-Trac-Project: libssh2
Date: Thu, 05 May 2011 17:10:38 -0000
X-URL: http://trac.libssh2.org/
Subject: [libssh2] #218: libssh2_session_startup fails with certain ssh servers
X-Trac-Ticket-URL: http://trac.libssh2.org/ticket/218
Message-ID: <042.09f759c90c714b7de56dcc47f5be8529@libssh2.stuge.se>
X-Trac-Ticket-ID: 218
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Thu, 05 May 2011 19:11:08 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Thu, 05 May 2011 19:10:35 +0200 (CEST)
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id p45HAZRo024191
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

#218: libssh2_session_startup fails with certain ssh servers
---------------------+------------------------------------------------------
  Reporter:  mstrsn  |       Owner:       
      Type:  defect  |      Status:  new  
  Priority:  normal  |   Milestone:  1.2.9
 Component:  SFTP    |     Version:  1.2.8
  Keywords:  banner  |      Blocks:       
Blocked By:          |  
---------------------+------------------------------------------------------
 Using libssh2_session_startup() with one particular ssh server always
 fails with LIBSSH2_ERROR_BANNER_RECV. Debugging the problem, I learned
 that my client program does not receive the complete banner from the
 server before blocking. This is a problem, because the loop in
 session_startup() that calls banner_receive() resets banner_TxRx_state to
 libssh2_NB_state_idle within the loop, causing the first portion of the
 banner to be lost when banner_receive() tries to get the rest of the
 banner. The fix that works for me is to update session.c like this:

 {{{
 #!diff
 --- session.c.orig      Tue Apr 26 13:41:46 2011
 +++ session.c   Tue Apr 26 14:59:06 2011
 @@ -657,12 +657,11 @@
                                    "Failed sending banner");
          }
          session->startup_state = libssh2_NB_state_sent;
 +        session->banner_TxRx_state = libssh2_NB_state_idle;
      }

      if (session->startup_state == libssh2_NB_state_sent) {
          do {
 -            session->banner_TxRx_state = libssh2_NB_state_idle;
 -
              rc = banner_receive(session);
              if (rc)
                  return _libssh2_error(session, rc,
 }}}

 I am using Solaris 10 x386 with gcc 3.4.6. The ssh server is running on a
 Ruggedcom switch running ROS 3.8.1. The banner returned by this server is
 "SSH-2.0-Mocana SSH".

-- 
Ticket URL: <http://trac.libssh2.org/ticket/218>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May 10 08:48:07 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4A6le3t006708;
	Tue, 10 May 2011 08:48:03 +0200
Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com
	[209.85.214.182])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4A6lbHq006694
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 10 May 2011 08:47:38 +0200
Received: by iwn33 with SMTP id 33so6630829iwn.41
	for <libssh2-devel@cool.haxx.se>; Mon, 09 May 2011 23:47:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:date:message-id:subject:from:to
	:content-type; bh=QFuesEC1E7xILdql34aWoIWg2hjsFzcuKvlACGkwJ34=;
	b=PoefQoCURpr7QAvdRUVO3EO9K6azFcz8bHXzhhRHNM8CsHvDINPyo8wQ8m3x9tgZiL
	8bXw1FpQXvMjN801Ypkn2CDyZMyPqdGyD5f+F9aFbLY+pHNyw0yenV05A5UEG/apMUE1
	608GDzZZ1dm0POYCBg2/YDLQge7MTDM3IhjeM=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=m/YM/UoAV8hDT16hBSQeVt1aBjCDIB05jYLfdHLCcBUS3NTWkXrMqw76LeqgTwhm17
	FOB07zRN1kwWchqHUDGFNdhDTGeijlzz77Jaz+GCSLpz0Jx4wyk5V7oLb+ID/sxQ3kp7
	P/xe90keOq5ijiC9wHhbMbOjQ4/ACE+JxmcuM=
MIME-Version: 1.0
Received: by 10.231.184.156 with SMTP id ck28mr5127140ibb.141.1305010052161;
	Mon, 09 May 2011 23:47:32 -0700 (PDT)
Received: by 10.231.157.77 with HTTP; Mon, 9 May 2011 23:47:32 -0700 (PDT)
Date: Tue, 10 May 2011 14:47:32 +0800
Message-ID: <BANLkTinsNROd1X5_9YdGHKyjh4uzOrXq=Q@mail.gmail.com>
Subject: sftp_write_sliding.c bug
From: zl liu <xieepp@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 10 May 2011 08:48:07 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 10 May 2011 08:47:39 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1484620801=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

--===============1484620801==
Content-Type: multipart/alternative; boundary=0050450174aa96607f04a2e65440

--0050450174aa96607f04a2e65440
Content-Type: text/plain; charset=GB2312
Content-Transfer-Encoding: quoted-printable

Hi all=A3=BA
sftp_write_sliding.c=A3=BA line 237
I modified like this:
nread =3D fread(&mem[memuse], 1, sizeof(mem)-memuse, local);
        if (nread <=3D 0) {
            /* end of file */
            if (memuse > 0){
                /* the previous sending is not finished */
                nread =3D 0;
            }
            else{
                break;
            }
        }

--0050450174aa96607f04a2e65440
Content-Type: text/html; charset=GB2312
Content-Transfer-Encoding: quoted-printable

Hi all=A3=BA<div>sftp_write_sliding.c=A3=BA&nbsp;line&nbsp;237</div><div>I =
modified like this:</div><div><div>nread =3D fread(&amp;mem[memuse], 1, siz=
eof(mem)-memuse, local);</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (nre=
ad &lt;=3D 0) {</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/*=
 end of file */</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (memuse &gt; 0){</di=
v><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/* the =
previous sending is not finished */</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &n=
bsp; &nbsp; &nbsp; &nbsp; &nbsp;nread =3D 0;</div><div>&nbsp;&nbsp; &nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp;}</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &n=
bsp; &nbsp;else{</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp; &nbsp;break;</div>
<div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div>&nbsp;&nbsp=
; &nbsp; &nbsp; &nbsp;}</div></div>

--0050450174aa96607f04a2e65440--

--===============1484620801==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============1484620801==--

From libssh2-devel-bounces@cool.haxx.se  Tue May 10 10:18:34 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4A8II8m022216;
	Tue, 10 May 2011 10:18:33 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4A8IFBK022196
	for <libssh2-devel@cool.haxx.se>; Tue, 10 May 2011 10:18:15 +0200
Date: Tue, 10 May 2011 10:18:15 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: sftp_write_sliding.c bug
In-Reply-To: <BANLkTinsNROd1X5_9YdGHKyjh4uzOrXq=Q@mail.gmail.com>
Message-ID: <alpine.DEB.2.00.1105101018060.20293@tvnag.unkk.fr>
References: <BANLkTinsNROd1X5_9YdGHKyjh4uzOrXq=Q@mail.gmail.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED;
	BOUNDARY="1129329158-1448261391-1305015495=:20293"
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 10 May 2011 10:18:34 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 10 May 2011 10:18:15 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--1129329158-1448261391-1305015495=:20293
Content-Type: TEXT/PLAIN; charset=GB2312; format=flowed
Content-Transfer-Encoding: 8BIT

On Tue, 10 May 2011, zl liu wrote:

> sftp_write_sliding.c£º line 237
> I modified like this:

Thanks, committed!

-- 

  / daniel.haxx.se
--1129329158-1448261391-1305015495=:20293
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--1129329158-1448261391-1305015495=:20293--

From libssh2-devel-bounces@cool.haxx.se  Tue May 17 19:12:16 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4HHBLZI003335;
	Tue, 17 May 2011 19:12:12 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4HHBJRr003332
	for <libssh2-devel@cool.haxx.se>; Tue, 17 May 2011 19:11:19 +0200
Received: (qmail 7251 invoked from network); 17 May 2011 17:11:21 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
	by localhost with SMTP; 17 May 2011 17:11:21 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 0.12
Precedence: bulk
Cc: libssh2-devel@cool.haxx.se
Auto-Submitted: auto-generated
X-Mailer: Trac 0.12, by Edgewall Software
X-Trac-Project: libssh2
Date: Tue, 17 May 2011 17:11:21 -0000
X-URL: http://trac.libssh2.org/
Subject: [libssh2] #219: libssh2_channel_forward_listen_ex freezes the program!
X-Trac-Ticket-URL: http://trac.libssh2.org/ticket/219
Message-ID: <044.d06f6ca1fdc86dce6e752ef3a98d50dd@libssh2.stuge.se>
X-Trac-Ticket-ID: 219
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 17 May 2011 19:12:16 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 17 May 2011 19:11:20 +0200 (CEST)
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id p4HHBJRr003332
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

#219: libssh2_channel_forward_listen_ex freezes the program!
---------------------------+------------------------------------------------
  Reporter:  fingster      |       Owner:       
      Type:  defect        |      Status:  new  
  Priority:  high          |   Milestone:  1.2.9
 Component:  API           |     Version:  1.2.8
  Keywords:  port forward  |      Blocks:       
Blocked By:                |  
---------------------------+------------------------------------------------
 I use libssh2_channel_forward_listen_ex to implement the function of 'ssh
 -L <localport>:<host>:<host_port>'. however,
 libssh2_channel_forward_listen_ex stuck.
 The code is based on this example
 [http://stackoverflow.com/questions/1580750/example-code-of-libssh2-being-
 used-for-port-forwarding], like this:

 {{{
   // initialize ssh connection

   int other_port = 0;
   LIBSSH2_LISTENER * fwd = libssh2_channel_forward_listen_ex(session,
 "127.0.0.1", 3128, &other_port, 1);
   printf("Remote forwding port: %d\n", other_port);

   channel = libssh2_channel_forward_accept(fwd);

   // pipe between localport and  channel

 }}}

-- 
Ticket URL: <http://trac.libssh2.org/ticket/219>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May 17 19:22:37 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4HHMUJr007583;
	Tue, 17 May 2011 19:22:36 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4HHMSSF007577
	for <libssh2-devel@cool.haxx.se>; Tue, 17 May 2011 19:22:28 +0200
Received: (qmail 8570 invoked from network); 17 May 2011 17:22:33 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
	by localhost with SMTP; 17 May 2011 17:22:33 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 0.12
Precedence: bulk
Cc: libssh2-devel@cool.haxx.se
Auto-Submitted: auto-generated
X-Mailer: Trac 0.12, by Edgewall Software
X-Trac-Project: libssh2
Date: Tue, 17 May 2011 17:22:33 -0000
X-URL: http://trac.libssh2.org/
Subject: Re: [libssh2] #219: libssh2_channel_forward_listen_ex freezes the
	program!
X-Trac-Ticket-URL: http://trac.libssh2.org/ticket/219#comment:1
Message-ID: <059.51e5f4304f3cee13e6f097e18afe216f@libssh2.stuge.se>
References: <044.d06f6ca1fdc86dce6e752ef3a98d50dd@libssh2.stuge.se>
X-Trac-Ticket-ID: 219
In-Reply-To: <044.d06f6ca1fdc86dce6e752ef3a98d50dd@libssh2.stuge.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 17 May 2011 19:22:37 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 17 May 2011 19:22:28 +0200 (CEST)
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id p4HHMSSF007577
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

#219: libssh2_channel_forward_listen_ex freezes the program!
-----------------------+----------------------------------------------------
  Reporter:  fingster  |        Owner:  bagder      
      Type:  defect    |       Status:  assigned    
  Priority:  high      |    Milestone:  1.2.9       
 Component:  API       |      Version:  1.2.8       
Resolution:            |     Keywords:  port forward
    Blocks:            |   Blocked By:              
-----------------------+----------------------------------------------------
Changes (by bagder):

  * owner:  => bagder
  * status:  new => assigned


Comment:

 libssh2_channel_forward_listen_ex() can indeed "get stuck" while waiting
 for data. Why is that wrong?

 If you want to avoid it getting stuck, use non-blocking mode.

-- 
Ticket URL: <http://trac.libssh2.org/ticket/219#comment:1>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May 17 19:36:11 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4HHa5wB013515;
	Tue, 17 May 2011 19:36:11 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4HHa4Fk013498
	for <libssh2-devel@cool.haxx.se>; Tue, 17 May 2011 19:36:04 +0200
Received: (qmail 10419 invoked from network); 17 May 2011 17:36:08 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
	by localhost with SMTP; 17 May 2011 17:36:08 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 0.12
Precedence: bulk
Cc: libssh2-devel@cool.haxx.se
Auto-Submitted: auto-generated
X-Mailer: Trac 0.12, by Edgewall Software
X-Trac-Project: libssh2
Date: Tue, 17 May 2011 17:36:08 -0000
X-URL: http://trac.libssh2.org/
Subject: Re: [libssh2] #219: libssh2_channel_forward_listen_ex freezes the
	program!
X-Trac-Ticket-URL: http://trac.libssh2.org/ticket/219#comment:2
Message-ID: <059.743c4af88d4b72a9af3c415380634c3b@libssh2.stuge.se>
References: <044.d06f6ca1fdc86dce6e752ef3a98d50dd@libssh2.stuge.se>
X-Trac-Ticket-ID: 219
In-Reply-To: <044.d06f6ca1fdc86dce6e752ef3a98d50dd@libssh2.stuge.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 17 May 2011 19:36:11 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 17 May 2011 19:36:04 +0200 (CEST)
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id p4HHa4Fk013498
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

#219: libssh2_channel_forward_listen_ex freezes the program!
-----------------------+----------------------------------------------------
  Reporter:  fingster  |        Owner:  bagder      
      Type:  defect    |       Status:  assigned    
  Priority:  high      |    Milestone:  1.2.9       
 Component:  API       |      Version:  1.2.8       
Resolution:            |     Keywords:  port forward
    Blocks:            |   Blocked By:              
-----------------------+----------------------------------------------------

Comment (by fingster):

 When I put
 {{{
 libssh2_session_set_blocking(session, 0);
 }}}
 before the cited example code, channel gets nothing but NULL. And printf
 shows that "Remote forwding port: 0".
 If I put
 {{{
 libssh2_session_set_blocking(session, 0);
 }}}
 after the cited example code, the program freezes at
 libssh2_channel_forward_listen_ex and never returns. Nothing outputs.

 how to use libssh2_channel_forward_listen_ex? Any example?
 Thank you!

-- 
Ticket URL: <http://trac.libssh2.org/ticket/219#comment:2>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May 17 19:39:55 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4HHdrnO014364;
	Tue, 17 May 2011 19:39:54 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4HHdpTp014349
	for <libssh2-devel@cool.haxx.se>; Tue, 17 May 2011 19:39:51 +0200
Received: (qmail 11053 invoked from network); 17 May 2011 17:39:56 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
	by localhost with SMTP; 17 May 2011 17:39:56 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 0.12
Precedence: bulk
Cc: libssh2-devel@cool.haxx.se
Auto-Submitted: auto-generated
X-Mailer: Trac 0.12, by Edgewall Software
X-Trac-Project: libssh2
Date: Tue, 17 May 2011 17:39:56 -0000
X-URL: http://trac.libssh2.org/
Subject: Re: [libssh2] #219: libssh2_channel_forward_listen_ex freezes the
	program!
X-Trac-Ticket-URL: http://trac.libssh2.org/ticket/219#comment:3
Message-ID: <059.c82c560a02ff9d7d1fcf3de663db1694@libssh2.stuge.se>
References: <044.d06f6ca1fdc86dce6e752ef3a98d50dd@libssh2.stuge.se>
X-Trac-Ticket-ID: 219
In-Reply-To: <044.d06f6ca1fdc86dce6e752ef3a98d50dd@libssh2.stuge.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 17 May 2011 19:39:54 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 17 May 2011 19:39:51 +0200 (CEST)
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id p4HHdpTp014349
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

#219: libssh2_channel_forward_listen_ex freezes the program!
-----------------------+----------------------------------------------------
  Reporter:  fingster  |        Owner:  bagder      
      Type:  defect    |       Status:  assigned    
  Priority:  high      |    Milestone:  1.2.9       
 Component:  API       |      Version:  1.2.8       
Resolution:            |     Keywords:  port forward
    Blocks:            |   Blocked By:              
-----------------------+----------------------------------------------------

Comment (by bagder):

 If you get NULL during non-blocking use you need to extract the error code
 to figure out if it is EAGAIN.

 I don't think we have any example for this, but we'd love to get one.

 Please consider using the mailing list instead for general help and advice
 as you don't seem to have identified any specific bug.

-- 
Ticket URL: <http://trac.libssh2.org/ticket/219#comment:3>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May 17 19:42:32 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4HHgSaA017694;
	Tue, 17 May 2011 19:42:31 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4HHgQH1017656
	for <libssh2-devel@cool.haxx.se>; Tue, 17 May 2011 19:42:26 +0200
Received: (qmail 11385 invoked from network); 17 May 2011 17:42:30 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
	by localhost with SMTP; 17 May 2011 17:42:30 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 0.12
Precedence: bulk
Cc: libssh2-devel@cool.haxx.se
Auto-Submitted: auto-generated
X-Mailer: Trac 0.12, by Edgewall Software
X-Trac-Project: libssh2
Date: Tue, 17 May 2011 17:42:30 -0000
X-URL: http://trac.libssh2.org/
Subject: Re: [libssh2] #208: Facing an issue while SFTP copying on Solaris
X-Trac-Ticket-URL: http://trac.libssh2.org/ticket/208#comment:1
Message-ID: <058.dbaacdcce90a8ba66e966c17332861e6@libssh2.stuge.se>
References: <043.39d3a69fd6a34156d1850ba5422ba148@libssh2.stuge.se>
X-Trac-Ticket-ID: 208
In-Reply-To: <043.39d3a69fd6a34156d1850ba5422ba148@libssh2.stuge.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 17 May 2011 19:42:32 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 17 May 2011 19:42:26 +0200 (CEST)
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id p4HHgQH1017656
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

#208: Facing an issue while SFTP copying on Solaris
----------------------+-----------------------------------------------------
  Reporter:  babi2ki  |        Owner:  bagder  
      Type:  defect   |       Status:  assigned
  Priority:  high     |    Milestone:  1.2.9   
 Component:  SFTP     |      Version:  1.2.7   
Resolution:           |     Keywords:          
    Blocks:           |   Blocked By:          
----------------------+-----------------------------------------------------
Changes (by bagder):

  * owner:  => bagder
  * status:  new => assigned
  * milestone:  1.2.7 => 1.2.9


Comment:

 Please build libssh2 to enable tracing and then run it with that enabled
 and show us the output so that we can better understand what's actually
 happening!

-- 
Ticket URL: <http://trac.libssh2.org/ticket/208#comment:1>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed May 18 08:42:26 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4I6g2wO011903;
	Wed, 18 May 2011 08:42:23 +0200
Received: from earth.stuge.se (earth.stuge.se [212.116.89.126])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4I6g0q6011829
	for <libssh2-devel@cool.haxx.se>; Wed, 18 May 2011 08:42:00 +0200
Received: (qmail 3603 invoked from network); 18 May 2011 06:42:02 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
	by localhost with SMTP; 18 May 2011 06:42:02 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 0.12
Precedence: bulk
Cc: libssh2-devel@cool.haxx.se
Auto-Submitted: auto-generated
X-Mailer: Trac 0.12, by Edgewall Software
X-Trac-Project: libssh2
Date: Wed, 18 May 2011 06:42:02 -0000
X-URL: http://trac.libssh2.org/
Subject: Re: [libssh2] #219: libssh2_channel_forward_listen_ex freezes the
	program!
X-Trac-Ticket-URL: http://trac.libssh2.org/ticket/219#comment:4
Message-ID: <059.bd06ddb0a4fefc15c66aaa49ff22b9cd@libssh2.stuge.se>
References: <044.d06f6ca1fdc86dce6e752ef3a98d50dd@libssh2.stuge.se>
X-Trac-Ticket-ID: 219
In-Reply-To: <044.d06f6ca1fdc86dce6e752ef3a98d50dd@libssh2.stuge.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 18 May 2011 08:42:26 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 18 May 2011 08:42:00 +0200 (CEST)
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id p4I6g0q6011829
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Reply-To: trac@libssh2.stuge.se,
        libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

#219: libssh2_channel_forward_listen_ex freezes the program!
-----------------------+----------------------------------------------------
  Reporter:  fingster  |        Owner:  bagder      
      Type:  defect    |       Status:  closed      
  Priority:  high      |    Milestone:  1.2.9       
 Component:  API       |      Version:  1.2.8       
Resolution:  invalid   |     Keywords:  port forward
    Blocks:            |   Blocked By:              
-----------------------+----------------------------------------------------
Changes (by fingster):

  * status:  assigned => closed
  * resolution:  => invalid


Comment:

 Replying to [comment:3 bagder]:
 > If you get NULL during non-blocking use you need to extract the error
 code to figure out if it is EAGAIN.
 >
 > I don't think we have any example for this, but we'd love to get one.
 >
 > Please consider using the mailing list instead for general help and
 advice as you don't seem to have identified any specific bug.
 After googling for a night and half day, the problem is finally resolved!
 libssh2_channel_forward_listen_ex is proper to implement 'ssh -R' not 'ssh
 -L'. For 'ssh -L', try "direct_tcpip" way.

 Thanks for bagder.

-- 
Ticket URL: <http://trac.libssh2.org/ticket/219#comment:4>
libssh2 <http://trac.libssh2.org/>
C library for writing portable SSH2 clients

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed May 18 08:44:06 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4I6i40i014222;
	Wed, 18 May 2011 08:44:05 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4I6i2dl014170
	for <libssh2-devel@cool.haxx.se>; Wed, 18 May 2011 08:44:02 +0200
Date: Wed, 18 May 2011 08:44:02 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: implementing ssh -R vs ssh -L
In-Reply-To: <059.bd06ddb0a4fefc15c66aaa49ff22b9cd@libssh2.stuge.se>
Message-ID: <alpine.DEB.2.00.1105180842470.30613@tvnag.unkk.fr>
References: <044.d06f6ca1fdc86dce6e752ef3a98d50dd@libssh2.stuge.se>
	<059.bd06ddb0a4fefc15c66aaa49ff22b9cd@libssh2.stuge.se>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 18 May 2011 08:44:06 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 18 May 2011 08:44:02 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Wed, 18 May 2011, libssh2 Trac wrote:

[quote from ticket #219]

> After googling for a night and half day, the problem is finally resolved!
> libssh2_channel_forward_listen_ex is proper to implement 'ssh -R' not 'ssh
> -L'. For 'ssh -L', try "direct_tcpip" way.

Hi friends,

Is there anything we can add to the documentation to make the above situation 
clearer or better described?

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed May 18 16:59:41 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4IExKwi023229;
	Wed, 18 May 2011 16:59:38 +0200
Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com
	[74.125.83.182])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4IExHfw023171
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Wed, 18 May 2011 16:59:19 +0200
Received: by pvg11 with SMTP id 11so934115pvg.41
	for <libssh2-devel@cool.haxx.se>; Wed, 18 May 2011 07:59:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:date:message-id:subject:from:to
	:content-type; bh=N21eJdj/LNQz7hCo/m2Fn13AtL69F1lLoybgiTBwORs=;
	b=ONZ8Nn4qPxxQvfL3AKdPFqZhJF/wig2BElpnPuWI4OmQDZP+1M+75oFVwI0+3dIqJM
	Yitpx1HsUkNSO+GxWN+fSChsCRP4SZ9Fn5Yjn+7EFWVbmsHbUE46GgQn70f5Utmz2ZpT
	i37PR3m/7QxTLxL56f9XicB1tk8WqVPOLrdwI=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=CcGUIIvinFzqQjPQh0X2gRpXcBfOf4C38B7KROGyemP+jawsxMleXZu80CulxgTxJK
	R6/DlzS7j7O9NKzk96JgKh+KtfkPQQeQU+nXl18Nm83ScGIODGboCpS79tRbIAp0Q9Wv
	tn0Dnxu5Ad7YEzF1bpktieJlJZ6G1p+1b5yX8=
MIME-Version: 1.0
Received: by 10.68.1.35 with SMTP id 3mr3143001pbj.7.1305730756567; Wed, 18
	May 2011 07:59:16 -0700 (PDT)
Received: by 10.68.60.197 with HTTP; Wed, 18 May 2011 07:59:16 -0700 (PDT)
Date: Wed, 18 May 2011 07:59:16 -0700
Message-ID: <BANLkTikE1wdwS=vm8j_uSFpX_49s+58nwA@mail.gmail.com>
Subject: touch a file remotely
From: Mark Roden <mmroden@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 18 May 2011 16:59:41 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 18 May 2011 16:59:19 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

Hi all,

I'm looking for the ability to touch a file on a remote server where
I'm logged in via scponly.  I have sftp read/write access in the
directory I need to write things.

Right now, in order to touch a file on the remote system, I create it
locally, and then send it as a zero-length file.  There's nothing
wrong with that, except that it just seems inefficient (and requires
local cleanup steps, making sure that everything goes into the right
place, etc). Is there a way to touch a file on a remote system through
a libssh2 function call?

Thanks,
Mark
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed May 18 19:28:31 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4IHSC6Q002912;
	Wed, 18 May 2011 19:28:28 +0200
Received: from ponderosa.fch.wimsey.bc.ca (zz201111.cipherkey.net
	[209.53.201.111])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4IHS8UB002907
	for <libssh2-devel@cool.haxx.se>; Wed, 18 May 2011 19:28:09 +0200
Received: by coneharvesters.com
	via sendmail with stdio id <m1QMkXZ-000l6IC@ponderosa.fch.wimsey.bc.ca>
	for libssh2-devel@cool.haxx.se; Wed, 18 May 2011 10:28:09 -0700 (PDT)
Date: Wed, 18 May 2011 10:28:08 -0700
From: Dan Fandrich <dan@coneharvesters.com>
To: libssh2-devel@cool.haxx.se
Subject: Re: touch a file remotely
Message-ID: <20110518172807.GA15502@coneharvesters.com>
Mail-Followup-To: libssh2-devel@cool.haxx.se
References: <BANLkTikE1wdwS=vm8j_uSFpX_49s+58nwA@mail.gmail.com>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <BANLkTikE1wdwS=vm8j_uSFpX_49s+58nwA@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 18 May 2011 19:28:31 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 18 May 2011 19:28:10 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Wed, May 18, 2011 at 07:59:16AM -0700, Mark Roden wrote:
> I'm looking for the ability to touch a file on a remote server where
> I'm logged in via scponly.  I have sftp read/write access in the
> directory I need to write things.

If by "touch" you mean to change the mtime of the file, then you can
do that in the SFTP subsystem using the libssh2_sftp_stat_ex() call.

>>> Dan
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Fri May 20 14:35:39 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4KCYESp022204;
	Fri, 20 May 2011 14:35:35 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4KCYDJk022197
	for <libssh2-devel@cool.haxx.se>; Fri, 20 May 2011 14:34:13 +0200
Date: Fri, 20 May 2011 14:34:13 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: trace always enabled?
Message-ID: <alpine.DEB.2.00.1105201429110.30049@tvnag.unkk.fr>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Fri, 20 May 2011 14:35:39 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Fri, 20 May 2011 14:34:13 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

Hi friends,

I've been thinking about libssh2's ability to provide detailed traces when 
built with --enable-debug. It is a very useful feature and we ask for such 
traces almost at once for just about every bug report we get.

How about we enable the trace feature for all builds unconditionally? It will 
take away the huge hurdle for people that has to rebuild the lib etc and it 
will better allow apps to also be able to ask libssh2 to provide tracing etc.

There might be some very minor performance penalties involved but we can 
probably make sure they are very small. I still think the gain in convenience 
will compensate more than enough.

Any opinions, thoughts or other feedback?

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Fri May 20 14:44:23 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4KChK1R028644;
	Fri, 20 May 2011 14:44:22 +0200
Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com
	[209.85.214.182])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4KChH6k028505
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Fri, 20 May 2011 14:43:18 +0200
Received: by iwn33 with SMTP id 33so3966385iwn.41
	for <libssh2-devel@cool.haxx.se>; Fri, 20 May 2011 05:43:14 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.42.138.199 with SMTP id d7mr4183128icu.197.1305895394462; Fri,
	20 May 2011 05:43:14 -0700 (PDT)
Received: by 10.42.219.129 with HTTP; Fri, 20 May 2011 05:43:14 -0700 (PDT)
X-Originating-IP: [32.164.160.108]
Received: by 10.42.219.129 with HTTP; Fri, 20 May 2011 05:43:14 -0700 (PDT)
In-Reply-To: <alpine.DEB.2.00.1105201429110.30049@tvnag.unkk.fr>
References: <alpine.DEB.2.00.1105201429110.30049@tvnag.unkk.fr>
Date: Fri, 20 May 2011 07:43:14 -0500
Message-ID: <BANLkTinn3qr9hePfFqpU40os3ty7-x2wPw@mail.gmail.com>
Subject: Re: trace always enabled?
From: Neil Gierman <ngierman@roadrunn.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Fri, 20 May 2011 14:44:23 +0200 (CEST)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Fri, 20 May 2011 14:43:19 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============0685573196=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

--===============0685573196==
Content-Type: multipart/alternative; boundary=90e6ba1efc1219ca5104a3b4772e

--90e6ba1efc1219ca5104a3b4772e
Content-Type: text/plain; charset=ISO-8859-1

On May 20, 2011 7:38 AM, "Daniel Stenberg" <daniel@haxx.se> wrote:
>
> Hi friends,
>
> I've been thinking about libssh2's ability to provide detailed traces when
built with --enable-debug. It is a very useful feature and we ask for such
traces almost at once for just about every bug report we get.
>
> How about we enable the trace feature for all builds unconditionally? It
will take away the huge hurdle for people that has to rebuild the lib etc
and it will better allow apps to also be able to ask libssh2 to provide
tracing etc.
>
> There might be some very minor performance penalties involved but we can
probably make sure they are very small. I still think the gain in
convenience will compensate more than enough.
>
> Any opinions, thoughts or other feedback?
>
> --
>
>  / daniel.haxx.se
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

I personally would like to keep it just for debug builds. I would really
rather not have any extra debugging information compiled in the release
builds even if it is only sitting dormant.

--90e6ba1efc1219ca5104a3b4772e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<p><br>
On May 20, 2011 7:38 AM, &quot;Daniel Stenberg&quot; &lt;<a href=3D"mailto:=
daniel@haxx.se">daniel@haxx.se</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi friends,<br>
&gt;<br>
&gt; I&#39;ve been thinking about libssh2&#39;s ability to provide detailed=
 traces when built with --enable-debug. It is a very useful feature and we =
ask for such traces almost at once for just about every bug report we get.<=
br>

&gt;<br>
&gt; How about we enable the trace feature for all builds unconditionally? =
It will take away the huge hurdle for people that has to rebuild the lib et=
c and it will better allow apps to also be able to ask libssh2 to provide t=
racing etc.<br>

&gt;<br>
&gt; There might be some very minor performance penalties involved but we c=
an probably make sure they are very small. I still think the gain in conven=
ience will compensate more than enough.<br>
&gt;<br>
&gt; Any opinions, thoughts or other feedback?<br>
&gt;<br>
&gt; -- <br>
&gt;<br>
&gt; =A0/ <a href=3D"http://daniel.haxx.se">daniel.haxx.se</a><br>
&gt; _______________________________________________<br>
&gt; libssh2-devel <a href=3D"http://cool.haxx.se/cgi-bin/mailman/listinfo/=
libssh2-devel">http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel</=
a></p>
<p>I personally would like to keep it just for debug builds. I would really=
 rather not have any extra debugging information compiled in the release bu=
ilds even if it is only sitting dormant.</p>

--90e6ba1efc1219ca5104a3b4772e--

--===============0685573196==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============0685573196==--

From libssh2-devel-bounces@cool.haxx.se  Fri May 20 15:34:40 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4KDYUM0021143;
	Fri, 20 May 2011 15:34:39 +0200
Received: from mail-px0-f177.google.com (mail-px0-f177.google.com
	[209.85.212.177])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4KDYQA1021129
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Fri, 20 May 2011 15:34:28 +0200
Received: by pxi10 with SMTP id 10so2661690pxi.8
	for <libssh2-devel@cool.haxx.se>; Fri, 20 May 2011 06:34:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type:content-transfer-encoding;
	bh=rXaLCHBrVCpq+oqaZc4nclVk+SMKPBXCJosdByY5L94=;
	b=VZPhOq/kMzQF3FE8T8of1j213UIQZ388XWIcrUq1iPrP2CiiwzfuBG7MVdOleQm5xl
	yVTIPG1wTSX62qnimqPaI3mmrnxTbGIPbgz1vRnuYPXRWdXT+qSx8gq9KstOL0kDY6Io
	dLqktuuKUWv5ke5Qka6Os6Ty5qwGb02PY4RzY=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:content-type:content-transfer-encoding;
	b=vsB5KfUV3ndaiHnBynHn3V0HDeaXt5TPLXg2YLLq3vnY9Xjt9ryQ9YeWOCNvBrqDxE
	So3tFjvDlGmgj4KCHunI3Q5mFecqpOhWSjNhvfw4ftXRLRrZyIhWocg6eQpbKwGY3ima
	MP4/hcuKr9pCtibp9QGCwpbTQSHz//oz8j02k=
MIME-Version: 1.0
Received: by 10.68.1.169 with SMTP id 9mr7043114pbn.88.1305898463614; Fri, 20
	May 2011 06:34:23 -0700 (PDT)
Received: by 10.68.52.72 with HTTP; Fri, 20 May 2011 06:34:23 -0700 (PDT)
In-Reply-To: <BANLkTinn3qr9hePfFqpU40os3ty7-x2wPw@mail.gmail.com>
References: <alpine.DEB.2.00.1105201429110.30049@tvnag.unkk.fr>
	<BANLkTinn3qr9hePfFqpU40os3ty7-x2wPw@mail.gmail.com>
Date: Fri, 20 May 2011 06:34:23 -0700
Message-ID: <BANLkTimYOrMLWQQ0X7LfWoYqkL1YAgibPw@mail.gmail.com>
Subject: Re: trace always enabled?
From: Mark Roden <mmroden@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Fri, 20 May 2011 15:34:40 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Fri, 20 May 2011 15:34:28 +0200 (CEST)
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id
	p4KDYQA1021129
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="iso-8859-1"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id p4KDYUM0021143

I agree with Neil.

You could also support a release-with-debug build, something that's
optimized but still supports debugging macros.  That way, if someone
encounters a bug due to optimization, they at least will have traces
available to them.

On Fri, May 20, 2011 at 5:43 AM, Neil Gierman <ngierman@roadrunn.com> wrote:
>
> On May 20, 2011 7:38 AM, "Daniel Stenberg" <daniel@haxx.se> wrote:
>>
>> Hi friends,
>>
>> I've been thinking about libssh2's ability to provide detailed traces when
>> built with --enable-debug. It is a very useful feature and we ask for such
>> traces almost at once for just about every bug report we get.
>>
>> How about we enable the trace feature for all builds unconditionally? It
>> will take away the huge hurdle for people that has to rebuild the lib etc
>> and it will better allow apps to also be able to ask libssh2 to provide
>> tracing etc.
>>
>> There might be some very minor performance penalties involved but we can
>> probably make sure they are very small. I still think the gain in
>> convenience will compensate more than enough.
>>
>> Any opinions, thoughts or other feedback?
>>
>> --
>>
>>  / daniel.haxx.se
>> _______________________________________________
>> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>
> I personally would like to keep it just for debug builds. I would really
> rather not have any extra debugging information compiled in the release
> builds even if it is only sitting dormant.
>
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>
>

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Fri May 20 17:27:39 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4KFQJmW014489;
	Fri, 20 May 2011 17:27:38 +0200
Received: from mx2.belnet.be (mx2.belnet.be [193.190.130.39])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4KFQHgF014451
	for <libssh2-devel@cool.haxx.se>; Fri, 20 May 2011 17:26:17 +0200
X-IronPort-AV: E=Sophos;i="4.65,242,1304287200"; 
   d="scan'208";a="1217087"
Received: from firewall.belnet.be (HELO office.belnet.be) ([193.190.130.1])
	by mx2-out.belnet.be with ESMTP; 20 May 2011 17:26:16 +0200
Received: from localhost (localhost [127.0.0.1])
	by office.belnet.be (Postfix) with ESMTP id C01BD4027F
	for <libssh2-devel@cool.haxx.se>; Fri, 20 May 2011 17:26:16 +0200 (CEST)
Received: from aris-laptop.local (unknown [10.4.99.174])
	by office.belnet.be (Postfix) with ESMTP id B2EAF40279
	for <libssh2-devel@cool.haxx.se>; Fri, 20 May 2011 17:26:16 +0200 (CEST)
Message-ID: <4DD68818.1090707@0xbadc0de.be>
Date: Fri, 20 May 2011 17:26:16 +0200
From: Aris Adamantiadis <aris@0xbadc0de.be>
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr;
	rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10
MIME-Version: 1.0
To: libssh2-devel@cool.haxx.se
Subject: Re: trace always enabled?
References: <alpine.DEB.2.00.1105201429110.30049@tvnag.unkk.fr>	<BANLkTinn3qr9hePfFqpU40os3ty7-x2wPw@mail.gmail.com>
	<BANLkTimYOrMLWQQ0X7LfWoYqkL1YAgibPw@mail.gmail.com>
In-Reply-To: <BANLkTimYOrMLWQQ0X7LfWoYqkL1YAgibPw@mail.gmail.com>
X-Enigmail-Version: 1.1.1
X-Virus-Scanned: Belnet virus scanner
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Fri, 20 May 2011 17:27:39 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Fri, 20 May 2011 17:26:18 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="iso-8859-1"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id p4KFQJmW014489

Le 20/05/11 15:34, Mark Roden a écrit :
> I agree with Neil.
> 
> You could also support a release-with-debug build, something that's
> optimized but still supports debugging macros.  That way, if someone
> encounters a bug due to optimization, they at least will have traces
> available to them.

Hi,

That's what we do with libssh, it's compiled by default, give us great
debugging info when there's a problem (sometimes fixes it immediatly),
and nobody ever complained about it taking too much CPU or space in the
binary.
Sometimes asking a user to recompile his distro's package is not realistic.

Kr,

Aris
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Sat May 21 12:58:45 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4LAw7GP030304;
	Sat, 21 May 2011 12:58:40 +0200
Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com
	[209.85.215.182])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4LAw4qc030219
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Sat, 21 May 2011 12:58:05 +0200
Received: by eyg7 with SMTP id 7so1959884eyg.41
	for <libssh2-devel@cool.haxx.se>; Sat, 21 May 2011 03:58:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peut.org; s=google;
	h=domainkey-signature:message-id:date:from:user-agent:mime-version:to
	:subject:references:in-reply-to:content-type;
	bh=p3N204o0x+nlWGnmZw1Ii0NkcVZMSsRK+9/GfshUMEY=;
	b=KnAgf7iEm9u0yvC4RqNXogFSuLfXJUgZ2c1x4encgMofTcaSoGHqjLWwNEaWBXPaEp
	tFIyJYZy/706fWnKKvG7IFqG0sBVDrbPLZzNk4Qvn1rGHjFCNkEVO41K8ui+8tMyLYQ9
	nkqiLxWCQHw5z3XookNQmCttNAO49Z2jq9ZSQ=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=peut.org; s=google;
	h=message-id:date:from:user-agent:mime-version:to:subject:references
	:in-reply-to:content-type;
	b=WbgYsuQL3Su59zJMz/Y7ds0w6Z0LuVBI1AIuNfsCRZntr+hlDMHcRUtAa8uWVAuya+
	gqcwaGjMkywEDfFMGJIcNAOj4uD5UHoEPtcSYGLSr4ifv2kfOSEFvwsS2GcKUbM4LLyw
	yFTLkQYDSUQffhUQv7PNpDI8ODpB5z44d7fQQ=
Received: by 10.213.9.145 with SMTP id l17mr474453ebl.10.1305975482569;
	Sat, 21 May 2011 03:58:02 -0700 (PDT)
Received: from [192.168.0.35] (96-160.ftth.onsbrabantnet.nl [88.159.160.96])
	by mx.google.com with ESMTPS id y3sm3198023eeh.19.2011.05.21.03.58.00
	(version=SSLv3 cipher=OTHER); Sat, 21 May 2011 03:58:01 -0700 (PDT)
Message-ID: <4DD79AB0.6030109@peut.org>
Date: Sat, 21 May 2011 12:57:52 +0200
From: Jose Baars <peut@peut.org>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; nl;
	rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
MIME-Version: 1.0
To: libssh2-devel@cool.haxx.se
Subject: Re: trace always enabled?
References: <alpine.DEB.2.00.1105201429110.30049@tvnag.unkk.fr>
In-Reply-To: <alpine.DEB.2.00.1105201429110.30049@tvnag.unkk.fr>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Sat, 21 May 2011 12:58:45 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Sat, 21 May 2011 12:58:05 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1296556000=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

This is a cryptographically signed message in MIME format.

--===============1296556000==
Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha1; boundary="------------ms080601050104070807090104"

This is a cryptographically signed message in MIME format.

--------------ms080601050104070807090104
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable


In the VMS build stuff it's already enabled. With all the very different =
implementations
of SSH on very different systems around,  you really can't do without a t=
racing facility.
My guess is the CPU penalty is below 0.1 percent*.

Jos=E9 Baars*



--------------ms080601050104070807090104
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIRtDCC
BV0wggRFoAMCAQICEBUPxTeUYVibM15V7SdI4YcwDQYJKoZIhvcNAQEFBQAwgd0xCzAJBgNV
BAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1
c3QgTmV0d29yazE7MDkGA1UECxMyVGVybXMgb2YgdXNlIGF0IGh0dHBzOi8vd3d3LnZlcmlz
aWduLmNvbS9ycGEgKGMpMDkxHjAcBgNVBAsTFVBlcnNvbmEgTm90IFZhbGlkYXRlZDE3MDUG
A1UEAxMuVmVyaVNpZ24gQ2xhc3MgMSBJbmRpdmlkdWFsIFN1YnNjcmliZXIgQ0EgLSBHMzAe
Fw0xMDExMTIwMDAwMDBaFw0xMTExMTIyMzU5NTlaMIIBCjEXMBUGA1UEChMOVmVyaVNpZ24s
IEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdvcmsxRjBEBgNVBAsTPXd3dy52
ZXJpc2lnbi5jb20vcmVwb3NpdG9yeS9SUEEgSW5jb3JwLiBieSBSZWYuLExJQUIuTFREKGMp
OTgxHjAcBgNVBAsTFVBlcnNvbmEgTm90IFZhbGlkYXRlZDEzMDEGA1UECxMqRGlnaXRhbCBJ
RCBDbGFzcyAxIC0gTmV0c2NhcGUgRnVsbCBTZXJ2aWNlMRMwEQYDVQQDFApKb3NlIEJhYXJz
MRwwGgYJKoZIhvcNAQkBFg1wZXV0QHBldXQub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
MIIBCgKCAQEAr/QJrg4jLwhCrNdHOzbC5HFzjE/FoklGXizIWpmW/bQOf6UQCVmJIPK7dsaJ
Dz2zytkbrrre5s/qfPcNkSScKSOguxyBmnQ/tW6Y0OnlYzv0ZrYyC0J8zzntDfZ5mLOzBTCY
rGS0Pqy8n7vRScDT927/62dEfgHiA3ceWbc+NCIJYdgupDjByypHgmi2H6JAiv6N16U2LRfM
2ZNBu4RYgWHQp31Y9cX/a/CHEv1rG/5MPVDQP6t45saHKJN/gcH4oXeCfHINZ7iUJhIWpk9i
pGEjwPLpgRAsGJFRHrZTBgOjrwrdzfrDgnKWkB2RY+IAYQ7z+8+KJGHwfuWvsH2EbQIDAQAB
o4HoMIHlMAkGA1UdEwQCMAAwRAYDVR0gBD0wOzA5BgtghkgBhvhFAQcXATAqMCgGCCsGAQUF
BwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vcnBhMAsGA1UdDwQEAwIFoDAdBgNVHSUE
FjAUBggrBgEFBQcDBAYIKwYBBQUHAwIwFAYKYIZIAYb4RQEGBwQGFgROb25lMFAGA1UdHwRJ
MEcwRaBDoEGGP2h0dHA6Ly9pbmRjMWRpZ2l0YWxpZC1nMy1jcmwudmVyaXNpZ24uY29tL0lu
ZEMxRGlnaXRhbElELUczLmNybDANBgkqhkiG9w0BAQUFAAOCAQEA5nI96tQkbCelTz4bLtnc
6uCIfbmE0slYOMLfmjwgXm0qJAMYCiBlhdBkBeROwP9JkqIRHMOnPAGB/i9nz/6KeIJQEBKT
ClJMeU9NZ4VvIsmaTnEmL86fuDQygCYJXf7+9PfIbK2BDQ9AsJtvLPfQXfMkATYEAP/dozXX
ZLiZ3p5sex3DzevIX8/TNjV4Vdt7S8rYXfLz+yZh5bJVliScankYwcScVh/0kn0DLdq47DxO
ZANPISNkOF0yvfT/cTFMnLykCwtZiGGfRGl5KAl6DSN0vn49B+M0QuvGAN/5itaGx4YCLMl1
0iganL8H2SHFW4a+BeKZ7t+1JG9l/YUGdTCCBV0wggRFoAMCAQICEBUPxTeUYVibM15V7SdI
4YcwDQYJKoZIhvcNAQEFBQAwgd0xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwg
SW5jLjEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazE7MDkGA1UECxMyVGVybXMg
b2YgdXNlIGF0IGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9ycGEgKGMpMDkxHjAcBgNVBAsT
FVBlcnNvbmEgTm90IFZhbGlkYXRlZDE3MDUGA1UEAxMuVmVyaVNpZ24gQ2xhc3MgMSBJbmRp
dmlkdWFsIFN1YnNjcmliZXIgQ0EgLSBHMzAeFw0xMDExMTIwMDAwMDBaFw0xMTExMTIyMzU5
NTlaMIIBCjEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
dXN0IE5ldHdvcmsxRjBEBgNVBAsTPXd3dy52ZXJpc2lnbi5jb20vcmVwb3NpdG9yeS9SUEEg
SW5jb3JwLiBieSBSZWYuLExJQUIuTFREKGMpOTgxHjAcBgNVBAsTFVBlcnNvbmEgTm90IFZh
bGlkYXRlZDEzMDEGA1UECxMqRGlnaXRhbCBJRCBDbGFzcyAxIC0gTmV0c2NhcGUgRnVsbCBT
ZXJ2aWNlMRMwEQYDVQQDFApKb3NlIEJhYXJzMRwwGgYJKoZIhvcNAQkBFg1wZXV0QHBldXQu
b3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr/QJrg4jLwhCrNdHOzbC5HFz
jE/FoklGXizIWpmW/bQOf6UQCVmJIPK7dsaJDz2zytkbrrre5s/qfPcNkSScKSOguxyBmnQ/
tW6Y0OnlYzv0ZrYyC0J8zzntDfZ5mLOzBTCYrGS0Pqy8n7vRScDT927/62dEfgHiA3ceWbc+
NCIJYdgupDjByypHgmi2H6JAiv6N16U2LRfM2ZNBu4RYgWHQp31Y9cX/a/CHEv1rG/5MPVDQ
P6t45saHKJN/gcH4oXeCfHINZ7iUJhIWpk9ipGEjwPLpgRAsGJFRHrZTBgOjrwrdzfrDgnKW
kB2RY+IAYQ7z+8+KJGHwfuWvsH2EbQIDAQABo4HoMIHlMAkGA1UdEwQCMAAwRAYDVR0gBD0w
OzA5BgtghkgBhvhFAQcXATAqMCgGCCsGAQUFBwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5j
b20vcnBhMAsGA1UdDwQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDBAYIKwYBBQUHAwIwFAYK
YIZIAYb4RQEGBwQGFgROb25lMFAGA1UdHwRJMEcwRaBDoEGGP2h0dHA6Ly9pbmRjMWRpZ2l0
YWxpZC1nMy1jcmwudmVyaXNpZ24uY29tL0luZEMxRGlnaXRhbElELUczLmNybDANBgkqhkiG
9w0BAQUFAAOCAQEA5nI96tQkbCelTz4bLtnc6uCIfbmE0slYOMLfmjwgXm0qJAMYCiBlhdBk
BeROwP9JkqIRHMOnPAGB/i9nz/6KeIJQEBKTClJMeU9NZ4VvIsmaTnEmL86fuDQygCYJXf7+
9PfIbK2BDQ9AsJtvLPfQXfMkATYEAP/dozXXZLiZ3p5sex3DzevIX8/TNjV4Vdt7S8rYXfLz
+yZh5bJVliScankYwcScVh/0kn0DLdq47DxOZANPISNkOF0yvfT/cTFMnLykCwtZiGGfRGl5
KAl6DSN0vn49B+M0QuvGAN/5itaGx4YCLMl10iganL8H2SHFW4a+BeKZ7t+1JG9l/YUGdTCC
Bu4wggXWoAMCAQICEHEVZgVK5JEhTem8RPms09wwDQYJKoZIhvcNAQEFBQAwgcoxCzAJBgNV
BAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1
c3QgTmV0d29yazE6MDgGA1UECxMxKGMpIDE5OTkgVmVyaVNpZ24sIEluYy4gLSBGb3IgYXV0
aG9yaXplZCB1c2Ugb25seTFFMEMGA1UEAxM8VmVyaVNpZ24gQ2xhc3MgMSBQdWJsaWMgUHJp
bWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA5MDUwMTAwMDAwMFoXDTE5
MDQzMDIzNTk1OVowgd0xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEf
MB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazE7MDkGA1UECxMyVGVybXMgb2YgdXNl
IGF0IGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9ycGEgKGMpMDkxHjAcBgNVBAsTFVBlcnNv
bmEgTm90IFZhbGlkYXRlZDE3MDUGA1UEAxMuVmVyaVNpZ24gQ2xhc3MgMSBJbmRpdmlkdWFs
IFN1YnNjcmliZXIgQ0EgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAO3E
R98qKB18Bmu71yEyyWwTj+mxjUFONPfaC+Nq+mWIIAsRE+mb4ElOi2/VAdBfDUeRilpMdD4/
xpEJu0w0no1uoYJRYvdpdliWB6+eFBgHT1q9n9IxslQZc0ZqGUIR7BJzIY313DDN5dlWCjHF
Nm0pFJe9LdqJRxmI2EsEPeu2PGcedAATDdCG2pNn+DMDrho8a2l49sAsjuGDP3f5mf/+n1Ja
wrSHCthsqUfBVCllQz5KwJYfwa33d69ssQRevsG2lC2XkC0n0rse6YNqhPbEsq4jBmUmpSdY
KwcitG+mYkgad/LVUCeaKdOW+yj1uiR2YuOMWev7btVCxL5Bx/UCAwEAAaOCArkwggK1MDQG
CCsGAQUFBwEBBCgwJjAkBggrBgEFBQcwAYYYaHR0cDovL29jc3AudmVyaXNpZ24uY29tMBIG
A1UdEwEB/wQIMAYBAf8CAQAwcAYDVR0gBGkwZzBlBgtghkgBhvhFAQcXATBWMCgGCCsGAQUF
BwIBFhxodHRwczovL3d3dy52ZXJpc2lnbi5jb20vY3BzMCoGCCsGAQUFBwICMB4aHGh0dHBz
Oi8vd3d3LnZlcmlzaWduLmNvbS9ycGEwNAYDVR0fBC0wKzApoCegJYYjaHR0cDovL2NybC52
ZXJpc2lnbi5jb20vcGNhMS1nMy5jcmwwDgYDVR0PAQH/BAQDAgEGMG4GCCsGAQUFBwEMBGIw
YKFeoFwwWjBYMFYWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFEtruSiWBgy70FI4mymsSweL
IQUYMCYWJGh0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28xLmdpZjAuBgNVHREEJzAl
pCMwITEfMB0GA1UEAxMWUHJpdmF0ZUxhYmVsNC0yMDQ4LTExODAdBgNVHQ4EFgQUeUdhCEH9
OASiS+e1zPVD9kkrEfgwgfEGA1UdIwSB6TCB5qGB0KSBzTCByjELMAkGA1UEBhMCVVMxFzAV
BgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3Jr
MTowOAYDVQQLEzEoYykgMTk5OSBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAxIFB1YmxpYyBQcmltYXJ5IENlcnRp
ZmljYXRpb24gQXV0aG9yaXR5IC0gRzOCEQCLW3VWhFSFCwDPrzhIzrGkMA0GCSqGSIb3DQEB
BQUAA4IBAQA5Tc9BmYG1qQW1UjjpOYSJbOQ0qFrn2GwJTCQaulmkhztzIfGTgc+/aGNaZ/41
hSuhw12jSsI6Gd0w1sxN7/HSgZfKVFpDvzeLeo4ZjQ9DqIzyr2CzFYqzlZw84J6zJ5ikNXIX
5fwqXYfTig3C0UUq+MD0rCqTOtWuEnAI6/s74nfs6CtkNXbNutrg0csU1nFYm77VPn222egk
xSRmTF2RH3azFz5/DcYhiS+zN7ih/1yybUneZVJC+w6I0u1KHb9L4/jMcvpIDmWOScjW+JmY
O7eUPjFxBof6bFlTLtffK+1fYwCsFe0DuFUWjMZoA+ciqHMLsbyg2lJY3QoOf8GCMYIE7DCC
BOgCAQEwgfIwgd0xCzAJBgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0G
A1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazE7MDkGA1UECxMyVGVybXMgb2YgdXNlIGF0
IGh0dHBzOi8vd3d3LnZlcmlzaWduLmNvbS9ycGEgKGMpMDkxHjAcBgNVBAsTFVBlcnNvbmEg
Tm90IFZhbGlkYXRlZDE3MDUGA1UEAxMuVmVyaVNpZ24gQ2xhc3MgMSBJbmRpdmlkdWFsIFN1
YnNjcmliZXIgQ0EgLSBHMwIQFQ/FN5RhWJszXlXtJ0jhhzAJBgUrDgMCGgUAoIICzjAYBgkq
hkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xMTA1MjExMDU3NTJaMCMG
CSqGSIb3DQEJBDEWBBT3zACx10X5pOdovbb0h12P1LX3WTBfBgkqhkiG9w0BCQ8xUjBQMAsG
CWCGSAFlAwQBAjAKBggqhkiG9w0DBzAOBggqhkiG9w0DAgICAIAwDQYIKoZIhvcNAwICAUAw
BwYFKw4DAgcwDQYIKoZIhvcNAwICASgwggEDBgkrBgEEAYI3EAQxgfUwgfIwgd0xCzAJBgNV
BAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1
c3QgTmV0d29yazE7MDkGA1UECxMyVGVybXMgb2YgdXNlIGF0IGh0dHBzOi8vd3d3LnZlcmlz
aWduLmNvbS9ycGEgKGMpMDkxHjAcBgNVBAsTFVBlcnNvbmEgTm90IFZhbGlkYXRlZDE3MDUG
A1UEAxMuVmVyaVNpZ24gQ2xhc3MgMSBJbmRpdmlkdWFsIFN1YnNjcmliZXIgQ0EgLSBHMwIQ
FQ/FN5RhWJszXlXtJ0jhhzCCAQUGCyqGSIb3DQEJEAILMYH1oIHyMIHdMQswCQYDVQQGEwJV
UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5l
dHdvcmsxOzA5BgNVBAsTMlRlcm1zIG9mIHVzZSBhdCBodHRwczovL3d3dy52ZXJpc2lnbi5j
b20vcnBhIChjKTA5MR4wHAYDVQQLExVQZXJzb25hIE5vdCBWYWxpZGF0ZWQxNzA1BgNVBAMT
LlZlcmlTaWduIENsYXNzIDEgSW5kaXZpZHVhbCBTdWJzY3JpYmVyIENBIC0gRzMCEBUPxTeU
YVibM15V7SdI4YcwDQYJKoZIhvcNAQEBBQAEggEAS0Co1QedwFP8fW0fG9yl3LEuCZfbiaX9
xWOpspNdQu50qPs9H+BOqzFQadxzAWZRl40lKztnn2A9veKMH6IGrjzK3xHm3Zdr9Tfo9gbc
5hHnMY/Fc0jtoQW7IjOrLjyIwZzz8P+emTkR01Tpw/lIFCmp4jod6bN1Ifq8x+b4gvNtYWHc
+Ob+Di89rW72BMho0X8qltik7jobQFiwgsDoWkshjtcgNGGI0zOuBqDyWipuhN6tj8Jc4EN9
cEhGo4+QcjvtisKJu84PjMjqV8d/fBfAaf6FiTtRHJtQ+qFttV7UfWQIn9pqD1iijKObAB2m
FHQrJGjM6kN3xSBtn5zTzwAAAAAAAA==
--------------ms080601050104070807090104--

--===============1296556000==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============1296556000==--

From libssh2-devel-bounces@cool.haxx.se  Tue May 24 08:40:48 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4O6eGOe009424;
	Tue, 24 May 2011 08:40:43 +0200
Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com
	[209.85.210.54])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4O6eDcG009174
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 08:40:14 +0200
Received: by pzk27 with SMTP id 27so3512935pzk.41
	for <libssh2-devel@cool.haxx.se>; Mon, 23 May 2011 23:40:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:date:x-google-sender-auth
	:message-id:subject:from:to:content-type;
	bh=EiROJndN2UX50ED5KBzbzPchFLbLx86suLeMLdCA2s0=;
	b=SEswOD7QNQmvhTn+Bbl68TQAffO7kal0iYbEjxMbdBbUioySry0YDiPtARPitOFgY+
	K+qWuZYkxIpZsAjMK0yeIYzBt52l+YQCp8PUCB6VCOlEA/D4mxvLf6nAt1VIrpzYvviB
	LBxjUVW4N1gJltbeUhljrrJKys1xLkk5KGKT4=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:date:x-google-sender-auth:message-id:subject
	:from:to:content-type;
	b=nARPMWVlC4LkseK043SkT2r6vxjb3kXX4LRXwBH6S0vuTgwgmp/1zOFM3SrlnnWErl
	yijUhKY8JGirqzTJsm6gkpZPwSsuyI/MWOWNC1aFGduFt1afDaffoFSSZPwd0R23Mviz
	1gL3DNzfCYC6Dd+CSyrhIXd1EfXlye7QWYAX4=
MIME-Version: 1.0
Received: by 10.142.180.12 with SMTP id c12mr981000wff.298.1306219209075; Mon,
	23 May 2011 23:40:09 -0700 (PDT)
Received: by 10.143.5.12 with HTTP; Mon, 23 May 2011 23:40:09 -0700 (PDT)
Date: Tue, 24 May 2011 16:40:09 +1000
X-Google-Sender-Auth: ud-BjUXKkRAGHlb9Qrb-h61GHCI
Message-ID: <BANLkTi=ENLpsuYtfG+0uEy=-Z2a-2iCohg@mail.gmail.com>
Subject: configure with non standard openssl installation path
From: Bill Segall <bill@segall.net>
To: libssh2-devel@cool.haxx.se
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 24 May 2011 08:40:48 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 24 May 2011 08:40:15 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1335169573=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

--===============1335169573==
Content-Type: multipart/alternative; boundary=000e0cd15178f4acae04a3ffdbec

--000e0cd15178f4acae04a3ffdbec
Content-Type: text/plain; charset=ISO-8859-1

I'm endeavouring to cross-compile libssh2-1.2.8 but I don't see a valid
mechanism for telling configure the location of my openssl libraries.

configure.ac seems to understand a --with-openssl which tells it that I
should use that over gcrypt and it alludes to a --wtih-libssl-prefix= option
but that seems not to actually have been implemented. As I'm cross-compiling
libssh isn't going to be found in my system path.

I would normally have reported this as a bug in your system but selecting
google openid from http://trac.libssh2.org/openidlogin reports:

Error in discovery: Error fetching XRDS document: (60, 'SSL certificate
problem, verify that the CA cert is OK. Details:\nerror:14090086:SSL
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed')

Thanks,
Bill.

--000e0cd15178f4acae04a3ffdbec
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I&#39;m endeavouring to cross-compile libssh2-1.2.8 but I don&#39;t see a v=
alid mechanism for telling configure the location of my openssl libraries.<=
br><br><a href=3D"http://configure.ac">configure.ac</a> seems to understand=
 a --with-openssl which tells it that I should use that over gcrypt and it =
alludes to a --wtih-libssl-prefix=3D option but that seems not to actually =
have been implemented. As I&#39;m cross-compiling libssh isn&#39;t going to=
 be found in my system path.<br>
<br>I would normally have reported this as a bug in your system but selecti=
ng google openid from <a href=3D"http://trac.libssh2.org/openidlogin">http:=
//trac.libssh2.org/openidlogin</a> reports:<br><br>Error in discovery: Erro=
r fetching XRDS document: (60, &#39;SSL certificate=20
problem, verify that the CA cert is OK. Details:\nerror:14090086:SSL=20
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed&#39;)<br><br=
>Thanks,<br>Bill.<br>

--000e0cd15178f4acae04a3ffdbec--

--===============1335169573==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============1335169573==--

From libssh2-devel-bounces@cool.haxx.se  Tue May 24 09:22:21 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4O7MFtK004999;
	Tue, 24 May 2011 09:22:20 +0200
Received: from yxa-v.extundo.com (yxa-v.extundo.com [213.115.69.139])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4O7MEk0004971
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 09:22:14 +0200
Received: from latte.josefsson.org (c80-216-4-108.bredband.comhem.se
	[80.216.4.108]) (authenticated bits=0)
	by yxa-v.extundo.com (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id
	p4O7M8VT011963
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 09:22:10 +0200
From: Simon Josefsson <simon@josefsson.org>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: configure with non standard openssl installation path
References: <BANLkTi=ENLpsuYtfG+0uEy=-Z2a-2iCohg@mail.gmail.com>
OpenPGP: id=B565716F; url=http://josefsson.org/key.txt
X-Hashcash: 1:22:110524:libssh2-devel@cool.haxx.se::0bl9zComuZtrzDY0:6Zml
Date: Tue, 24 May 2011 09:22:08 +0200
In-Reply-To: <BANLkTi=ENLpsuYtfG+0uEy=-Z2a-2iCohg@mail.gmail.com> (Bill
	Segall's message of "Tue, 24 May 2011 16:40:09 +1000")
Message-ID: <877h9gsgv3.fsf@latte.josefsson.org>
User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/23.2 (gnu/linux)
MIME-Version: 1.0
X-Spam-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_00,
	DATE_IN_FUTURE_96_XX,RDNS_DYNAMIC,SPF_FAIL autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on yxa-v.extundo.com
X-Virus-Scanned: clamav-milter 0.97 at yxa-v
X-Virus-Status: Clean
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 24 May 2011 09:22:21 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 24 May 2011 09:22:14 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

Bill Segall <bill@segall.net> writes:

> I'm endeavouring to cross-compile libssh2-1.2.8 but I don't see a valid
> mechanism for telling configure the location of my openssl libraries.
>
> configure.ac seems to understand a --with-openssl which tells it that I
> should use that over gcrypt and it alludes to a --wtih-libssl-prefix= option
> but that seems not to actually have been implemented. As I'm cross-compiling
> libssh isn't going to be found in my system path.

It is implemented.  What are the commands you are using, and what error
do you get?

Normally you either use ./configure CPPFLAGS=foo LDFLAGS=bar to hard
code library settings, but you can also use ./configure --with-openssl
--with-libssl-prefix=/foo/bar/root/usr to do it in a platform
independent way.

/Simon
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May 24 12:25:46 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4OAP1xZ020263;
	Tue, 24 May 2011 12:25:42 +0200
Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com
	[209.85.210.54])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4OAOwhg020207
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 12:24:59 +0200
Received: by pzk27 with SMTP id 27so3580521pzk.41
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 03:24:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:content-type;
	bh=lxzJ6hE7pJ/9bU2Lm56x0wCtLjUlNvPHzJB/HhGhlcM=;
	b=vCRxdnTTsDmrJa7Rtxol7Ac4utgpiC72vFwBfJYHL5igemHzgpSLKBIHrXRZiGPiBc
	AK3DUFAiPwXA8w5eXgQEDJZ8APxz+uyupOJHxdEr6HQ5+18Z6ng7Icv1amA6xicupN9R
	kdk/fi+ehLia+NUNPA0rciwlqILSCmwMRrSqI=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:content-type;
	b=qKJA3YjGLNc9176yPg3uCn8RoYv9ZvmhiuRTWWBTSO7IpSnPO7EtHtBFA+btZXxW/3
	e58tpXm7uJ3h5hj6tGXyXJ8odZ7Ma11XtPjgphp101nUUA060q8fvKiDiPG79eU5OB6y
	V8yZAb5Y8Ugn3iNz7bOZo1jAVMSqsqgYsd+Jo=
MIME-Version: 1.0
Received: by 10.142.193.11 with SMTP id q11mr988223wff.355.1306232693304; Tue,
	24 May 2011 03:24:53 -0700 (PDT)
Received: by 10.143.5.12 with HTTP; Tue, 24 May 2011 03:24:53 -0700 (PDT)
In-Reply-To: <877h9gsgv3.fsf@latte.josefsson.org>
References: <BANLkTi=ENLpsuYtfG+0uEy=-Z2a-2iCohg@mail.gmail.com>
	<877h9gsgv3.fsf@latte.josefsson.org>
Date: Tue, 24 May 2011 20:24:53 +1000
X-Google-Sender-Auth: Vt15Zg91rI-tzDA17qjFflQw71A
Message-ID: <BANLkTi=hBBrDkPq3DqA6=tB0BB3f_N9tHA@mail.gmail.com>
Subject: Re: configure with non standard openssl installation path
From: Bill Segall <bill@segall.net>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 24 May 2011 12:25:46 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 24 May 2011 12:25:00 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============0219609173=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

--===============0219609173==
Content-Type: multipart/alternative; boundary=000e0cd1582eadad9004a402ff55

--000e0cd1582eadad9004a402ff55
Content-Type: text/plain; charset=ISO-8859-1

My configure line is:
./configure --build=x86_64-redhat-linux --host=mips64-octeon-linux-gnu
--target=mips64-octeon-linux-gnu
--prefix=/site/platforms/mips64-octeon-linux/stow/libssh2-1.2.8
--with-libssl-prefix=/site/platforms/mips64-octeon-linux/stow/openssl-0.9.8r
--with-openssl --enable-static --disable-shared

This reports:
checking for libssl... no
checking for libgcrypt... no
configure: error: cannot find OpenSSL or Libgcrypt,
try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH

That's the right path to my openssl build:

 $ ls /site/platforms/mips64-octeon-linux/stow/openssl-0.9.8r
bin/  include/  lib/  openssl/

config.log shows:
configure:12975:
/site/platforms/mips64-octeon-linux/ge-cavium-linux-sdk/OCTEON-SDK/tools-gcc-4.3/bin/mips64-octeon-linux-gnu-gcc
-o conftest -ggdb3 -O0 -Wall -Wextra   conftest.c  -lssl -lcrypto >&5
conftest.c:25:25: error: openssl/ssl.h: No such file or directory
configure:12975: $? = 1


Looking at my configure.ac I see no sign of an AC_ARG_WITH(libssl-prefix)

Thanks for any help,
Bill.

On Tue, May 24, 2011 at 5:22 PM, Simon Josefsson <simon@josefsson.org>wrote:

> Bill Segall <bill@segall.net> writes:
>
> > I'm endeavouring to cross-compile libssh2-1.2.8 but I don't see a valid
> > mechanism for telling configure the location of my openssl libraries.
> >
> > configure.ac seems to understand a --with-openssl which tells it that I
> > should use that over gcrypt and it alludes to a --wtih-libssl-prefix=
> option
> > but that seems not to actually have been implemented. As I'm
> cross-compiling
> > libssh isn't going to be found in my system path.
>
> It is implemented.  What are the commands you are using, and what error
> do you get?
>
> Normally you either use ./configure CPPFLAGS=foo LDFLAGS=bar to hard
> code library settings, but you can also use ./configure --with-openssl
> --with-libssl-prefix=/foo/bar/root/usr to do it in a platform
> independent way.
>
> /Simon
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>

--000e0cd1582eadad9004a402ff55
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

My configure line is:<br>./configure --build=3Dx86_64-redhat-linux --host=
=3Dmips64-octeon-linux-gnu --target=3Dmips64-octeon-linux-gnu --prefix=3D/s=
ite/platforms/mips64-octeon-linux/stow/libssh2-1.2.8 --with-libssl-prefix=
=3D/site/platforms/mips64-octeon-linux/stow/openssl-0.9.8r --with-openssl -=
-enable-static --disable-shared<br>
<br>This reports:<br>checking for libssl... no<br>checking for libgcrypt...=
 no<br>configure: error: cannot find OpenSSL or Libgcrypt,<br>try --with-li=
bssl-prefix=3DPATH or --with-libgcrypt-prefix=3DPATH<br><br>That&#39;s the =
right path to my openssl build:<br>
<br>=A0$ ls /site/platforms/mips64-octeon-linux/stow/openssl-0.9.8r<br>bin/=
=A0 include/=A0 lib/=A0 openssl/<br><br>config.log shows:<br>configure:1297=
5: /site/platforms/mips64-octeon-linux/ge-cavium-linux-sdk/OCTEON-SDK/tools=
-gcc-4.3/bin/mips64-octeon-linux-gnu-gcc -o conftest -ggdb3 -O0 -Wall -Wext=
ra=A0=A0 conftest.c=A0 -lssl -lcrypto &gt;&amp;5<br>
conftest.c:25:25: error: openssl/ssl.h: No such file or directory<br>config=
ure:12975: $? =3D 1<br><br><br>Looking at my <a href=3D"http://configure.ac=
">configure.ac</a> I see no sign of an AC_ARG_WITH(libssl-prefix)<br><br>Th=
anks for any help,<br>
Bill.<br><br><div class=3D"gmail_quote">On Tue, May 24, 2011 at 5:22 PM, Si=
mon Josefsson <span dir=3D"ltr">&lt;<a href=3D"mailto:simon@josefsson.org">=
simon@josefsson.org</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;=
">
<div class=3D"im">Bill Segall &lt;<a href=3D"mailto:bill@segall.net">bill@s=
egall.net</a>&gt; writes:<br>
<br>
&gt; I&#39;m endeavouring to cross-compile libssh2-1.2.8 but I don&#39;t se=
e a valid<br>
&gt; mechanism for telling configure the location of my openssl libraries.<=
br>
&gt;<br>
&gt; <a href=3D"http://configure.ac" target=3D"_blank">configure.ac</a> see=
ms to understand a --with-openssl which tells it that I<br>
&gt; should use that over gcrypt and it alludes to a --wtih-libssl-prefix=
=3D option<br>
&gt; but that seems not to actually have been implemented. As I&#39;m cross=
-compiling<br>
&gt; libssh isn&#39;t going to be found in my system path.<br>
<br>
</div>It is implemented. =A0What are the commands you are using, and what e=
rror<br>
do you get?<br>
<br>
Normally you either use ./configure CPPFLAGS=3Dfoo LDFLAGS=3Dbar to hard<br=
>
code library settings, but you can also use ./configure --with-openssl<br>
--with-libssl-prefix=3D/foo/bar/root/usr to do it in a platform<br>
independent way.<br>
<br>
/Simon<br>
_______________________________________________<br>
libssh2-devel <a href=3D"http://cool.haxx.se/cgi-bin/mailman/listinfo/libss=
h2-devel" target=3D"_blank">http://cool.haxx.se/cgi-bin/mailman/listinfo/li=
bssh2-devel</a><br>
</blockquote></div><br>

--000e0cd1582eadad9004a402ff55--

--===============0219609173==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============0219609173==--

From libssh2-devel-bounces@cool.haxx.se  Tue May 24 12:39:16 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4OAdA9n026264;
	Tue, 24 May 2011 12:39:15 +0200
Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com
	[209.85.160.54])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4OAd7lM026170
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 12:39:08 +0200
Received: by pwj8 with SMTP id 8so3631647pwj.41
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 03:39:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:date:x-google-sender-auth
	:message-id:subject:from:to:content-type;
	bh=unEaoIGDET91BzMRKpjjRpv35I2fFnPS0uIqbonGEMs=;
	b=Ufjb5jfIQjfrv+8rxYx4pxCZzcvH2IVue14gpIlYvjD5QsSjnkFJfGaIRBfMKpZNYC
	0EUSFqhhDZKpv0k3I+Dia8w4kLFLLfnZAxJU94dnfB/tj50pRJ7DovJgkd+tP9SQpeZj
	rpYe5OEKSWv2iilYGcv+DO6UQx5pz+wlM3wgw=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:date:x-google-sender-auth:message-id:subject
	:from:to:content-type;
	b=mDDuNZpFfa8sQUSzwVTyLzoVhNawldYS0CJZ4iyNR70GUklAl1o6UFJcFWldXkt6bG
	ClzYOUadgbJyfR8v5sSIbdeQuIR5bDOrGoh5egMs1/IE320h5zDhjNTsZmdzWD5fi9Al
	ojWNZzKiDfUeny5fD2c4YzzqXoFUF6lSAXVG0=
MIME-Version: 1.0
Received: by 10.142.208.1 with SMTP id f1mr1059620wfg.412.1306233544741; Tue,
	24 May 2011 03:39:04 -0700 (PDT)
Received: by 10.143.5.12 with HTTP; Tue, 24 May 2011 03:39:04 -0700 (PDT)
Date: Tue, 24 May 2011 20:39:04 +1000
X-Google-Sender-Auth: FZjY4JURgAsBDy2ryKsrvepfz4Y
Message-ID: <BANLkTi=4cGJ0-gR5UwOptXcP1VDtKHU+NA@mail.gmail.com>
Subject: A question about windows static library linkage
From: Bill Segall <bill@segall.net>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 24 May 2011 12:39:16 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 24 May 2011 12:39:09 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============0443876450=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

--===============0443876450==
Content-Type: multipart/alternative; boundary=000e0cd32c446d954004a403328e

--000e0cd32c446d954004a403328e
Content-Type: text/plain; charset=ISO-8859-1

Sorry to be asking so many questions today but I'm also endeavoring to build
libssh2 for Windows.

I want to use static libraries and to support MD, MDd, MT, and MTd variants
on both win32 and x64. (Don't ask!) We're using Visual Studio9.1 and I was
able to convert the VS6 dsw without any issues, cut it down to just the
win32/MD[d] build and with some tweaks get it to build the library for me
without any problems.

When building the sample against the static library I get libssh2 undefined
symbols of the form:
Error    1    error LNK2001: unresolved external symbol
__imp__libssh2_exit    simple.obj    tests

which is the result of not wanting the declspec(dllimport) definitinition in
libssh2.h to be active. I can resolve this by defining LIBSSH2_API in
sample.c but I wanted to check that was the correct usage of that in an
application. It struck me that this preprocessor symbol had the appearance
of being internal to the library and I thought I should ask whether this is
the defined mechanism for achieving static linkage on Windows.

Thanks again,
Bill.
PS. I'd be happy to provide a VS9.1 solution once it was complete if that
was useful.

--000e0cd32c446d954004a403328e
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Sorry to be asking so many questions today but I&#39;m also endeavoring to =
build libssh2 for Windows.<br><br>I want to use static libraries and to sup=
port MD, MDd, MT, and MTd variants on both win32 and x64. (Don&#39;t ask!) =
We&#39;re using Visual Studio9.1 and I was able to convert the VS6 dsw with=
out any issues, cut it down to just the win32/MD[d] build and with some twe=
aks get it to build the library for me without any problems.<br>
<br>When building the sample against the static library I get libssh2 undef=
ined symbols of the form:<br>Error=A0=A0=A0 1=A0=A0=A0 error LNK2001: unres=
olved external symbol __imp__libssh2_exit=A0=A0=A0 simple.obj=A0=A0=A0 test=
s<br><br>which is the result of not wanting the declspec(dllimport) definit=
inition in libssh2.h to be active. I can resolve this by defining LIBSSH2_A=
PI in sample.c but I wanted to check that was the correct usage of that in =
an application. It struck me that this preprocessor symbol had the appearan=
ce of being internal to the library and I thought I should ask whether this=
 is the defined mechanism for achieving static linkage on Windows.<br>
<br>Thanks again,<br>Bill.<br>PS. I&#39;d be happy to provide a VS9.1 solut=
ion once it was complete if that was useful.<br><br><br>

--000e0cd32c446d954004a403328e--

--===============0443876450==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============0443876450==--

From libssh2-devel-bounces@cool.haxx.se  Tue May 24 13:41:01 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4OBejJt000490;
	Tue, 24 May 2011 13:40:59 +0200
Received: from yxa-v.extundo.com (yxa-v.extundo.com [213.115.69.139])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4OBegtd000428
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 13:40:43 +0200
Received: from latte.josefsson.org (host-90-233-172-47.mobileonline.telia.com
	[90.233.172.47]) (authenticated bits=0)
	by yxa-v.extundo.com (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id
	p4OBeLdU024081
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 13:40:30 +0200
From: Simon Josefsson <simon@josefsson.org>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: configure with non standard openssl installation path
References: <BANLkTi=ENLpsuYtfG+0uEy=-Z2a-2iCohg@mail.gmail.com>
	<877h9gsgv3.fsf@latte.josefsson.org>
	<BANLkTi=hBBrDkPq3DqA6=tB0BB3f_N9tHA@mail.gmail.com>
OpenPGP: id=B565716F; url=http://josefsson.org/key.txt
X-Hashcash: 1:22:110524:libssh2-devel@cool.haxx.se::Ym9zJ5MZmc7dDiqX:N7B2
Date: Tue, 24 May 2011 13:40:20 +0200
Message-ID: <874o4knx7f.fsf@latte.josefsson.org>
MIME-Version: 1.0
X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_96_XX,
	RDNS_DYNAMIC,SPF_FAIL autolearn=no version=3.2.5
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on yxa-v.extundo.com
X-Virus-Scanned: clamav-milter 0.97 at yxa-v
X-Virus-Status: Clean
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 24 May 2011 13:41:01 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 24 May 2011 13:40:43 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

Bill Segall <bill@segall.net> writes:

> My configure line is:
> ./configure --build=x86_64-redhat-linux --host=mips64-octeon-linux-gnu
> --target=mips64-octeon-linux-gnu
> --prefix=/site/platforms/mips64-octeon-linux/stow/libssh2-1.2.8
> --with-libssl-prefix=/site/platforms/mips64-octeon-linux/stow/openssl-0.9.8r
> --with-openssl --enable-static --disable-shared
>
> This reports:
> checking for libssl... no
> checking for libgcrypt... no
> configure: error: cannot find OpenSSL or Libgcrypt,
> try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH
>
> That's the right path to my openssl build:
>
>  $ ls /site/platforms/mips64-octeon-linux/stow/openssl-0.9.8r
> bin/  include/  lib/  openssl/
>
> config.log shows:
> configure:12975:
> /site/platforms/mips64-octeon-linux/ge-cavium-linux-sdk/OCTEON-SDK/tools-gcc-4.3/bin/mips64-octeon-linux-gnu-gcc
> -o conftest -ggdb3 -O0 -Wall -Wextra   conftest.c  -lssl -lcrypto >&5
> conftest.c:25:25: error: openssl/ssl.h: No such file or directory
> configure:12975: $? = 1

Isn't there another attempt after that?  I think the code tries without
flags first, and then tries to add them to see if they are really
needed.

> Looking at my configure.ac I see no sign of an
> AC_ARG_WITH(libssl-prefix)

Check m4/lib*.m4.

/Simon

>
> Thanks for any help,
> Bill.
>
> On Tue, May 24, 2011 at 5:22 PM, Simon Josefsson <simon@josefsson.org>wrote:
>
>> Bill Segall <bill@segall.net> writes:
>>
>> > I'm endeavouring to cross-compile libssh2-1.2.8 but I don't see a valid
>> > mechanism for telling configure the location of my openssl libraries.
>> >
>> > configure.ac seems to understand a --with-openssl which tells it that I
>> > should use that over gcrypt and it alludes to a --wtih-libssl-prefix=
>> option
>> > but that seems not to actually have been implemented. As I'm
>> cross-compiling
>> > libssh isn't going to be found in my system path.
>>
>> It is implemented.  What are the commands you are using, and what error
>> do you get?
>>
>> Normally you either use ./configure CPPFLAGS=foo LDFLAGS=bar to hard
>> code library settings, but you can also use ./configure --with-openssl
>> --with-libssl-prefix=/foo/bar/root/usr to do it in a platform
>> independent way.
>>
>> /Simon
>> _______________________________________________
>> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>>
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May 24 13:43:20 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4OBhHsg003301;
	Tue, 24 May 2011 13:43:18 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4OBhG5V003271
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 13:43:16 +0200
Date: Tue, 24 May 2011 13:43:16 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: configure with non standard openssl installation path
In-Reply-To: <874o4knx7f.fsf@latte.josefsson.org>
Message-ID: <alpine.DEB.2.00.1105241342340.3206@tvnag.unkk.fr>
References: <BANLkTi=ENLpsuYtfG+0uEy=-Z2a-2iCohg@mail.gmail.com>
	<877h9gsgv3.fsf@latte.josefsson.org>
	<BANLkTi=hBBrDkPq3DqA6=tB0BB3f_N9tHA@mail.gmail.com>
	<874o4knx7f.fsf@latte.josefsson.org>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 24 May 2011 13:43:20 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 24 May 2011 13:43:16 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Tue, 24 May 2011, Simon Josefsson wrote:

>> Looking at my configure.ac I see no sign of an
>> AC_ARG_WITH(libssl-prefix)
>
> Check m4/lib*.m4.

It is slightly obfuscated. See m4/lib-link.m4 around line 157.

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May 24 14:19:36 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4OCJU1o024171;
	Tue, 24 May 2011 14:19:35 +0200
Received: from mail-px0-f177.google.com (mail-px0-f177.google.com
	[209.85.212.177])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4OCJSI7024152
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 14:19:29 +0200
Received: by pxi10 with SMTP id 10so4725569pxi.8
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 05:19:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:content-type;
	bh=tslH44zJ/j6ELcksPhAWBVMM/MaE0OB2N+0WNTTYg1s=;
	b=nHbUZOCbiyD+lasAnyCTin2hnCXEbaUU+BAfVGGqnw5RCfA2rzNmhlRhudWfiEa+QU
	Gtn6TauVmCOOc4+Z2uRXRq4K+/WmjWrgCTpU3kv9D1Wzaw4CQFAAaMEVM+Vk4dFJdDvX
	Ro3eJ/C1BxJHJWbWAOycwrlnrLhqJdLrtHzQA=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:sender:in-reply-to:references:date
	:x-google-sender-auth:message-id:subject:from:to:content-type;
	b=ngBeDBPTKCeUWRmxk7E4sfwz7VYPWJBp/c813KxtAlju5hZKgkmtsCFGqNYwfIHDiA
	xDM6/QTELLxD6ecti4ZtfAYnszWVEI2ECC6vVGSv/f/tVeOMjP4+AJE4Q6wY8UrGwNdb
	5Bqt4J9s/pHzLD2pmnt9vZgLtcJne1iozSqfc=
MIME-Version: 1.0
Received: by 10.142.193.11 with SMTP id q11mr1000996wff.355.1306239563858;
	Tue, 24 May 2011 05:19:23 -0700 (PDT)
Received: by 10.143.5.12 with HTTP; Tue, 24 May 2011 05:19:23 -0700 (PDT)
In-Reply-To: <alpine.DEB.2.00.1105241342340.3206@tvnag.unkk.fr>
References: <BANLkTi=ENLpsuYtfG+0uEy=-Z2a-2iCohg@mail.gmail.com>
	<877h9gsgv3.fsf@latte.josefsson.org>
	<BANLkTi=hBBrDkPq3DqA6=tB0BB3f_N9tHA@mail.gmail.com>
	<874o4knx7f.fsf@latte.josefsson.org>
	<alpine.DEB.2.00.1105241342340.3206@tvnag.unkk.fr>
Date: Tue, 24 May 2011 22:19:23 +1000
X-Google-Sender-Auth: CExTKif-oiaSOv5NITYcWB9MsVY
Message-ID: <BANLkTik1nEAR3+cfcLCEJj9fXfvWVaJvqg@mail.gmail.com>
Subject: Re: configure with non standard openssl installation path
From: Bill Segall <bill@segall.net>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 24 May 2011 14:19:36 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 24 May 2011 14:19:30 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1889456987=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

--===============1889456987==
Content-Type: multipart/alternative; boundary=000e0cd1582e3202e804a4049947

--000e0cd1582e3202e804a4049947
Content-Type: text/plain; charset=ISO-8859-1

Thanks, that was the hint I needed. By adding a set -x so I could see what
the shell was doing, I was able to determine that it was looking in
$withval/lib64 and by linking lib64 to lib I can get configure to run
successfully and appear sane.

I'm not quite of the woods yet with my libtool but that looks like I need to
specify some additional cross compile tools for my libtool.

Many thanks for your assistance.

Bill.

On Tue, May 24, 2011 at 9:43 PM, Daniel Stenberg <daniel@haxx.se> wrote:

> On Tue, 24 May 2011, Simon Josefsson wrote:
>
>  Looking at my configure.ac I see no sign of an
>>> AC_ARG_WITH(libssl-prefix)
>>>
>>
>> Check m4/lib*.m4.
>>
>
> It is slightly obfuscated. See m4/lib-link.m4 around line 157.
>
> --
>
>  / daniel.haxx.se
>
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>

--000e0cd1582e3202e804a4049947
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Thanks, that was the hint I needed. By adding a set -x so I could see what =
the shell was doing, I was able to determine that it was looking in $withva=
l/lib64 and by linking lib64 to lib I can get configure to run successfully=
 and appear sane.<br>
<br>I&#39;m not quite of the woods yet with my libtool but that looks like =
I need to specify some additional cross compile tools for my libtool.<br><b=
r>Many thanks for your assistance.<br><br>Bill.<br><br><div class=3D"gmail_=
quote">
On Tue, May 24, 2011 at 9:43 PM, Daniel Stenberg <span dir=3D"ltr">&lt;<a h=
ref=3D"mailto:daniel@haxx.se">daniel@haxx.se</a>&gt;</span> wrote:<br><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex;">
<div class=3D"im">On Tue, 24 May 2011, Simon Josefsson wrote:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><blockquote class=3D"gmail_quote" style=3D"m=
argin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Looking at my <a href=3D"http://configure.ac" target=3D"_blank">configure.a=
c</a> I see no sign of an<br>
AC_ARG_WITH(libssl-prefix)<br>
</blockquote>
<br>
Check m4/lib*.m4.<br>
</blockquote>
<br></div>
It is slightly obfuscated. See m4/lib-link.m4 around line 157.<br><font col=
or=3D"#888888">
<br>
-- <br>
<br>
=A0/ <a href=3D"http://daniel.haxx.se" target=3D"_blank">daniel.haxx.se</a>=
</font><div><div></div><div class=3D"h5"><br>
_______________________________________________<br>
libssh2-devel <a href=3D"http://cool.haxx.se/cgi-bin/mailman/listinfo/libss=
h2-devel" target=3D"_blank">http://cool.haxx.se/cgi-bin/mailman/listinfo/li=
bssh2-devel</a><br>
</div></div></blockquote></div><br>

--000e0cd1582e3202e804a4049947--

--===============1889456987==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============1889456987==--

From libssh2-devel-bounces@cool.haxx.se  Wed May 25 03:00:00 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4P0xdGZ021136;
	Wed, 25 May 2011 02:59:57 +0200
Received: from mail102.csoft.net (postfix@mail102.csoft.net [205.205.219.4])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4P0xclo021133
	for <libssh2-devel@cool.haxx.se>; Wed, 25 May 2011 02:59:38 +0200
Received: from mail102.csoft.net (localhost [127.0.0.1])
	by mail102.csoft.net (Postfix) with ESMTP id B770F3EF1771
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 20:59:45 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=csoft.net; h=message-id
	:date:from:mime-version:to:subject:content-type
	:content-transfer-encoding; s=sel1; bh=To7981ohfRr52j/k5mZ/O/juK
	Lw=; b=R1DyG9jOVgOTYY5Gnq6dDyhbMK6nF6iuDPSp7OjFm4qWgnGBeyTTZxazU
	XN92QWTgAW5IxOWxdP76cehWjbP6I81zidgQMaQB1VKLGNebCXvgt3BWL/eIvWok
	z1tH67jLcsGhDk6UthnyrdMPypb8y8fh3/p7YznZZDsLuTQARY=
Received: from [172.28.133.90] (natint3.juniper.net [66.129.224.36])
	(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by mail102.csoft.net (Postfix) with ESMTPSA id 5198C3EF0856
	for <libssh2-devel@cool.haxx.se>; Tue, 24 May 2011 20:59:45 -0400 (EDT)
Message-ID: <4DDC5476.3010309@fid4.com>
Date: Tue, 24 May 2011 20:59:34 -0400
From: "Michael C. Cambria" <mcc@fid4.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
	rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
MIME-Version: 1.0
To: libssh2-devel@cool.haxx.se
Subject: Starting a subsystem other than e.g. sftp
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 25 May 2011 03:00:00 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 25 May 2011 02:59:38 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se


Hi,

Is there a way to supply to libssh2 the name of an external subsystem 
which sshd is to use (similar to "-s my-subsystem" on the command line 
in OpenSSH?)

Thanks,
MikeC


_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Wed May 25 16:20:46 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4PEKLS9018881;
	Wed, 25 May 2011 16:20:42 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4PEKJxI018838
	for <libssh2-devel@cool.haxx.se>; Wed, 25 May 2011 16:20:19 +0200
Date: Wed, 25 May 2011 16:20:19 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: Starting a subsystem other than e.g. sftp
In-Reply-To: <4DDC5476.3010309@fid4.com>
Message-ID: <alpine.DEB.2.00.1105251617540.31993@tvnag.unkk.fr>
References: <4DDC5476.3010309@fid4.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Wed, 25 May 2011 16:20:46 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Wed, 25 May 2011 16:20:19 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Tue, 24 May 2011, Michael C. Cambria wrote:

> Is there a way to supply to libssh2 the name of an external subsystem which 
> sshd is to use (similar to "-s my-subsystem" on the command line in 
> OpenSSH?)

You can start a custom subsystem with libssh2_channel_process_startup(). 
Something like:

   libssh2_channel_process_startup(handle, "subsystem", 9,
 				  "my-subsystem", 12);

You can probably check out the sftp.c code to get inspiration, since SFTP is a 
subsystem.

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Sun May 29 21:54:31 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4TJs5to007803;
	Sun, 29 May 2011 21:54:27 +0200
Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com
	[74.125.83.182])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4TJs2RF007716
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Sun, 29 May 2011 21:54:04 +0200
Received: by pvg11 with SMTP id 11so1729667pvg.41
	for <libssh2-devel@cool.haxx.se>; Sun, 29 May 2011 12:53:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:date:message-id:subject:from:to
	:content-type; bh=exAwPfoBf6i1Vt480GY9JJZhxfe724cg+CRI9nM3YT8=;
	b=RF2q0OPP31nvMIEpy9uy8UCFapP8dxnCGiwI2rLtu4RlJy7YiPyOuePfwvjHYvNHrZ
	hvRS9Nwe/Shf9Uk9REVwcTTiz3W8GSbwMSQ1B1qvWv2PipN1t1wUNrZVEoaqbxaJTAxZ
	Z8/BdJXPX+lPjFaVQROtiLrpEafcnCruscNw0=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:date:message-id:subject:from:to:content-type;
	b=mkyqI7t4VWJNwXZ0o/wH8/Tsf4F3X4A+iHcQSvfvFyiKJbXfrKj1oEKT6IUOf6Wxmx
	gscxlakVQDHTrpH3sue1JJCPFGIP970OHo+KwGaNLdE53Ze2sVvD1A1dw+r7HdgdT6DZ
	owhopHNG17FGEwJ2uq98EqaWrojym6uvAno2c=
MIME-Version: 1.0
Received: by 10.68.17.99 with SMTP id n3mr1733013pbd.351.1306698839612; Sun,
	29 May 2011 12:53:59 -0700 (PDT)
Received: by 10.68.71.165 with HTTP; Sun, 29 May 2011 12:53:59 -0700 (PDT)
Date: Sun, 29 May 2011 15:53:59 -0400
Message-ID: <BANLkTinWNhuCs-DJ7+b4V_=nA5hOqyD6xA@mail.gmail.com>
Subject: Core dump when authentication fails?
From: Saqib Ali <saqib.ali.75@gmail.com>
To: libssh2-devel@cool.haxx.se
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Sun, 29 May 2011 21:54:31 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Sun, 29 May 2011 21:54:04 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1085982220=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

--===============1085982220==
Content-Type: multipart/alternative; boundary=bcaec52161f129dc4e04a46f881f

--bcaec52161f129dc4e04a46f881f
Content-Type: text/plain; charset=ISO-8859-1

Cross posted from: http://curl.haxx.se/mail/lib-2011-05/0209.html


I'm using Curl version 7.21.5 to do SFTP uploads from a Solaris 10 box.
It works fine for me when I give it valid parameters (username, password,
IP
address)

However, I'm testing it in the exact same scenario -- only with the wrong
password. I'm expecting that it will be stopped because the transfer is
interrupted by the timeout duration.. But instead of that, I'm getting a
core dump. (See below)

Has anyone else seen this behavior? What is the correct expected behavior
when the user authentication fails?

- Saqib

* About to connect() to xxx.xxx.xxx.xxx port 22 (#0)
* Trying xxx.xxx.xxx.xxx... * 0xbce30 is at send pipe head!
* STATE: CONNECT => WAITCONNECT handle 0x93cb0; (connection #0)
* Connected to xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) port 22 (#0)
* SFTP 0xdcc38 state change from SSH_STOP to SSH_S_STARTUP
* SFTP 0xdcc38 state change from SSH_S_STARTUP to SSH_HOSTKEY
* SFTP 0xdcc38 state change from SSH_HOSTKEY to SSH_AUTHLIST
* STATE: WAITCONNECT => PROTOCONNECT handle 0x93cb0; (connection #0)
* SSH authentication methods available:
gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
* SFTP 0xdcc38 state change from SSH_AUTHLIST to SSH_AUTH_PKEY_INIT
* Using ssh public key file /SS8/users/lis/.ssh/id_dsa.pub
* Using ssh private key file /SS8/users/lis/.ssh/id_dsa
* SFTP 0xdcc38 state change from SSH_AUTH_PKEY_INIT to SSH_AUTH_PKEY
* SSH public key authentication failed: Unable to open public key file
* SFTP 0xdcc38 state change from SSH_AUTH_PKEY to SSH_AUTH_PASS_INIT
* SFTP 0xdcc38 state change from SSH_AUTH_PASS_INIT to SSH_AUTH_PASS
* SFTP 0xdcc38 state change from SSH_AUTH_PASS to SSH_AUTH_HOST_INIT
* SFTP 0xdcc38 state change from SSH_AUTH_HOST_INIT to SSH_AUTH_KEY_INIT
* SFTP 0xdcc38 state change from SSH_AUTH_KEY_INIT to SSH_AUTH_KEY
Assertion failed: wantedsize != 0, file memdebug.c, line 136

Abort (core dumped)


- Saqib

--bcaec52161f129dc4e04a46f881f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div><br></div><div>Cross posted from:=A0<a href=3D"http://curl.haxx.se/mai=
l/lib-2011-05/0209.html">http://curl.haxx.se/mail/lib-2011-05/0209.html</a>=
</div><div><br></div><div><br></div><div><span class=3D"Apple-style-span" s=
tyle=3D"font-family: arial, helvetica, ariel, sans-serif; font-size: 15px; =
"><p>
I&#39;m using Curl version 7.21.5 to do SFTP uploads from a Solaris 10 box.=
=A0<br>It works fine for me when I give it valid parameters (username, pass=
word, IP=A0<br>address)=A0<br></p><p>However, I&#39;m testing it in the exa=
ct same scenario -- only with the wrong=A0<br>
password. I&#39;m expecting that it will be stopped because the transfer is=
=A0<br>interrupted by the timeout duration.. But instead of that, I&#39;m g=
etting a=A0<br>core dump. (See below)=A0<br></p><p>Has anyone else seen thi=
s behavior? What is the correct expected behavior=A0<br>
when the user authentication fails?=A0<br></p><p>- Saqib=A0<br></p><p></p><=
p>* About to connect() to xxx.xxx.xxx.xxx port 22 (#0)=A0<br>* Trying xxx.x=
xx.xxx.xxx... * 0xbce30 is at send pipe head!=A0<br>* STATE: CONNECT =3D&gt=
; WAITCONNECT handle 0x93cb0; (connection #0)=A0<br>
* Connected to xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) port 22 (#0)=A0<br>* SFTP =
0xdcc38 state change from SSH_STOP to SSH_S_STARTUP=A0<br>* SFTP 0xdcc38 st=
ate change from SSH_S_STARTUP to SSH_HOSTKEY=A0<br>* SFTP 0xdcc38 state cha=
nge from SSH_HOSTKEY to SSH_AUTHLIST=A0<br>
* STATE: WAITCONNECT =3D&gt; PROTOCONNECT handle 0x93cb0; (connection #0)=
=A0<br>* SSH authentication methods available:=A0<br>gssapi-keyex,gssapi-wi=
th-mic,publickey,password,keyboard-interactive=A0<br>* SFTP 0xdcc38 state c=
hange from SSH_AUTHLIST to SSH_AUTH_PKEY_INIT=A0<br>
* Using ssh public key file /SS8/users/lis/.ssh/id_dsa.pub=A0<br>* Using ss=
h private key file /SS8/users/lis/.ssh/id_dsa=A0<br>* SFTP 0xdcc38 state ch=
ange from SSH_AUTH_PKEY_INIT to SSH_AUTH_PKEY=A0<br>* SSH public key authen=
tication failed: Unable to open public key file=A0<br>
* SFTP 0xdcc38 state change from SSH_AUTH_PKEY to SSH_AUTH_PASS_INIT=A0<br>=
* SFTP 0xdcc38 state change from SSH_AUTH_PASS_INIT to SSH_AUTH_PASS=A0<br>=
* SFTP 0xdcc38 state change from SSH_AUTH_PASS to SSH_AUTH_HOST_INIT=A0<br>=
* SFTP 0xdcc38 state change from SSH_AUTH_HOST_INIT to SSH_AUTH_KEY_INIT=A0=
<br>
* SFTP 0xdcc38 state change from SSH_AUTH_KEY_INIT to SSH_AUTH_KEY=A0<br>As=
sertion failed: wantedsize !=3D 0, file memdebug.c, line 136=A0<br></p><p>A=
bort (core dumped)=A0</p></span></div><div><br></div><br clear=3D"all">- Sa=
qib<br>
<br><br>

--bcaec52161f129dc4e04a46f881f--

--===============1085982220==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============1085982220==--

From libssh2-devel-bounces@cool.haxx.se  Sun May 29 23:21:14 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4TLKwDF016868;
	Sun, 29 May 2011 23:21:12 +0200
Received: from mail102.csoft.net (postfix@mail102.csoft.net [205.205.219.4])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4TLKuTX016846
	for <libssh2-devel@cool.haxx.se>; Sun, 29 May 2011 23:20:56 +0200
Received: from mail102.csoft.net (localhost [127.0.0.1])
	by mail102.csoft.net (Postfix) with ESMTP id 9C2853EF174F
	for <libssh2-devel@cool.haxx.se>; Sun, 29 May 2011 17:20:56 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=csoft.net; h=message-id
	:date:from:mime-version:to:subject:references:in-reply-to
	:content-type:content-transfer-encoding; s=sel1; bh=2W4XZBZb9v28
	sMXD9e2cig+j7bU=; b=aSqzI5nPK+MInhAX/T1URVurdAf7YNDkUXLUVQxFJh6O
	3GUK+imPPNtmYj92CIbB8sSR6tlkGqXaBrXWTJQSKc5KXkVKLgXwrO6UEDpmJSWn
	RAtl/ZiI9SjBZWreyVlcwU5ZrerBnI1YAb4pR8+5VwMY9gUZJJ/qI3BupZPYIvA=
Received: from [172.16.8.69] (c-24-34-109-241.hsd1.ma.comcast.net
	[24.34.109.241])
	(using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by mail102.csoft.net (Postfix) with ESMTPSA id 7395A3EF174E
	for <libssh2-devel@cool.haxx.se>; Sun, 29 May 2011 17:20:56 -0400 (EDT)
Message-ID: <4DE2B8B1.9050101@fid4.com>
Date: Sun, 29 May 2011 17:20:49 -0400
From: "Michael C. Cambria" <mcc@fid4.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
	rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
MIME-Version: 1.0
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: Starting a subsystem other than e.g. sftp
References: <4DDC5476.3010309@fid4.com>
In-Reply-To: <4DDC5476.3010309@fid4.com>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Sun, 29 May 2011 23:21:14 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Sun, 29 May 2011 23:20:56 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se


On 5/24/2011 8:59 PM, Michael C. Cambria wrote:
>
> Hi,
>
> Is there a way to supply to libssh2 the name of an external subsystem 
> which sshd is to use (similar to "-s my-subsystem" on the command line 
> in OpenSSH?)
>

  libssh2_channel_subsystem(channel, commandline) seems to work for me 
as well



_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon May 30 10:35:31 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4U8Z9Y7008921;
	Mon, 30 May 2011 10:35:28 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4U8Z7MJ008911
	for <libssh2-devel@cool.haxx.se>; Mon, 30 May 2011 10:35:07 +0200
Date: Mon, 30 May 2011 10:35:06 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: Core dump when authentication fails?
In-Reply-To: <BANLkTinWNhuCs-DJ7+b4V_=nA5hOqyD6xA@mail.gmail.com>
Message-ID: <alpine.DEB.2.00.1105301027580.31551@tvnag.unkk.fr>
References: <BANLkTinWNhuCs-DJ7+b4V_=nA5hOqyD6xA@mail.gmail.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Mon, 30 May 2011 10:35:31 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Mon, 30 May 2011 10:35:07 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Sun, 29 May 2011, Saqib Ali wrote:

> Cross posted from: http://curl.haxx.se/mail/lib-2011-05/0209.html

Allow me to it-iterate here what I mention on the libcurl list: that check is 
libcurl's way to detect problems in libcurl and not necessarily an error when 
made by "others" such as libssh2. Also, the assert() you see in libcurl is 
only present when you build libcurl debug-enabled and thus it will behave 
differently if you build a "normal" build.

I do however think it is a REALLY bad idea to malloc() zero bytes (because we 
can't rely on the return code) so we should correct libssh2 to not do that.

I guess the code for the keyboard-interactive auth must not assume that the 
data that arrives actually has non-zero lengths.

> Has anyone else seen this behavior? What is the correct expected behavior 
> when the user authentication fails?

Please don't assume that people on this list knows about libcurl or cares 
about it to any particular extent. This list is about libssh2.

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May 31 23:38:08 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4VLbjgb007572;
	Tue, 31 May 2011 23:38:04 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4VLbiGt007564
	for <libssh2-devel@cool.haxx.se>; Tue, 31 May 2011 23:37:44 +0200
Date: Tue, 31 May 2011 23:37:44 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: timeouts in libssh2 blocking-mode
In-Reply-To: <4DC07E17.7080106@securitease.com>
Message-ID: <alpine.DEB.2.00.1105312336280.26627@tvnag.unkk.fr>
References: <4DBE40D6.9010703@securitease.com>
	<20110502063335.20480.qmail@stuge.se>
	<4DBF104B.2010508@securitease.com>
	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>
	<4DBF3D9D.7080800@securitease.com>
	<20110502235937.32306.qmail@stuge.se>
	<4DBF4A05.9050403@securitease.com> <20110503004825.5079.qmail@stuge.se>
	<4DBF5418.4040706@securitease.com>
	<alpine.DEB.2.00.1105031421340.23604@tvnag.unkk.fr>
	<4DC06BDA.2040605@securitease.com>
	<alpine.DEB.2.00.1105032301040.30916@tvnag.unkk.fr>
	<4DC07E17.7080106@securitease.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 31 May 2011 23:38:08 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 31 May 2011 23:37:44 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Wed, 4 May 2011, Matt Lilley wrote:

> I think this patch does that - but it's early in the morning still. Let me 
> know what you think

It just struck me today when browsing this code (again) that your fix 
completely left out the majority of all users: those who use poll()...

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May 31 23:38:59 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4VLcv3s007842;
	Tue, 31 May 2011 23:38:58 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4VLcv6K007836
	for <libssh2-devel@cool.haxx.se>; Tue, 31 May 2011 23:38:57 +0200
Date: Tue, 31 May 2011 23:38:57 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: Core dump when authentication fails?
In-Reply-To: <alpine.DEB.2.00.1105301027580.31551@tvnag.unkk.fr>
Message-ID: <alpine.DEB.2.00.1105312338170.26627@tvnag.unkk.fr>
References: <BANLkTinWNhuCs-DJ7+b4V_=nA5hOqyD6xA@mail.gmail.com>
	<alpine.DEB.2.00.1105301027580.31551@tvnag.unkk.fr>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 31 May 2011 23:38:59 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 31 May 2011 23:38:57 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Mon, 30 May 2011, Daniel Stenberg wrote:

> I guess the code for the keyboard-interactive auth must not assume that the 
> data that arrives actually has non-zero lengths.

I had an attempt at fixing that code just now and pushed my fixes to the git 
repo. Can you please try again with the current git version and see how it 
works for you?

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Tue May 31 23:46:43 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4VLkewg010529;
	Tue, 31 May 2011 23:46:43 +0200
Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com
	[74.125.83.182])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4VLkbwK010518
	(version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
	for <libssh2-devel@cool.haxx.se>; Tue, 31 May 2011 23:46:38 +0200
Received: by pvg11 with SMTP id 11so2819185pvg.41
	for <libssh2-devel@cool.haxx.se>; Tue, 31 May 2011 14:46:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type;
	bh=fs+1akqv38aGx7hlXIqyhGBxNYe9IEOiw0osLXDl/hI=;
	b=OudsyGyoD6NeJsTqjJFNu88mTANPlGFX1wqRmUKbJwrRG93gU3VVLmeIJR4wNXEcnh
	dUoRdh+ooHcy4lMUxdRw+m3KuRPbftQLcsy3Cm9sQJMvRmjkAKbhJrEsDFb4UnbDGVIj
	SkFy26GC0HJ7PAdbDaXKjaTwHH7DU3dfFc0rs=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:date:message-id:subject:from:to
	:content-type;
	b=hyd8P3x7SaZ0l7RRoois0L2UAir8poh2u/rEi59fF82+JvnHs6/aZhsIOPqubM0Exb
	/OMLR7WnIWAJhlulBlRoKFVE1Ou5VMGulraNcSh7YA8oa2Uzmfpc7RAU1iPHTKzkwI6k
	7p6/KBfRlKhg4+Gun1sxtLKyCxybiu+Dl799o=
MIME-Version: 1.0
Received: by 10.68.17.195 with SMTP id q3mr2674614pbd.369.1306878393603; Tue,
	31 May 2011 14:46:33 -0700 (PDT)
Received: by 10.68.58.137 with HTTP; Tue, 31 May 2011 14:46:33 -0700 (PDT)
In-Reply-To: <alpine.DEB.2.00.1105312338170.26627@tvnag.unkk.fr>
References: <BANLkTinWNhuCs-DJ7+b4V_=nA5hOqyD6xA@mail.gmail.com>
	<alpine.DEB.2.00.1105301027580.31551@tvnag.unkk.fr>
	<alpine.DEB.2.00.1105312338170.26627@tvnag.unkk.fr>
Date: Tue, 31 May 2011 17:46:33 -0400
Message-ID: <BANLkTi=v0Ew4nuNAUChuGGdin1Nv3oyQhA@mail.gmail.com>
Subject: Re: Core dump when authentication fails?
From: Saqib Ali <saqib.ali.75@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 31 May 2011 23:46:43 +0200 (CEST)
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 31 May 2011 23:46:39 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============0997530561=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

--===============0997530561==
Content-Type: multipart/alternative; boundary=bcaec520ea3f6a555f04a49956ff

--bcaec520ea3f6a555f04a49956ff
Content-Type: text/plain; charset=ISO-8859-1

On Tue, May 31, 2011 at 5:38 PM, Daniel Stenberg <daniel@haxx.se> wrote:

> On Mon, 30 May 2011, Daniel Stenberg wrote:
>
>  I guess the code for the keyboard-interactive auth must not assume that
>> the data that arrives actually has non-zero lengths.
>>
>
> I had an attempt at fixing that code just now and pushed my fixes to the
> git repo. Can you please try again with the current git version and see how
> it works for you?
>
>
>
Sorry I didn't email previously about this. I didn't realize you were
waiting for me.
I made the patches you described in SSH2. Then I compiled CURL without the
-debug-enabled flag and it did work properly.

I'll still test your changes. But can I get them from the daily snapshot for
June 1, 2011?

--bcaec520ea3f6a555f04a49956ff
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div><br></div><br><div class=3D"gmail_quote">On Tue, May 31, 2011 at 5:38 =
PM, Daniel Stenberg <span dir=3D"ltr">&lt;<a href=3D"mailto:daniel@haxx.se"=
>daniel@haxx.se</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" =
style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class=3D"im">On Mon, 30 May 2011, Daniel Stenberg wrote:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
I guess the code for the keyboard-interactive auth must not assume that the=
 data that arrives actually has non-zero lengths.<br>
</blockquote>
<br></div>
I had an attempt at fixing that code just now and pushed my fixes to the gi=
t repo. Can you please try again with the current git version and see how i=
t works for you?<div><div></div><div class=3D"h5"><br><br></div></div></blo=
ckquote>
<div><br></div><div>Sorry I didn&#39;t email previously about this. I didn&=
#39;t realize you were waiting for me.=A0</div><div>I made the patches you =
described in SSH2. Then I compiled CURL without the -debug-enabled flag and=
 it did work properly.</div>
<div><br></div><div>I&#39;ll still test your changes. But can I get them fr=
om the daily snapshot for June 1, 2011?</div></div>

--bcaec520ea3f6a555f04a49956ff--

--===============0997530561==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--===============0997530561==--

From libssh2-devel-bounces@cool.haxx.se  Tue May 31 23:51:46 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4VLpg5V012266;
	Tue, 31 May 2011 23:51:45 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4VLpe77012259
	for <libssh2-devel@cool.haxx.se>; Tue, 31 May 2011 23:51:40 +0200
Date: Tue, 31 May 2011 23:51:40 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: [PATCH] Re: timeouts in libssh2 blocking-mode
In-Reply-To: <alpine.DEB.2.00.1105312336280.26627@tvnag.unkk.fr>
Message-ID: <alpine.DEB.2.00.1105312350000.26627@tvnag.unkk.fr>
References: <4DBE40D6.9010703@securitease.com>
	<20110502063335.20480.qmail@stuge.se>
	<4DBF104B.2010508@securitease.com>
	<alpine.DEB.2.00.1105022217080.21946@tvnag.unkk.fr>
	<4DBF3D9D.7080800@securitease.com>
	<20110502235937.32306.qmail@stuge.se>
	<4DBF4A05.9050403@securitease.com> <20110503004825.5079.qmail@stuge.se>
	<4DBF5418.4040706@securitease.com>
	<alpine.DEB.2.00.1105031421340.23604@tvnag.unkk.fr>
	<4DC06BDA.2040605@securitease.com>
	<alpine.DEB.2.00.1105032301040.30916@tvnag.unkk.fr>
	<4DC07E17.7080106@securitease.com>
	<alpine.DEB.2.00.1105312336280.26627@tvnag.unkk.fr>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED;
	BOUNDARY="1129329158-2020387728-1306878700=:26627"
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 31 May 2011 23:51:46 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 31 May 2011 23:51:40 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--1129329158-2020387728-1306878700=:26627
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Tue, 31 May 2011, Daniel Stenberg wrote:

> It just struck me today when browsing this code (again) that your fix 
> completely left out the majority of all users: those who use poll()...

Okay, I suggest a little massaging of the function like the attached patch to 
make the timeout work the same way when libssh2 is built to use poll().

I'm interested in a review/feedback. If nobody finds anything upsetting I'll 
push this in a day or two.

-- 

  / daniel.haxx.se
--1129329158-2020387728-1306878700=:26627
Content-Type: TEXT/x-diff; name=0001-_libssh2_wait_socket-fix-timeouts-for-poll-uses.patch
Content-Transfer-Encoding: BASE64
Content-ID: <alpine.DEB.2.00.1105312351400.26627@tvnag.unkk.fr>
Content-Description: 
Content-Disposition: attachment; filename=0001-_libssh2_wait_socket-fix-timeouts-for-poll-uses.patch

RnJvbSBhNWRlZjUyNzZjNWI1NmRkZTVhYTAwOWNjYjYzZjdmNWQ1M2I4NWRm
IE1vbiBTZXAgMTcgMDA6MDA6MDAgMjAwMQ0KRnJvbTogRGFuaWVsIFN0ZW5i
ZXJnIDxkYW5pZWxAaGF4eC5zZT4NCkRhdGU6IFR1ZSwgMzEgTWF5IDIwMTEg
MjM6NDk6MzIgKzAyMDANClN1YmplY3Q6IFtQQVRDSF0gX2xpYnNzaDJfd2Fp
dF9zb2NrZXQ6IGZpeCB0aW1lb3V0cyBmb3IgcG9sbCgpIHVzZXMNCg0KLS0t
DQogc3JjL3Nlc3Npb24uYyB8ICAxMzEgKysrKysrKysrKysrKysrKysrKysr
KysrKysrKystLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQogMSBmaWxl
cyBjaGFuZ2VkLCA2NyBpbnNlcnRpb25zKCspLCA2NCBkZWxldGlvbnMoLSkN
Cg0KZGlmZiAtLWdpdCBhL3NyYy9zZXNzaW9uLmMgYi9zcmMvc2Vzc2lvbi5j
DQppbmRleCBkMzcxZmYwLi4zY2Y5MmVjIDEwMDY0NA0KLS0tIGEvc3JjL3Nl
c3Npb24uYw0KKysrIGIvc3JjL3Nlc3Npb24uYw0KQEAgLTU0OSw2ICs1NDks
OCBAQCBpbnQgX2xpYnNzaDJfd2FpdF9zb2NrZXQoTElCU1NIMl9TRVNTSU9O
ICpzZXNzaW9uLCB0aW1lX3Qgc3RhcnRfdGltZSkNCiAgICAgaW50IHNlY29u
ZHNfdG9fbmV4dDsNCiAgICAgaW50IGRpcjsNCiAgICAgaW50IGhhc190aW1l
b3V0Ow0KKyAgICBsb25nIG1zX3RvX25leHQgPSAwOw0KKyAgICBsb25nIGVs
YXBzZWRfbXM7DQogDQogICAgIC8qIHNpbmNlIGxpYnNzaDIgb2Z0ZW4gc2V0
cyBFQUdBSU4gaW50ZXJuYWxseSBiZWZvcmUgdGhpcyBmdW5jdGlvbiBpcw0K
ICAgICAgICBjYWxsZWQsIHdlIGNhbiBkZWNyZWFzZSBzb21lIGFtb3VudCBv
ZiBjb25mdXNpb24gaW4gdXNlciBwcm9ncmFtcyBieQ0KQEAgLTU1OSw4MSAr
NTYxLDgyIEBAIGludCBfbGlic3NoMl93YWl0X3NvY2tldChMSUJTU0gyX1NF
U1NJT04gKnNlc3Npb24sIHRpbWVfdCBzdGFydF90aW1lKQ0KICAgICByYyA9
IGxpYnNzaDJfa2VlcGFsaXZlX3NlbmQgKHNlc3Npb24sICZzZWNvbmRzX3Rv
X25leHQpOw0KICAgICBpZiAocmMgPCAwKQ0KICAgICAgICAgcmV0dXJuIHJj
Ow0KLSAgICBlbHNlIHsNCi0gICAgICAgIC8qIGZpZ3VyZSBvdXQgd2hhdCB0
byB3YWl0IGZvciAqLw0KLSAgICAgICAgZGlyID0gbGlic3NoMl9zZXNzaW9u
X2Jsb2NrX2RpcmVjdGlvbnMoc2Vzc2lvbik7DQogDQotICAgICAgICBpZigh
ZGlyKSB7DQotICAgICAgICAgICAgX2xpYnNzaDJfZGVidWcoc2Vzc2lvbiwg
TElCU1NIMl9UUkFDRV9TT0NLRVQsDQotICAgICAgICAgICAgICAgICAgICAg
ICAgICAgIk5vdGhpbmcgdG8gd2FpdCBmb3IgaW4gd2FpdF9zb2NrZXQiKTsN
Ci0gICAgICAgICAgICAvKiBUbyBhdm9pZCB0aGF0IHdlIGhhbmcgYmVsb3cg
anVzdCBiZWNhdXNlIHRoZXJlJ3Mgbm90aGluZyBzZXQgdG8NCi0gICAgICAg
ICAgICAgICB3YWl0IGZvciwgd2UgdGltZW91dCBvbiAxIHNlY29uZCB0byBh
bHNvIGF2b2lkIGJ1c3ktbG9vcGluZw0KLSAgICAgICAgICAgICAgIGR1cmlu
ZyB0aGlzIGNvbmRpdGlvbiAqLw0KLSAgICAgICAgICAgIHNlY29uZHNfdG9f
bmV4dCA9IDE7DQorICAgIG1zX3RvX25leHQgPSBzZWNvbmRzX3RvX25leHQg
KiAxMDAwOw0KKw0KKyAgICAvKiBmaWd1cmUgb3V0IHdoYXQgdG8gd2FpdCBm
b3IgKi8NCisgICAgZGlyID0gbGlic3NoMl9zZXNzaW9uX2Jsb2NrX2RpcmVj
dGlvbnMoc2Vzc2lvbik7DQorDQorICAgIGlmKCFkaXIpIHsNCisgICAgICAg
IF9saWJzc2gyX2RlYnVnKHNlc3Npb24sIExJQlNTSDJfVFJBQ0VfU09DS0VU
LA0KKyAgICAgICAgICAgICAgICAgICAgICAgIk5vdGhpbmcgdG8gd2FpdCBm
b3IgaW4gd2FpdF9zb2NrZXQiKTsNCisgICAgICAgIC8qIFRvIGF2b2lkIHRo
YXQgd2UgaGFuZyBiZWxvdyBqdXN0IGJlY2F1c2UgdGhlcmUncyBub3RoaW5n
IHNldCB0bw0KKyAgICAgICAgICAgd2FpdCBmb3IsIHdlIHRpbWVvdXQgb24g
MSBzZWNvbmQgdG8gYWxzbyBhdm9pZCBidXN5LWxvb3BpbmcNCisgICAgICAg
ICAgIGR1cmluZyB0aGlzIGNvbmRpdGlvbiAqLw0KKyAgICAgICAgbXNfdG9f
bmV4dCA9IDEwMDA7DQorICAgIH0NCisNCisgICAgaWYgKHNlc3Npb24tPmFw
aV90aW1lb3V0ID4gMCAmJg0KKyAgICAgICAgKHNlY29uZHNfdG9fbmV4dCA9
PSAwIHx8DQorICAgICAgICAgc2Vjb25kc190b19uZXh0ID4gc2Vzc2lvbi0+
YXBpX3RpbWVvdXQpKSB7DQorICAgICAgICB0aW1lX3Qgbm93ID0gdGltZSAo
TlVMTCk7DQorICAgICAgICBlbGFwc2VkX21zID0gKGxvbmcpKDEwMDAqZGlm
ZnRpbWUoc3RhcnRfdGltZSwgbm93KSk7DQorICAgICAgICBpZiAoZWxhcHNl
ZF9tcyA+IHNlc3Npb24tPmFwaV90aW1lb3V0KSB7DQorICAgICAgICAgICAg
c2Vzc2lvbi0+ZXJyX2NvZGUgPSBMSUJTU0gyX0VSUk9SX1RJTUVPVVQ7DQor
ICAgICAgICAgICAgcmV0dXJuIExJQlNTSDJfRVJST1JfVElNRU9VVDsNCiAg
ICAgICAgIH0NCi0gICAgICAgIHsNCisgICAgICAgIG1zX3RvX25leHQgPSAo
c2Vzc2lvbi0+YXBpX3RpbWVvdXQgLSBlbGFwc2VkX21zKTsNCisgICAgICAg
IGhhc190aW1lb3V0ID0gMTsNCisgICAgfQ0KKyAgICBlbHNlIGlmIChtc190
b19uZXh0ID4gMCkgew0KKyAgICAgICAgaGFzX3RpbWVvdXQgPSAxOw0KKyAg
ICB9DQorICAgIGVsc2UNCisgICAgICAgIGhhc190aW1lb3V0ID0gMDsNCisN
CiAjaWZkZWYgSEFWRV9QT0xMDQotICAgICAgICAgICAgc3RydWN0IHBvbGxm
ZCBzb2NrZXRzWzFdOw0KKyAgICB7DQorICAgICAgICBzdHJ1Y3QgcG9sbGZk
IHNvY2tldHNbMV07DQogDQotICAgICAgICAgICAgc29ja2V0c1swXS5mZCA9
IHNlc3Npb24tPnNvY2tldF9mZDsNCi0gICAgICAgICAgICBzb2NrZXRzWzBd
LmV2ZW50cyA9IDA7DQotICAgICAgICAgICAgc29ja2V0c1swXS5yZXZlbnRz
ID0gMDsNCisgICAgICAgIHNvY2tldHNbMF0uZmQgPSBzZXNzaW9uLT5zb2Nr
ZXRfZmQ7DQorICAgICAgICBzb2NrZXRzWzBdLmV2ZW50cyA9IDA7DQorICAg
ICAgICBzb2NrZXRzWzBdLnJldmVudHMgPSAwOw0KIA0KLSAgICAgICAgICAg
IGlmKGRpciAmIExJQlNTSDJfU0VTU0lPTl9CTE9DS19JTkJPVU5EKQ0KLSAg
ICAgICAgICAgICAgICBzb2NrZXRzWzBdLmV2ZW50cyB8PSBQT0xMSU47DQor
ICAgICAgICBpZihkaXIgJiBMSUJTU0gyX1NFU1NJT05fQkxPQ0tfSU5CT1VO
RCkNCisgICAgICAgICAgICBzb2NrZXRzWzBdLmV2ZW50cyB8PSBQT0xMSU47
DQogDQotICAgICAgICAgICAgaWYoZGlyICYgTElCU1NIMl9TRVNTSU9OX0JM
T0NLX09VVEJPVU5EKQ0KLSAgICAgICAgICAgICAgICBzb2NrZXRzWzBdLmV2
ZW50cyB8PSBQT0xMT1VUOw0KKyAgICAgICAgaWYoZGlyICYgTElCU1NIMl9T
RVNTSU9OX0JMT0NLX09VVEJPVU5EKQ0KKyAgICAgICAgICAgIHNvY2tldHNb
MF0uZXZlbnRzIHw9IFBPTExPVVQ7DQogDQotICAgICAgICAgICAgcmMgPSBw
b2xsKHNvY2tldHMsIDEsIHNlY29uZHNfdG9fbmV4dCA/DQotICAgICAgICAg
ICAgICAgICAgICAgIHNlY29uZHNfdG9fbmV4dCAqIDEwMDAgOiAtMSk7DQor
ICAgICAgICByYyA9IHBvbGwoc29ja2V0cywgMSwgaGFzX3RpbWVvdXQ/bXNf
dG9fbmV4dDogLTEpOw0KKyAgICB9DQogI2Vsc2UNCi0gICAgICAgICAgICBm
ZF9zZXQgcmZkOw0KLSAgICAgICAgICAgIGZkX3NldCB3ZmQ7DQotICAgICAg
ICAgICAgZmRfc2V0ICp3cml0ZWZkID0gTlVMTDsNCi0gICAgICAgICAgICBm
ZF9zZXQgKnJlYWRmZCA9IE5VTEw7DQotICAgICAgICAgICAgc3RydWN0IHRp
bWV2YWwgdHY7DQotDQotICAgICAgICAgICAgaWYgKHNlc3Npb24tPmFwaV90
aW1lb3V0ID4gMCAmJg0KLSAgICAgICAgICAgICAgICAoc2Vjb25kc190b19u
ZXh0ID09IDAgfHwNCi0gICAgICAgICAgICAgICAgIHNlY29uZHNfdG9fbmV4
dCA+IHNlc3Npb24tPmFwaV90aW1lb3V0KSkgew0KLSAgICAgICAgICAgICAg
ICB0aW1lX3Qgbm93ID0gdGltZSAoTlVMTCk7DQotICAgICAgICAgICAgICAg
IGxvbmcgZWxhcHNlZF9tcyA9IChsb25nKSgxMDAwKmRpZmZ0aW1lKHN0YXJ0
X3RpbWUsIG5vdykpOw0KLSAgICAgICAgICAgICAgICBpZiAoZWxhcHNlZF9t
cyA+IHNlc3Npb24tPmFwaV90aW1lb3V0KSB7DQotICAgICAgICAgICAgICAg
ICAgICBzZXNzaW9uLT5lcnJfY29kZSA9IExJQlNTSDJfRVJST1JfVElNRU9V
VDsNCi0gICAgICAgICAgICAgICAgICAgIHJldHVybiBMSUJTU0gyX0VSUk9S
X1RJTUVPVVQ7DQotICAgICAgICAgICAgICAgIH0NCi0gICAgICAgICAgICAg
ICAgdHYudHZfc2VjID0gKHNlc3Npb24tPmFwaV90aW1lb3V0IC0gZWxhcHNl
ZF9tcykgLyAxMDAwOw0KLSAgICAgICAgICAgICAgICB0di50dl91c2VjID0g
KChzZXNzaW9uLT5hcGlfdGltZW91dCAtIGVsYXBzZWRfbXMpICUgMTAwMCkg
Kg0KLSAgICAgICAgICAgICAgICAgICAgMTAwMDsNCi0gICAgICAgICAgICAg
ICAgaGFzX3RpbWVvdXQgPSAxOw0KLSAgICAgICAgICAgIH0NCi0gICAgICAg
ICAgICBlbHNlIGlmIChzZWNvbmRzX3RvX25leHQgPiAwKSB7DQotICAgICAg
ICAgICAgICAgIHR2LnR2X3NlYyA9IHNlY29uZHNfdG9fbmV4dDsNCi0gICAg
ICAgICAgICAgICAgdHYudHZfdXNlYyA9IDA7DQotICAgICAgICAgICAgICAg
IGhhc190aW1lb3V0ID0gMTsNCi0gICAgICAgICAgICB9DQotICAgICAgICAg
ICAgZWxzZQ0KLSAgICAgICAgICAgICAgICBoYXNfdGltZW91dCA9IDA7DQot
DQotICAgICAgICAgICAgaWYoZGlyICYgTElCU1NIMl9TRVNTSU9OX0JMT0NL
X0lOQk9VTkQpIHsNCi0gICAgICAgICAgICAgICAgRkRfWkVSTygmcmZkKTsN
Ci0gICAgICAgICAgICAgICAgRkRfU0VUKHNlc3Npb24tPnNvY2tldF9mZCwg
JnJmZCk7DQotICAgICAgICAgICAgICAgIHJlYWRmZCA9ICZyZmQ7DQotICAg
ICAgICAgICAgfQ0KLQ0KLSAgICAgICAgICAgIGlmKGRpciAmIExJQlNTSDJf
U0VTU0lPTl9CTE9DS19PVVRCT1VORCkgew0KLSAgICAgICAgICAgICAgICBG
RF9aRVJPKCZ3ZmQpOw0KLSAgICAgICAgICAgICAgICBGRF9TRVQoc2Vzc2lv
bi0+c29ja2V0X2ZkLCAmd2ZkKTsNCi0gICAgICAgICAgICAgICAgd3JpdGVm
ZCA9ICZ3ZmQ7DQotICAgICAgICAgICAgfQ0KKyAgICB7DQorICAgICAgICBm
ZF9zZXQgcmZkOw0KKyAgICAgICAgZmRfc2V0IHdmZDsNCisgICAgICAgIGZk
X3NldCAqd3JpdGVmZCA9IE5VTEw7DQorICAgICAgICBmZF9zZXQgKnJlYWRm
ZCA9IE5VTEw7DQorICAgICAgICBzdHJ1Y3QgdGltZXZhbCB0djsNCisNCisg
ICAgICAgIHR2LnR2X3NlYyA9IG1zX3RvX25leHQgLyAxMDAwOw0KKyAgICAg
ICAgdHYudHZfdXNlYyA9IChtc190b19uZXh0IC0gdHYudHZfc2VjKjEwMDAp
ICogMTAwMDsNCisNCisgICAgICAgIGlmKGRpciAmIExJQlNTSDJfU0VTU0lP
Tl9CTE9DS19JTkJPVU5EKSB7DQorICAgICAgICAgICAgRkRfWkVSTygmcmZk
KTsNCisgICAgICAgICAgICBGRF9TRVQoc2Vzc2lvbi0+c29ja2V0X2ZkLCAm
cmZkKTsNCisgICAgICAgICAgICByZWFkZmQgPSAmcmZkOw0KKyAgICAgICAg
fQ0KIA0KLSAgICAgICAgICAgIHJjID0gc2VsZWN0KHNlc3Npb24tPnNvY2tl
dF9mZCArIDEsIHJlYWRmZCwgd3JpdGVmZCwgTlVMTCwNCi0gICAgICAgICAg
ICAgICAgICAgICAgICBoYXNfdGltZW91dCA/ICZ0diA6IE5VTEwpOw0KLSNl
bmRpZg0KKyAgICAgICAgaWYoZGlyICYgTElCU1NIMl9TRVNTSU9OX0JMT0NL
X09VVEJPVU5EKSB7DQorICAgICAgICAgICAgRkRfWkVSTygmd2ZkKTsNCisg
ICAgICAgICAgICBGRF9TRVQoc2Vzc2lvbi0+c29ja2V0X2ZkLCAmd2ZkKTsN
CisgICAgICAgICAgICB3cml0ZWZkID0gJndmZDsNCiAgICAgICAgIH0NCi0g
ICAgfQ0KIA0KKyAgICAgICAgcmMgPSBzZWxlY3Qoc2Vzc2lvbi0+c29ja2V0
X2ZkICsgMSwgcmVhZGZkLCB3cml0ZWZkLCBOVUxMLA0KKyAgICAgICAgICAg
ICAgICAgICAgaGFzX3RpbWVvdXQgPyAmdHYgOiBOVUxMKTsNCisgICAgfQ0K
KyNlbmRpZg0KICAgICBpZihyYyA8PSAwKSB7DQogICAgICAgICAvKiB0aW1l
b3V0IChvciBlcnJvciksIGJhaWwgb3V0IHdpdGggYSB0aW1lb3V0IGVycm9y
ICovDQogICAgICAgICBzZXNzaW9uLT5lcnJfY29kZSA9IExJQlNTSDJfRVJS
T1JfVElNRU9VVDsNCi0tIA0KMS43LjUuMw0KDQo=

--1129329158-2020387728-1306878700=:26627
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

--1129329158-2020387728-1306878700=:26627--

From libssh2-devel-bounces@cool.haxx.se  Tue May 31 23:52:51 2011
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4VLqnk4012509;
	Tue, 31 May 2011 23:52:51 +0200
Received: from giant.haxx.se (giant.haxx.se [80.67.6.50])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id p4VLqmWp012490
	for <libssh2-devel@cool.haxx.se>; Tue, 31 May 2011 23:52:48 +0200
Date: Tue, 31 May 2011 23:52:48 +0200 (CEST)
From: Daniel Stenberg <daniel@haxx.se>
X-X-Sender: dast@giant.haxx.se
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: Core dump when authentication fails?
In-Reply-To: <BANLkTi=v0Ew4nuNAUChuGGdin1Nv3oyQhA@mail.gmail.com>
Message-ID: <alpine.DEB.2.00.1105312351510.26627@tvnag.unkk.fr>
References: <BANLkTinWNhuCs-DJ7+b4V_=nA5hOqyD6xA@mail.gmail.com>
	<alpine.DEB.2.00.1105301027580.31551@tvnag.unkk.fr>
	<alpine.DEB.2.00.1105312338170.26627@tvnag.unkk.fr>
	<BANLkTi=v0Ew4nuNAUChuGGdin1Nv3oyQhA@mail.gmail.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.3.8 (giant.haxx.se [127.0.0.1]); Tue, 31 May 2011 23:52:51 +0200 (CEST)
X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.3.8
	(giant.haxx.se [80.67.6.50]);
	Tue, 31 May 2011 23:52:48 +0200 (CEST)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: libssh2 development <libssh2-devel@cool.haxx.se>
List-Id: libssh2 development <libssh2-devel.cool.haxx.se>
List-Unsubscribe: <http://cool.haxx.se/cgi-bin/mailman/options/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=unsubscribe>
List-Archive: <http://cool.haxx.se/pipermail/libssh2-devel>
List-Post: <mailto:libssh2-devel@cool.haxx.se>
List-Help: <mailto:libssh2-devel-request@cool.haxx.se?subject=help>
List-Subscribe: <http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>, 
	<mailto:libssh2-devel-request@cool.haxx.se?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: libssh2-devel-bounces@cool.haxx.se

On Tue, 31 May 2011, Saqib Ali wrote:

> I'll still test your changes. But can I get them from the daily snapshot for 
> June 1, 2011?

Sure! I've pushed them so they'll be included in upcoming snapshots.

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

