From libssh2-devel-bounces@cool.haxx.se  Fri Aug  9 17:03:49 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r79F3Hw1005231;
	Fri, 9 Aug 2013 17:03:43 +0200
Received: from vsp-authed-02-02.binero.net (vsp-authed02.binero.net
 [195.74.38.226])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with SMTP id r79F3FTd005223
 for <libssh2-devel@cool.haxx.se>; Fri, 9 Aug 2013 17:03:15 +0200
Message-Id: <201308091503.r79F3FTd005223@giant.haxx.se>
Received: from smtp01.binero.se (unknown [195.74.38.28])
 by vsp-authed-02-02.binero.net (Halon Mail Gateway) with ESMTP
 for <libssh2-devel@cool.haxx.se>; Fri,  9 Aug 2013 17:03:03 +0200 (CEST)
Received: from blubbedev.net (m83-185-59-94.cust.tele2.se [83.185.59.94])
 (Authenticated sender: dev@blubbedev.net)
 by smtp-09-01.atm.binero.net (Postfix) with ESMTPA id 077BB3A11F
 for <libssh2-devel@cool.haxx.se>; Fri,  9 Aug 2013 17:03:01 +0200 (CEST)
From: Leif Salomonsson <dev@blubbedev.net>
To: libssh2-devel@cool.haxx.se
Subject: sftp_packet_require() patch
X-Mailer: SimpleMail 0.38 (MorphOS/MUI) E-Mail Client (c) 2000-2011 by Hynek
 Schlawack and Sebastian Bauer
Date: 09 Aug 2013 17:02:50 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="--==bound23ca7ab8fb----"
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>

Warning: This is a message in MIME format. Your mail reader does not
support MIME. Some parts of this message will be readable as plain text.
To see the rest, you will need to upgrade your mail reader. Following are
some URLs where you can find MIME-capable mail programs for common
platforms:

  Amiga............: SimpleMail   http://simplemail.sourceforge.net/
  Unix.............: Metamail     ftp://ftp.bellcore.com/nsb/
  Windows/Macintosh: Eudora       http://www.qualcomm.com/

General info about MIME can be found at:

http://www.cis.ohio-state.edu/hypertext/faq/usenet/mail/mime-faq/top.html

----==bound23ca7ab8fb----

Hi

I noticed this problem when calling sftp_statvfs() when connected
to a server that does not support statvfs extension. This results in
the server returning a STATUS instead of an EXTENDED_REPLY. Libssh2
is not prepared for this, and just waits for EXTENDED_REPLY to arrive,
which never happens. My proposed fix is attached. 
It modifies sftp_packet_require() to handle this specific scenario.

Regards
Leif

----==bound23ca7ab8fb----
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=libssh2-1.4.3-sftp_c.patch
Content-transfer-encoding: base64

LS0tIHQ6bGlic3NoMi0xLjQuMy9zcmMvc2Z0cC5jCTIwMTItMTEtMTMgMDA6MjM6MDEgKzAwMDAK
KysrIGNvZGU6cG9ydHMvbGlic3NoMi9saWJzc2gyLTEuNC4zL3NyYy9zZnRwLmMJMjAxMy0wOC0w
OSAxNDoyMDo1NyArMDAwMApAQCAtNTE2LDYgKzUxNiwxNiBAQAogICAgICAgICByZXR1cm4gTElC
U1NIMl9FUlJPUl9OT05FOwogICAgIH0KIAorICAgIGlmIChwYWNrZXRfdHlwZSA9PSBTU0hfRlhQ
X0VYVEVOREVEX1JFUExZKSB7CisgICAgICAgIGlmIChzZnRwX3BhY2tldF9hc2soc2Z0cCwgU1NI
X0ZYUF9TVEFUVVMsIHJlcXVlc3RfaWQsIGRhdGEsIGRhdGFfbGVuKSA9PSAwKSB7CisgICAgICAg
ICAgICAvKiBUaGVyZSB3YXMgYSBTVEFUVVMgcmV0dXJuZWQgd2l0aCBvdXIgcmVxdWVzdF9pZCBv
biBpdC4uICovCisgICAgICAgICAgICAvKiBXZSBnb3QgaXQgYW5kIG5vdyBsZXRzIGZyZWUgaXQg
YW5kIHJldHVybiBlcnJvci4gKi8KKyAgICAgICAgICAgIGxpYnNzaDJfZGVidWcoc2Vzc2lvbiwg
TElCU1NIMl9UUkFDRV9TRlRQLCAiR290IFNUQVRVUyBpbnN0ZWFkIG9mIEVYVEVOREVEX1JFUExZ
LCBPSyIpOworICAgICAgICAgICAgTElCU1NIMl9GUkVFKHNlc3Npb24sICpkYXRhKTsgICAgICAK
KyAgICAgICAgICAgIHJldHVybiBMSUJTU0gyX0VSUk9SX1NGVFBfUFJPVE9DT0w7CisgICAgICAg
IH0gICAgCisgICAgfSAKKwogICAgIHdoaWxlIChzZXNzaW9uLT5zb2NrZXRfc3RhdGUgPT0gTElC
U1NIMl9TT0NLRVRfQ09OTkVDVEVEKSB7CiAgICAgICAgIHJjID0gc2Z0cF9wYWNrZXRfcmVhZChz
ZnRwKTsKICAgICAgICAgaWYgKHJjIDwgMCkKQEAgLTUyOCw2ICs1MzgsMTYgQEAKICAgICAgICAg
ICAgICAgICAgICAgICAgICAgIChpbnQpIHBhY2tldF90eXBlKTsKICAgICAgICAgICAgIHJldHVy
biBMSUJTU0gyX0VSUk9SX05PTkU7CiAgICAgICAgIH0KKyAgICAgICAgCisgICAgICAgIGlmIChw
YWNrZXRfdHlwZSA9PSBTU0hfRlhQX0VYVEVOREVEX1JFUExZKSB7CisgICAgICAgICAgICBpZiAo
c2Z0cF9wYWNrZXRfYXNrKHNmdHAsIFNTSF9GWFBfU1RBVFVTLCByZXF1ZXN0X2lkLCBkYXRhLCBk
YXRhX2xlbikgPT0gMCkgeworICAgICAgICAgICAgICAgIC8qIFRoZXJlIHdhcyBhIFNUQVRVUyBy
ZXR1cm5lZCB3aXRoIG91ciByZXF1ZXN0X2lkIG9uIGl0Li4gKi8KKyAgICAgICAgICAgICAgICAv
KiBXZSBnb3QgaXQgYW5kIG5vdyBsZXRzIGZyZWUgaXQgYW5kIHJldHVybiBlcnJvci4gKi8KKyAg
ICAgICAgICAgICAgIF9saWJzc2gyX2RlYnVnKHNlc3Npb24sIExJQlNTSDJfVFJBQ0VfU0ZUUCwg
IkdvdCBTVEFUVVMgaW5zdGVhZCBvZiBFWFRFTkRFRF9SRVBMWSwgT0siKTsKKyAgICAgICAgICAg
ICAgICBMSUJTU0gyX0ZSRUUoc2Vzc2lvbiwgKmRhdGEpOyAgICAgIAorICAgICAgICAgICAgICAg
IHJldHVybiBMSUJTU0gyX0VSUk9SX1NGVFBfUFJPVE9DT0w7CisgICAgICAgICAgICB9ICAgIAor
ICAgICAgICB9IAogICAgIH0KIAogICAgIC8qIE9ubHkgcmVhY2hlZCBpZiB0aGUgc29ja2V0IGRp
ZWQgKi8K

----==bound23ca7ab8fb----
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

----==bound23ca7ab8fb------

From libssh2-devel-bounces@cool.haxx.se  Fri Aug  9 17:17:25 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r79FHKuP013364;
	Fri, 9 Aug 2013 17:17:24 +0200
Received: from vsp-authed-03-02.binero.net (vsp-authed02.binero.net
 [195.74.38.226])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with SMTP id r79FHJ4D013323
 for <libssh2-devel@cool.haxx.se>; Fri, 9 Aug 2013 17:17:19 +0200
Message-Id: <201308091517.r79FHJ4D013323@giant.haxx.se>
Received: from smtp01.binero.se (unknown [195.74.38.28])
 by vsp-authed-03-02.binero.net (Halon Mail Gateway) with ESMTP
 for <libssh2-devel@cool.haxx.se>; Fri,  9 Aug 2013 17:17:10 +0200 (CEST)
Received: from blubbedev.net (m83-185-59-94.cust.tele2.se [83.185.59.94])
 (Authenticated sender: dev@blubbedev.net)
 by smtp-02-01.atm.binero.net (Postfix) with ESMTPA id 98A8E3A16D
 for <libssh2-devel@cool.haxx.se>; Fri,  9 Aug 2013 17:17:08 +0200 (CEST)
From: Leif Salomonsson <dev@blubbedev.net>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: sftp_packet_require() patch
X-Mailer: SimpleMail 0.38 (MorphOS/MUI) E-Mail Client (c) 2000-2011 by Hynek
 Schlawack and Sebastian Bauer
Date: 09 Aug 2013 17:17:03 +0100
In-Reply-To: <201308091503.r79F3FTd005223@giant.haxx.se>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="--==bound213f24e814e----"
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>

Warning: This is a message in MIME format. Your mail reader does not
support MIME. Some parts of this message will be readable as plain text.
To see the rest, you will need to upgrade your mail reader. Following are
some URLs where you can find MIME-capable mail programs for common
platforms:

  Amiga............: SimpleMail   http://simplemail.sourceforge.net/
  Unix.............: Metamail     ftp://ftp.bellcore.com/nsb/
  Windows/Macintosh: Eudora       http://www.qualcomm.com/

General info about MIME can be found at:

http://www.cis.ohio-state.edu/hypertext/faq/usenet/mail/mime-faq/top.html

----==bound213f24e814e----

Hello Leif,

On 2013-08-09, you wrote:
> Hi

> I noticed this problem when calling sftp_statvfs() when connected
> to a server that does not support statvfs extension. This results in
> the server returning a STATUS instead of an EXTENDED_REPLY. Libssh2
> is not prepared for this, and just waits for EXTENDED_REPLY to arrive,
> which never happens. My proposed fix is attached. 
> It modifies sftp_packet_require() to handle this specific scenario.

Updated the patch file. 
A "_" character got lost from a _libssh2_debug() call..

Regards
Leif

----==bound213f24e814e----
Content-Type: application/octet-stream
Content-Disposition: attachment; filename=libssh2-1.4.3-sftp_c.patch
Content-transfer-encoding: base64

LS0tIHQ6bGlic3NoMi0xLjQuMy9zcmMvc2Z0cC5jICAgMjAxMi0xMS0xMyAwMDoyMzowMSArMDAw
MAorKysgY29kZTpwb3J0cy9saWJzc2gyL2xpYnNzaDItMS40LjMvc3JjL3NmdHAuYyAgIDIwMTMt
MDgtMDkgMTQ6MjA6NTcgKzAwMDAKQEAgLTUxNiw2ICs1MTYsMTYgQEAKCSAgICAgIHJldHVybiBM
SUJTU0gyX0VSUk9SX05PTkU7CgkgIH0KCisgICAgaWYgKHBhY2tldF90eXBlID09IFNTSF9GWFBf
RVhURU5ERURfUkVQTFkpIHsKKyAgICAgICAgaWYgKHNmdHBfcGFja2V0X2FzayhzZnRwLCBTU0hf
RlhQX1NUQVRVUywgcmVxdWVzdF9pZCwgZGF0YSwgZGF0YV9sZW4pID09IDApIHsKKyAgICAgICAg
ICAgIC8qIFRoZXJlIHdhcyBhIFNUQVRVUyByZXR1cm5lZCB3aXRoIG91ciByZXF1ZXN0X2lkIG9u
IGl0Li4gKi8KKyAgICAgICAgICAgIC8qIFdlIGdvdCBpdCBhbmQgbm93IGxldHMgZnJlZSBpdCBh
bmQgcmV0dXJuIGVycm9yLiAqLworICAgICAgICAgICAgX2xpYnNzaDJfZGVidWcoc2Vzc2lvbiwg
TElCU1NIMl9UUkFDRV9TRlRQLCAiR290IFNUQVRVUyBpbnN0ZWFkIG9mIEVYVEVOREVEX1JFUExZ
LCBPSyIpOworICAgICAgICAgICAgTElCU1NIMl9GUkVFKHNlc3Npb24sICpkYXRhKTsKKyAgICAg
ICAgICAgIHJldHVybiBMSUJTU0gyX0VSUk9SX1NGVFBfUFJPVE9DT0w7CisgICAgICAgIH0KKyAg
ICB9CisKCSAgd2hpbGUgKHNlc3Npb24tPnNvY2tldF9zdGF0ZSA9PSBMSUJTU0gyX1NPQ0tFVF9D
T05ORUNURUQpIHsKCSAgICAgIHJjID0gc2Z0cF9wYWNrZXRfcmVhZChzZnRwKTsKCSAgICAgIGlm
IChyYyA8IDApCkBAIC01MjgsNiArNTM4LDE2IEBACgkgICAgICAgICAgICAgICAgICAgICAgICAg
KGludCkgcGFja2V0X3R5cGUpOwoJICAgICAgICAgIHJldHVybiBMSUJTU0gyX0VSUk9SX05PTkU7
CgkgICAgICB9CisKKyAgICAgICAgaWYgKHBhY2tldF90eXBlID09IFNTSF9GWFBfRVhURU5ERURf
UkVQTFkpIHsKKyAgICAgICAgICAgIGlmIChzZnRwX3BhY2tldF9hc2soc2Z0cCwgU1NIX0ZYUF9T
VEFUVVMsIHJlcXVlc3RfaWQsIGRhdGEsIGRhdGFfbGVuKSA9PSAwKSB7CisgICAgICAgICAgICAg
ICAgLyogVGhlcmUgd2FzIGEgU1RBVFVTIHJldHVybmVkIHdpdGggb3VyIHJlcXVlc3RfaWQgb24g
aXQuLiAqLworICAgICAgICAgICAgICAgIC8qIFdlIGdvdCBpdCBhbmQgbm93IGxldHMgZnJlZSBp
dCBhbmQgcmV0dXJuIGVycm9yLiAqLworICAgICAgICAgICAgICAgIF9saWJzc2gyX2RlYnVnKHNl
c3Npb24sIExJQlNTSDJfVFJBQ0VfU0ZUUCwgIkdvdCBTVEFUVVMgaW5zdGVhZCBvZiBFWFRFTkRF
RF9SRVBMWSwgT0siKTsKKyAgICAgICAgICAgICAgICBMSUJTU0gyX0ZSRUUoc2Vzc2lvbiwgKmRh
dGEpOworICAgICAgICAgICAgICAgIHJldHVybiBMSUJTU0gyX0VSUk9SX1NGVFBfUFJPVE9DT0w7
CisgICAgICAgICAgICB9CisgICAgICAgIH0KCSAgfQoKCSAgLyogT25seSByZWFjaGVkIGlmIHRo
ZSBzb2NrZXQgZGllZCAqLwo=

----==bound213f24e814e----
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

----==bound213f24e814e------

From libssh2-devel-bounces@cool.haxx.se  Mon Aug 12 14:26:23 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CCPojH024382;
	Mon, 12 Aug 2013 14:26:15 +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 r7CCPldf024374
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 12 Aug 2013 14:25:48 +0200
Received: (qmail 26238 invoked from network); 12 Aug 2013 12:25:10 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
 by localhost with SMTP; 12 Aug 2013 12:25:10 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 1.0dev
Precedence: bulk
Auto-Submitted: auto-generated
X-Mailer: Trac 1.0dev, by Edgewall Software
To: jensfromsomewhere@gmail.com
X-Trac-Project: libssh2
Date: Mon, 12 Aug 2013 12:25:10 -0000
X-URL: https://trac.libssh2.org/
Subject: [libssh2] #268: [PATCH]Field accessed after dealloc causing error
 on Windows
X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/268
Message-ID: <041.3a854806770245c08eaeab933a27deec@libssh2.stuge.se>
X-Trac-Ticket-ID: 268
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r7CCPldf024374
Cc: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>

#268: [PATCH]Field accessed after dealloc causing error on Windows
-------------------------------------------+--------------------
 Reporter:  Jens                           |       Owner:
     Type:  defect                         |      Status:  new
 Priority:  normal                         |   Milestone:  1.4.3
Component:  API                            |     Version:  1.4.2
 Keywords:  Dump Free _RtlpBreakPointHeap  |  Blocked By:
   Blocks:                                 |
-------------------------------------------+--------------------
 On Windows:
 Freeing a forward channel is causing an error.
 Unfortunately the error does not occure at the position where it is
 caused. It occurs on a new allocation or sometimes freeing of objects it
 is pretty random.
 The last point in the call stack is usaly this:
 ntdll.dll!_RtlpBreakPointHeap@4

 Reason for the defect:
 As already pointed out by Gregory Moltchadski in Ticket Number 257(
 however he made just a small remark to this error, which must be forgotten
 to solve) a field is accessed after a structure was deallocated.

 In channel.c:
 In function int _libssh2_channel_forward_cancel(LIBSSH2_LISTENER
 *listener):
 AT THE END:
 {{{
     _libssh2_list_remove(&listener->node);

     LIBSSH2_FREE(session, listener);

     listener->chanFwdCncl_state = libssh2_NB_state_idle;

     return 0;
 }
 }}}
 The field chanFwdCncl_state is set but listener was released before.
 To set this field is pretty much senseless, since the object is
 deallocated anyway, however I would just swap the Free Statement and the
 assignment.
 Solution:
 {{{
     _libssh2_list_remove(&listener->node);

     listener->chanFwdCncl_state = libssh2_NB_state_idle;

     LIBSSH2_FREE(session, listener);

     return 0;
 }
 }}}

-- 
Ticket URL: <https://trac.libssh2.org/ticket/268>
libssh2 <https://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  Mon Aug 12 15:00:17 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CD09je012997;
	Mon, 12 Aug 2013 15:00:16 +0200
Received: from mail.iblsoft.com (shodan.ibl.sk [62.168.111.42])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CD07os012971
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 12 Aug 2013 15:00:07 +0200
Received: from localhost (localhost [127.0.0.1])
 by mail.iblsoft.com (Postfix) with ESMTP id 407E0788FF
 for <libssh2-devel@cool.haxx.se>; Mon, 12 Aug 2013 15:00:08 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at mail.iblsoft.com
Received: from mail.iblsoft.com ([127.0.0.1])
 by localhost (mail.iblsoft.com [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id mMKC0GclXnok for <libssh2-devel@cool.haxx.se>;
 Mon, 12 Aug 2013 15:00:06 +0200 (CEST)
Received: from josusky.iblsoft.com (josusky.iblsoft.com [10.10.2.16])
 by mail.iblsoft.com (Postfix) with ESMTPA
 for <libssh2-devel@cool.haxx.se>; Mon, 12 Aug 2013 15:00:06 +0200 (CEST)
Content-Type: multipart/mixed; boundary=----------aTbXkJFTcGmXPOJQTssAG4
To: libssh2-devel@cool.haxx.se
Date: Mon, 12 Aug 2013 15:00:04 +0200
Subject: building libssh2 on FIPS enabled system
MIME-Version: 1.0
From: =?utf-8?Q?J=C3=A1n_Osusk=C3=BD?= <Jan.Osusky@iblsoft.com>
Organization: IBL
Message-ID: <op.w1pfqei34oyiiw@josusky.iblsoft.com>
User-Agent: Opera Mail/12.16 (Linux)
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>

------------aTbXkJFTcGmXPOJQTssAG4
Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes
Content-Transfer-Encoding: 8bit

Hi,

I tried to build libssh2 on FIPS 140-2 compliant RedHat Linux. The build succeeded but the actual connections failed during key exchange phase. I noticed that it was related to use of non-FIPS compliant algorithms (namely MD5) which are not available in libcrypto when in FIPS mode.
I fixed it by patching "src/openssl.h". If there is a better way, let me know.
Anyhow, my patch is attached, have fun.

JanO
------------aTbXkJFTcGmXPOJQTssAG4
Content-Disposition: attachment; filename=libssh2-openssl-fips.patch
Content-Type: application/octet-stream; name=libssh2-openssl-fips.patch
Content-Transfer-Encoding: Base64

LS0tIGxpYnNzaDIvc3JjL29wZW5zc2wuaC5vcmlnCTIwMTMtMDgtMDggMTQ6Mzk6
NDUuMDAwMDAwMDAwICswMjAwCisrKyBsaWJzc2gyL3NyYy9vcGVuc3NsLmgJMjAx
My0wOC0wOCAxNDo1MzoxNS43NDY5NjYwMjMgKzAyMDAKQEAgLTYwLDEzICs2MCwx
MyBAQAogIyBkZWZpbmUgTElCU1NIMl9EU0EgMQogI2VuZGlmCiAKLSNpZmRlZiBP
UEVOU1NMX05PX01ENQorI2lmIGRlZmluZWQoT1BFTlNTTF9OT19NRDUpIHx8IGRl
ZmluZWQoT1BFTlNTTF9GSVBTKQogIyBkZWZpbmUgTElCU1NIMl9NRDUgMAogI2Vs
c2UKICMgZGVmaW5lIExJQlNTSDJfTUQ1IDEKICNlbmRpZgogCi0jaWZkZWYgT1BF
TlNTTF9OT19SSVBFTUQKKyNpZiBkZWZpbmVkKE9QRU5TU0xfTk9fUklQRU1EKSB8
fCBkZWZpbmVkKE9QRU5TU0xfRklQUykKICMgZGVmaW5lIExJQlNTSDJfSE1BQ19S
SVBFTUQgMAogI2Vsc2UKICMgZGVmaW5lIExJQlNTSDJfSE1BQ19SSVBFTUQgMQpA
QCAtODAsMTkgKzgwLDE5IEBACiAjIGRlZmluZSBMSUJTU0gyX0FFUyAwCiAjZW5k
aWYKIAotI2lmZGVmIE9QRU5TU0xfTk9fQkxPV0ZJU0gKKyNpZiBkZWZpbmVkKE9Q
RU5TU0xfTk9fQkxPV0ZJU0gpIHx8IGRlZmluZWQoT1BFTlNTTF9GSVBTKQogIyBk
ZWZpbmUgTElCU1NIMl9CTE9XRklTSCAwCiAjZWxzZQogIyBkZWZpbmUgTElCU1NI
Ml9CTE9XRklTSCAxCiAjZW5kaWYKIAotI2lmZGVmIE9QRU5TU0xfTk9fUkM0Cisj
aWYgZGVmaW5lZChPUEVOU1NMX05PX1JDNCkgfHwgZGVmaW5lZChPUEVOU1NMX0ZJ
UFMpCiAjIGRlZmluZSBMSUJTU0gyX1JDNCAwCiAjZWxzZQogIyBkZWZpbmUgTElC
U1NIMl9SQzQgMQogI2VuZGlmCiAKLSNpZmRlZiBPUEVOU1NMX05PX0NBU1QKKyNp
ZiBkZWZpbmVkKE9QRU5TU0xfTk9fQ0FTVCkgfHwgZGVmaW5lZChPUEVOU1NMX0ZJ
UFMpCiAjIGRlZmluZSBMSUJTU0gyX0NBU1QgMAogI2Vsc2UKICMgZGVmaW5lIExJ
QlNTSDJfQ0FTVCAxCg==

------------aTbXkJFTcGmXPOJQTssAG4
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

------------aTbXkJFTcGmXPOJQTssAG4--

From libssh2-devel-bounces@cool.haxx.se  Mon Aug 12 15:50:53 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CDoavq008181;
	Mon, 12 Aug 2013 15:50:50 +0200
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CDoYTB008174
 for <libssh2-devel@cool.haxx.se>; Mon, 12 Aug 2013 15:50:34 +0200
Received: from int-mx01.intmail.prod.int.phx2.redhat.com
 (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7CDoW9g009314
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Mon, 12 Aug 2013 09:50:33 -0400
Received: from nbkamil.localnet (vpn1-7-70.ams2.redhat.com [10.36.7.70])
 by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id
 r7CDoV5I020845; Mon, 12 Aug 2013 09:50:32 -0400
From: Kamil Dudka <kdudka@redhat.com>
To: =?ISO-8859-1?Q?J=E1n_Osusk=FD?= <Jan.Osusky@iblsoft.com>
Subject: Re: building libssh2 on FIPS enabled system
Date: Mon, 12 Aug 2013 15:49:36 +0200
Message-ID: <1674063.0xvZVTN0hQ@nbkamil>
User-Agent: KMail/4.10.5 (Linux/3.8.13-gentoo; KDE/4.10.5; x86_64; ; )
In-Reply-To: <op.w1pfqei34oyiiw@josusky.iblsoft.com>
References: <op.w1pfqei34oyiiw@josusky.iblsoft.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id
 r7CDoYTB008174
Cc: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id r7CDoavq008181

On Monday, August 12, 2013 15:00:04 Ján Osuský wrote:
> Hi,
> 
> I tried to build libssh2 on FIPS 140-2 compliant RedHat Linux. The build
> succeeded but the actual connections failed during key exchange phase. I
> noticed that it was related to use of non-FIPS compliant algorithms (namely
> MD5) which are not available in libcrypto when in FIPS mode. I fixed it by
> patching "src/openssl.h". If there is a better way, let me know. Anyhow, my
> patch is attached, have fun.

Thanks for heads up!  Could you please provide more details on how you 
triggered the failure, what version of libssh2 you were using, and what 
application you were running on top of libssh2?

The patch does not seem to be right because it disables the algorithms
at compile time.  The decision about which algorithm to use should be 
postponed to the run time IMO.

Kamil

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

From libssh2-devel-bounces@cool.haxx.se  Mon Aug 12 16:07:30 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CE7OOt019611;
	Mon, 12 Aug 2013 16:07:29 +0200
Received: from mail.iblsoft.com (shodan.ibl.sk [62.168.111.42])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CE7MoU019607
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 12 Aug 2013 16:07:23 +0200
Received: from localhost (localhost [127.0.0.1])
 by mail.iblsoft.com (Postfix) with ESMTP id 303277890C;
 Mon, 12 Aug 2013 16:07:23 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at mail.iblsoft.com
Received: from mail.iblsoft.com ([127.0.0.1])
 by localhost (mail.iblsoft.com [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id Q1B0oqE6e2YS; Mon, 12 Aug 2013 16:07:20 +0200 (CEST)
Received: from josusky.iblsoft.com (josusky.iblsoft.com [10.10.2.16])
 by mail.iblsoft.com (Postfix) with ESMTPA;
 Mon, 12 Aug 2013 16:07:20 +0200 (CEST)
To: "Kamil Dudka" <kdudka@redhat.com>
Subject: Re: building libssh2 on FIPS enabled system
References: <op.w1pfqei34oyiiw@josusky.iblsoft.com>
 <1674063.0xvZVTN0hQ@nbkamil>
Date: Mon, 12 Aug 2013 16:07:19 +0200
MIME-Version: 1.0
From: =?utf-8?Q?J=C3=A1n_Osusk=C3=BD?= <Jan.Osusky@iblsoft.com>
Organization: IBL
Message-ID: <op.w1piuhgj4oyiiw@josusky.iblsoft.com>
In-Reply-To: <1674063.0xvZVTN0hQ@nbkamil>
User-Agent: Opera Mail/12.16 (Linux)
Cc: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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="utf-8"; Format="flowed"; DelSp="yes"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r7CE7OOt019611

Hi,

I used libssh2 1.4.2.
The failure happened in kex.c in function "diffie_hellman_sha1" there is part of code:
#if LIBSSH2_MD5
         {
             libssh2_md5_ctx fingerprint_ctx;

             libssh2_md5_init(&fingerprint_ctx);
             libssh2_md5_update(fingerprint_ctx, session->server_hostkey,
                                session->server_hostkey_len);
             libssh2_md5_final(fingerprint_ctx, session->server_hostkey_md5);
         }

which must not be called when MD5 is not available. That's why I concentrated on setting properly the "LIBSSH2_MD5".

JanO


On Mon, 12 Aug 2013 15:49:36 +0200, Kamil Dudka <kdudka@redhat.com> wrote:

> On Monday, August 12, 2013 15:00:04 JÃ¡n OsuskÃ½ wrote:
>> Hi,
>>
>> I tried to build libssh2 on FIPS 140-2 compliant RedHat Linux. The build
>> succeeded but the actual connections failed during key exchange phase. I
>> noticed that it was related to use of non-FIPS compliant algorithms (namely
>> MD5) which are not available in libcrypto when in FIPS mode. I fixed it by
>> patching "src/openssl.h". If there is a better way, let me know. Anyhow, my
>> patch is attached, have fun.
>
> Thanks for heads up!  Could you please provide more details on how you
> triggered the failure, what version of libssh2 you were using, and what
> application you were running on top of libssh2?
>
> The patch does not seem to be right because it disables the algorithms
> at compile time.  The decision about which algorithm to use should be
> postponed to the run time IMO.
>
> Kamil
>


-- 

JÃ¡n OsuskÃ½ (Jan.Osusky@iblsoft.com)
IBL Software Engineering, http://www.iblsoft.com
Galvaniho 17/C, 82104 Bratislava, Slovakia
Tel: +421-2-32662111, fax: +421-2-32662110
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Aug 12 16:14:08 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CEE5sm022691;
	Mon, 12 Aug 2013 16:14:07 +0200
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CEE3p7022666
 for <libssh2-devel@cool.haxx.se>; Mon, 12 Aug 2013 16:14:04 +0200
Received: from int-mx01.intmail.prod.int.phx2.redhat.com
 (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7CEE3Gr026412
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Mon, 12 Aug 2013 10:14:03 -0400
Received: from nbkamil.localnet (vpn1-7-70.ams2.redhat.com [10.36.7.70])
 by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id
 r7CEE2N5001034; Mon, 12 Aug 2013 10:14:02 -0400
From: Kamil Dudka <kdudka@redhat.com>
To: =?ISO-8859-1?Q?J=E1n_Osusk=FD?= <Jan.Osusky@iblsoft.com>
Subject: Re: building libssh2 on FIPS enabled system
Date: Mon, 12 Aug 2013 16:13:07 +0200
Message-ID: <6726633.8rOdtNI2yu@nbkamil>
User-Agent: KMail/4.10.5 (Linux/3.8.13-gentoo; KDE/4.10.5; x86_64; ; )
In-Reply-To: <op.w1piuhgj4oyiiw@josusky.iblsoft.com>
References: <op.w1pfqei34oyiiw@josusky.iblsoft.com>
 <1674063.0xvZVTN0hQ@nbkamil> <op.w1piuhgj4oyiiw@josusky.iblsoft.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id
 r7CEE3p7022666
Cc: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id r7CEE5sm022691

On Monday, August 12, 2013 16:07:19 Ján Osuský wrote:
> Hi,
> 
> I used libssh2 1.4.2.
> The failure happened in kex.c in function "diffie_hellman_sha1" there is
> part of code: #if LIBSSH2_MD5
>          {
>              libssh2_md5_ctx fingerprint_ctx;
> 
>              libssh2_md5_init(&fingerprint_ctx);
>              libssh2_md5_update(fingerprint_ctx, session->server_hostkey,
>                                 session->server_hostkey_len);
>              libssh2_md5_final(fingerprint_ctx,
> session->server_hostkey_md5); }
> 
> which must not be called when MD5 is not available. That's why I
> concentrated on setting properly the "LIBSSH2_MD5".

I see.  This is believed to be already fixed in libssh2 1.4.3:

http://git.libssh2.org/?p=libssh2.git;a=commitdiff;h=43b730ce

Kamil

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

From libssh2-devel-bounces@cool.haxx.se  Mon Aug 12 17:46:31 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CFkFLa015576;
	Mon, 12 Aug 2013 17:46:28 +0200
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CFkCVR015563
 for <libssh2-devel@cool.haxx.se>; Mon, 12 Aug 2013 17:46:13 +0200
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
 (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7CFkCkO002600
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK)
 for <libssh2-devel@cool.haxx.se>; Mon, 12 Aug 2013 11:46:12 -0400
Received: from kdudka.brq.redhat.com (kdudka.brq.redhat.com [10.34.4.67])
 by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id
 r7CFkBV5011297; Mon, 12 Aug 2013 11:46:11 -0400
From: Kamil Dudka <kdudka@redhat.com>
To: libssh2-devel@cool.haxx.se
Subject: [PATCH] partially revert "window_size: explicit adjustments only"
Date: Mon, 12 Aug 2013 17:43:52 +0200
Message-Id: <1376322232-16538-1-git-send-email-kdudka@redhat.com>
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

This partially reverts commit 03ca9020756a4e16f0294e5b35e9826ee6af2364
in order to fix extreme slowdown when uploading to localhost via SFTP.

I was able to repeat the issue on RHEL-7 on localhost only.  It did not
occur when uploading via network and it did not occur on a RHEL-6 box
with the same version of libssh2.

The problem was that sftp_read() used a read-ahead logic to figure out
the window_size, but sftp_packet_read() called indirectly from
sftp_write() did not use any read-ahead logic.
---
 src/channel.c |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/channel.c b/src/channel.c
index 4f41e1f..d4ffdce 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -1759,6 +1759,15 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id,
         channel->read_state = libssh2_NB_state_created;
     }
 
+    /*
+     * =============================== NOTE ===============================
+     * I know this is very ugly and not a really good use of "goto", but
+     * this case statement would be even uglier to do it any other way
+     */
+    if (channel->read_state == libssh2_NB_state_jump1) {
+        goto channel_read_window_adjust;
+    }
+
     rc = 1; /* set to >0 to let the while loop start */
 
     /* Process all pending incoming packets in all states in order to "even
@@ -1867,6 +1876,26 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id,
            more off the network again */
         channel->read_state = libssh2_NB_state_created;
 
+    if(channel->remote.window_size < (LIBSSH2_CHANNEL_WINDOW_DEFAULT*30)) {
+        /* the window is getting too narrow, expand it! */
+
+      channel_read_window_adjust:
+        channel->read_state = libssh2_NB_state_jump1;
+        /* the actual window adjusting may not finish so we need to deal with
+           this special state here */
+        rc = _libssh2_channel_receive_window_adjust(channel,
+                                                    (LIBSSH2_CHANNEL_WINDOW_DEFAULT*60), 0, NULL);
+        if (rc)
+            return rc;
+
+        _libssh2_debug(session, LIBSSH2_TRACE_CONN,
+                       "channel_read() filled %d adjusted %d",
+                       bytes_read, buflen);
+        /* continue in 'created' state to drain the already read packages
+           first before starting to empty the socket further */
+        channel->read_state = libssh2_NB_state_created;
+    }
+
     return bytes_read;
 }
 
-- 
1.7.1

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

From libssh2-devel-bounces@cool.haxx.se  Tue Aug 13 01:33:18 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7CNWxCk018948;
	Tue, 13 Aug 2013 01:33:15 +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 r7CNWQRJ018886
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 13 Aug 2013 01:32:26 +0200
Received: (qmail 14811 invoked from network); 12 Aug 2013 23:31:53 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
 by localhost with SMTP; 12 Aug 2013 23:31:53 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 1.0dev
Precedence: bulk
Auto-Submitted: auto-generated
X-Mailer: Trac 1.0dev, by Edgewall Software
To: jensfromsomewhere@gmail.com, kdudka@redhat.com
X-Trac-Project: libssh2
Date: Mon, 12 Aug 2013 23:31:53 -0000
X-URL: https://trac.libssh2.org/
Subject: Re: [libssh2] #268: [PATCH]Field accessed after dealloc causing
 error on Windows
X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/268#comment:1
Message-ID: <056.f011569ff7ddf07904aa4e54d05b0977@libssh2.stuge.se>
References: <041.3a854806770245c08eaeab933a27deec@libssh2.stuge.se>
X-Trac-Ticket-ID: 268
In-Reply-To: <041.3a854806770245c08eaeab933a27deec@libssh2.stuge.se>
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r7CNWQRJ018886
Cc: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>

#268: [PATCH]Field accessed after dealloc causing error on Windows
---------------------+-------------------------------------------
  Reporter:  Jens    |      Owner:
      Type:  defect  |     Status:  new
  Priority:  normal  |  Milestone:  1.4.3
 Component:  API     |    Version:  1.4.2
Resolution:          |   Keywords:  Dump Free _RtlpBreakPointHeap
Blocked By:          |     Blocks:
---------------------+-------------------------------------------

Comment (by kdudka):

 Thanks for the report!  I agree with your analysis.  The assignment was
 added by the following commit:

 http://git.libssh2.org/?p=libssh2.git;a=commitdiff;h=dde2b094

 It looks like a copy/paste mistake to me.

-- 
Ticket URL: <https://trac.libssh2.org/ticket/268#comment:1>
libssh2 <https://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 Aug 14 15:07:45 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7ED7MkP019393;
	Wed, 14 Aug 2013 15:07:41 +0200
Received: from mail.iblsoft.com (shodan.ibl.sk [62.168.111.42])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7ED7F9G019225
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Wed, 14 Aug 2013 15:07:16 +0200
Received: from localhost (localhost [127.0.0.1])
 by mail.iblsoft.com (Postfix) with ESMTP id 8BB0C788BF;
 Wed, 14 Aug 2013 15:07:14 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at mail.iblsoft.com
Received: from mail.iblsoft.com ([127.0.0.1])
 by localhost (mail.iblsoft.com [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id Qaa3eflsXVvv; Wed, 14 Aug 2013 15:07:12 +0200 (CEST)
Received: from josusky.iblsoft.com (josusky.iblsoft.com [10.10.2.16])
 by mail.iblsoft.com (Postfix) with ESMTPA;
 Wed, 14 Aug 2013 15:07:12 +0200 (CEST)
To: "Kamil Dudka" <kdudka@redhat.com>
Subject: Re: building libssh2 on FIPS enabled system
References: <op.w1pfqei34oyiiw@josusky.iblsoft.com>
 <1674063.0xvZVTN0hQ@nbkamil> <op.w1piuhgj4oyiiw@josusky.iblsoft.com>
 <6726633.8rOdtNI2yu@nbkamil>
Date: Wed, 14 Aug 2013 15:07:10 +0200
MIME-Version: 1.0
From: =?utf-8?Q?J=C3=A1n_Osusk=C3=BD?= <Jan.Osusky@iblsoft.com>
Organization: IBL
Message-ID: <op.w1s5d8wz4oyiiw@josusky.iblsoft.com>
In-Reply-To: <6726633.8rOdtNI2yu@nbkamil>
User-Agent: Opera Mail/12.16 (Linux)
Cc: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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="utf-8"; Format="flowed"; DelSp="yes"
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r7ED7MkP019393

On Mon, 12 Aug 2013 16:13:07 +0200, Kamil Dudka <kdudka@redhat.com> wrote:

> On Monday, August 12, 2013 16:07:19 JÃ¡n OsuskÃ½ wrote:
>> Hi,
>>
>> I used libssh2 1.4.2.
>> The failure happened in kex.c in function "diffie_hellman_sha1" there is
>> part of code: #if LIBSSH2_MD5
>>          {
>>              libssh2_md5_ctx fingerprint_ctx;
>>
>>              libssh2_md5_init(&fingerprint_ctx);
>>              libssh2_md5_update(fingerprint_ctx, session->server_hostkey,
>>                                 session->server_hostkey_len);
>>              libssh2_md5_final(fingerprint_ctx,
>> session->server_hostkey_md5); }
>>
>> which must not be called when MD5 is not available. That's why I
>> concentrated on setting properly the "LIBSSH2_MD5".
>
> I see.  This is believed to be already fixed in libssh2 1.4.3:
>
> http://git.libssh2.org/?p=libssh2.git;a=commitdiff;h=43b730ce
>
> Kamil
>

Sorry, I was not aware of. I confirm that libssh2 1.4.3 works without patch.

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

From libssh2-devel-bounces@cool.haxx.se  Wed Aug 14 18:45:10 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7EGil41022613;
	Wed, 14 Aug 2013 18:45:03 +0200
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7EGihNO022584
 for <libssh2-devel@cool.haxx.se>; Wed, 14 Aug 2013 18:44:44 +0200
Received: from int-mx11.intmail.prod.int.phx2.redhat.com
 (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7EGihCH003979
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Wed, 14 Aug 2013 12:44:43 -0400
Received: from nbkamil.localnet (vpn1-7-57.ams2.redhat.com [10.36.7.57])
 by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 r7EGigV9002288; Wed, 14 Aug 2013 12:44:43 -0400
From: Kamil Dudka <kdudka@redhat.com>
To: =?ISO-8859-1?Q?J=E1n_Osusk=FD?= <Jan.Osusky@iblsoft.com>
Subject: Re: building libssh2 on FIPS enabled system
Date: Wed, 14 Aug 2013 18:43:45 +0200
Message-ID: <1979126.BWDlQnsF0g@nbkamil>
User-Agent: KMail/4.10.5 (Linux/3.8.13-gentoo; KDE/4.10.5; x86_64; ; )
In-Reply-To: <op.w1s5d8wz4oyiiw@josusky.iblsoft.com>
References: <op.w1pfqei34oyiiw@josusky.iblsoft.com>
 <6726633.8rOdtNI2yu@nbkamil> <op.w1s5d8wz4oyiiw@josusky.iblsoft.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id
 r7EGihNO022584
Cc: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id r7EGil41022613

On Wednesday, August 14, 2013 15:07:10 Ján Osuský wrote:
> On Mon, 12 Aug 2013 16:13:07 +0200, Kamil Dudka <kdudka@redhat.com> wrote:
> > On Monday, August 12, 2013 16:07:19 Ján Osuský wrote:
> >> Hi,
> >> 
> >> I used libssh2 1.4.2.
> >> The failure happened in kex.c in function "diffie_hellman_sha1" there is
> >> part of code: #if LIBSSH2_MD5
> >> 
> >>          {
> >>          
> >>              libssh2_md5_ctx fingerprint_ctx;
> >>              
> >>              libssh2_md5_init(&fingerprint_ctx);
> >>              libssh2_md5_update(fingerprint_ctx, session->server_hostkey,
> >>              
> >>                                 session->server_hostkey_len);
> >>              
> >>              libssh2_md5_final(fingerprint_ctx,
> >> 
> >> session->server_hostkey_md5); }
> >> 
> >> which must not be called when MD5 is not available. That's why I
> >> concentrated on setting properly the "LIBSSH2_MD5".
> > 
> > I see.  This is believed to be already fixed in libssh2 1.4.3:
> > 
> > http://git.libssh2.org/?p=libssh2.git;a=commitdiff;h=43b730ce
> > 
> > Kamil
> 
> Sorry, I was not aware of. I confirm that libssh2 1.4.3 works without patch.

Great!  Thanks for checking it!

Kamil

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

From libssh2-devel-bounces@cool.haxx.se  Tue Aug 20 00:32:29 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7JMVwfM011987;
	Tue, 20 Aug 2013 00:32:22 +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 r7JMVvH9011983
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 20 Aug 2013 00:31:57 +0200
Received: (qmail 19555 invoked from network); 19 Aug 2013 22:31:20 -0000
Received: from unknown (HELO earth.stuge.se) (127.0.0.1)
 by localhost with SMTP; 19 Aug 2013 22:31:20 -0000
MIME-Version: 1.0
From: "libssh2 Trac" <trac@libssh2.stuge.se>
X-Trac-Version: 1.0dev
Precedence: bulk
Auto-Submitted: auto-generated
X-Mailer: Trac 1.0dev, by Edgewall Software
To: anil@tes-dst.com
X-Trac-Project: libssh2
Date: Mon, 19 Aug 2013 22:31:20 -0000
X-URL: https://trac.libssh2.org/
Subject: [libssh2] #269: libssh2 client and dropbear sshd v0.51 - ifconfig
 command not working
X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/269
Message-ID: <047.01e43a277631e5967edf56b8878a3022@libssh2.stuge.se>
X-Trac-Ticket-ID: 269
X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r7JMVvH9011983
Cc: libssh2-devel@cool.haxx.se
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>

#269: libssh2 client and dropbear sshd v0.51 - ifconfig command not working
------------------------+--------------------
 Reporter:  anil_kolli  |       Owner:
     Type:  defect      |      Status:  new
 Priority:  blocker     |   Milestone:  1.4.3
Component:  examples    |     Version:  1.4.2
 Keywords:  ssh2_exec   |  Blocked By:
   Blocks:              |
------------------------+--------------------
 Hi ,
     I have cross compiled libssh2 for arm, I am using ssh2_exec example to
 run commands on remote server. I have dropbear running on my
 target/client[server]. If I run normal command like 'ps' it is working
 perfectly. If I am running 'ifcongig' command it is failing with EXIT 127.
 Find log below
 ----------------------------------------------
 ./ssh2_exec 10.20.1.98 root lht-wap ifconfig
 Host check: 2, key: <none>
 libssh2_channel_read returned 0

 EXIT: 127 bytecount: 0
 all done
 ----------------------------------------------
 I have few questions here,
 1. Is libssh2 has any limitations with dropbear?
 2. Some times I am getting abort signal.
           Got signal: ABRT

 Regards & Thanks,
 Anil.

-- 
Ticket URL: <https://trac.libssh2.org/ticket/269>
libssh2 <https://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  Thu Aug 22 23:48:13 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7MLloMv014118;
	Thu, 22 Aug 2013 23:48:09 +0200
Received: from mail-oa0-x22d.google.com (mail-oa0-x22d.google.com
 [IPv6:2607:f8b0:4003:c02::22d])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7MLllIY014066
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Thu, 22 Aug 2013 23:47:48 +0200
Received: by mail-oa0-f45.google.com with SMTP id m6so4721989oag.32
 for <libssh2-devel@cool.haxx.se>; Thu, 22 Aug 2013 14:47:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:date:message-id:subject:from:to:content-type;
 bh=Wxa5532WqWzqoIa5cFCvtBNNL1ZIEflqG2Bvi4GbtHI=;
 b=Ee+BbmPAVigHiQ5W8zJjidbeqHStWariOrtcvm8L9YMzNunlnNYU0iRZq3dKBVmmLy
 28uA67huxeHrZ2M+bPG/y2ltmjsWsIz+O38qLD25M7TA0ZTgz+4WVx/Y0DCVi7f/Uq6e
 BE6pOCQU7agaNhWC6I/IXrdmOGkAoBnE0qrq8jbhCSexpPsdM+brn49SnGr4KpEO0KYZ
 HKo7S+cy593gZefmgrG97Yv950PG3GyvybRKMqTgWnQeprji2NmUII0uJRRf4gNHYNZ4
 HW8VFpUvV52MolJYAJzZnAYFhvpvIW/R6lDFFLuyxnP8ya5hBqG8yKRZyBR+6TJBaH36
 75iA==
MIME-Version: 1.0
X-Received: by 10.182.129.233 with SMTP id nz9mr16983468obb.8.1377208061260;
 Thu, 22 Aug 2013 14:47:41 -0700 (PDT)
Received: by 10.76.172.4 with HTTP; Thu, 22 Aug 2013 14:47:41 -0700 (PDT)
Date: Fri, 23 Aug 2013 00:47:41 +0300
Message-ID: <CAN=WvWtmE_YTEQs3k+OX8+wLNzRNOb1BWn=uOXm+yvDdxoNSVA@mail.gmail.com>
Subject: [SFTP] Is there a way to determine the maximum buffer len when
 reading.
From: Velichko Yuriy <velichko.yuriy@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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="===============0814690905=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============0814690905==
Content-Type: multipart/alternative; boundary=089e0149d28a4647c504e4903d24

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

Hello!

I tried to read data from file using function  libssh2_sftp_read(3).

The buffer_maxlen = 8000

But the "Number of bytes actually populated into buffer"  (the return value
of function) is always 2000.

The documentation says :

 libssh2_sftp_read(3) will attempt to read as much as possible however it
may not fill all of buffer if the file pointer reaches the end or if
further reads would cause the socket to block.


So the question: "2000" bytes is the limit of the "socket", or server, or
this is a limit established by the libssh2 library?

Can I determine this limit programmatically?

Of course  if this is not available I will read data smallest blocks ( as
shown in the sftp example ).

Thanks!

-- 
Best Regards!

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

<div dir=3D"ltr"><br>Hello!<div><br>I tried to read data from file using fu=
nction =A0libssh2_sftp_read(3).<br><br>The buffer_maxlen =3D 8000<br><br>Bu=
t the &quot;Number of bytes actually populated into buffer&quot; =A0(the re=
turn value of function) is always 2000.<br>
<br>The documentation says :<br><br>=A0libssh2_sftp_read(3) will attempt to=
 read as much as possible however it may not fill all of buffer if the file=
 pointer reaches the end or if further reads would cause the socket to bloc=
k.<br>
<br><div><br></div><div>So the question: &quot;2000&quot; bytes is the limi=
t of the &quot;socket&quot;, or server, or this is a limit established by t=
he libssh2 library?</div><div><br></div><div>Can I determine this limit pro=
grammatically?</div>
<div><br></div><div>Of course =A0if this is not available I will read data =
smallest blocks ( as shown in the sftp example ).</div><div><br></div><div>=
Thanks!<br></div><div><div><br></div>-- <br>Best=A0Regards!
</div></div></div>

--089e0149d28a4647c504e4903d24--

--===============0814690905==
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

--===============0814690905==--

From libssh2-devel-bounces@cool.haxx.se  Fri Aug 23 11:59:25 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7N9wwxr028768;
	Fri, 23 Aug 2013 11:59:19 +0200
Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7N9wvRc028755
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Fri, 23 Aug 2013 11:58:57 +0200
Received: from localhost (dast@localhost)
 by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r7N9wuVs028752
 for <libssh2-devel@cool.haxx.se>; Fri, 23 Aug 2013 11:58:57 +0200
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Fri, 23 Aug 2013 11:58:56 +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] Is there a way to determine the maximum buffer len when
 reading.
In-Reply-To: <CAN=WvWtmE_YTEQs3k+OX8+wLNzRNOb1BWn=uOXm+yvDdxoNSVA@mail.gmail.com>
Message-ID: <alpine.DEB.2.00.1308231153520.18916@tvnag.unkk.fr>
References: <CAN=WvWtmE_YTEQs3k+OX8+wLNzRNOb1BWn=uOXm+yvDdxoNSVA@mail.gmail.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>

On Fri, 23 Aug 2013, Velichko Yuriy wrote:

> I tried to read data from file using function libssh2_sftp_read(3).
>
> The buffer_maxlen = 8000
>
> But the "Number of bytes actually populated into buffer"  (the return value 
> of function) is always 2000.

I don't think it is always 2000.

When you ask for data with this function from libssh2, the function will split 
up the request into multiple requests for several pieces and as soon as the 
first data has arrived it returns that. The subsequent data pieces can then be 
returned in the next call to this function, should they have arrived then.

This is an optimization to help bite off the worst problems with the 
request/response nature of the SFTP protocol and its small packets. You get 
the first data available faster, and chances are that when you subsequently 
ask for more data it might already have been received.

You should still ask for as much data as possible at once so that libssh2 will 
send out requests for all of it, and thus make you get data faster. This is 
especially important if you're on high latency connections.

-- 

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

From libssh2-devel-bounces@cool.haxx.se  Mon Aug 26 17:14:56 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QFDmKG015110;
	Mon, 26 Aug 2013 17:14:50 +0200
Received: from mail-ob0-x22f.google.com (mail-ob0-x22f.google.com
 [IPv6:2607:f8b0:4003:c01::22f])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QFDk5i015090
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 17:13:46 +0200
Received: by mail-ob0-f175.google.com with SMTP id xn12so3318208obc.6
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 08:13:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :content-type; bh=g+wa77OIoQwGjfwe17olZ9T/YLrKj0cJDSKXatx5NBw=;
 b=gwZaROmzjeYUAS5I3s4Q6vmT5Cw3LX7EIQDpNv5r9/d+zv4GV18NC6jGAYpEeGbwaQ
 fYGLKpfKMBzG8jeFQRpnm8IXpBiLQHnos6M1iWmdha3RwqTMlwWl+Vl/xJMkWKVJ/kcZ
 pnNbT/4iEMp9ECto+RomKT6TYKjkiWkSjd+8WT8tUd+pcBf/1nUyx1xmmujuAeBl7xc7
 qL3smeryb1tLHbAzGY29OflVkrZP3GtRdvncsg51HZ0pbf6kapZd3lzHJoZkfVuin5xH
 oNwomNkTNW1BLJ0qVqbKlVViMdK/e5yzZaYGd5ASd7FW7s9MDlIqjGWlyFN/vnt7mpNE
 8sxQ==
MIME-Version: 1.0
X-Received: by 10.60.80.8 with SMTP id n8mr14503466oex.33.1377530020631; Mon,
 26 Aug 2013 08:13:40 -0700 (PDT)
Received: by 10.76.172.4 with HTTP; Mon, 26 Aug 2013 08:13:40 -0700 (PDT)
In-Reply-To: <alpine.DEB.2.00.1308231153520.18916@tvnag.unkk.fr>
References: <CAN=WvWtmE_YTEQs3k+OX8+wLNzRNOb1BWn=uOXm+yvDdxoNSVA@mail.gmail.com>
 <alpine.DEB.2.00.1308231153520.18916@tvnag.unkk.fr>
Date: Mon, 26 Aug 2013 18:13:40 +0300
Message-ID: <CAN=WvWv9+=GQzJDwNMsojbA0E9qDLTm7G5=k92yKR6DUR4=kGA@mail.gmail.com>
Subject: Re: [SFTP] Is there a way to determine the maximum buffer len when
 reading.
From: Velichko Yuriy <velichko.yuriy@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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="===============0237823307=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============0237823307==
Content-Type: multipart/alternative; boundary=089e011606788c1b9e04e4db334f

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

Thank you for the answer. I'll check my code carefully, to determine i get
such answer from the function.


On 23 August 2013 12:58, Daniel Stenberg <daniel@haxx.se> wrote:

> On Fri, 23 Aug 2013, Velichko Yuriy wrote:
>
>  I tried to read data from file using function libssh2_sftp_read(3).
>>
>> The buffer_maxlen = 8000
>>
>> But the "Number of bytes actually populated into buffer"  (the return
>> value of function) is always 2000.
>>
>
> I don't think it is always 2000.
>
> When you ask for data with this function from libssh2, the function will
> split up the request into multiple requests for several pieces and as soon
> as the first data has arrived it returns that. The subsequent data pieces
> can then be returned in the next call to this function, should they have
> arrived then.
>
> This is an optimization to help bite off the worst problems with the
> request/response nature of the SFTP protocol and its small packets. You get
> the first data available faster, and chances are that when you subsequently
> ask for more data it might already have been received.
>
> You should still ask for as much data as possible at once so that libssh2
> will send out requests for all of it, and thus make you get data faster.
> This is especially important if you're on high latency connections.
>
> --
>
>  / daniel.haxx.se
> ______________________________**_________________
> libssh2-devel http://cool.haxx.se/cgi-bin/**mailman/listinfo/libssh2-devel<http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>
>



-- 
Best Regards!

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

<div dir=3D"ltr">Thank you for the answer. I&#39;ll check my code carefully=
, to determine i get such answer from the function.=A0<br><div class=3D"gma=
il_extra"><br><br><div class=3D"gmail_quote">On 23 August 2013 12:58, Danie=
l Stenberg <span dir=3D"ltr">&lt;<a href=3D"mailto:daniel@haxx.se" target=
=3D"_blank">daniel@haxx.se</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex"><div class=3D"im">On Fri, 23 Aug 2013, Velichko Yuriy wrot=
e:<br>

<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex">
I tried to read data from file using function libssh2_sftp_read(3).<br>
<br>
The buffer_maxlen =3D 8000<br>
<br>
But the &quot;Number of bytes actually populated into buffer&quot; =A0(the =
return value of function) is always 2000.<br>
</blockquote>
<br></div>
I don&#39;t think it is always 2000.<br>
<br>
When you ask for data with this function from libssh2, the function will sp=
lit up the request into multiple requests for several pieces and as soon as=
 the first data has arrived it returns that. The subsequent data pieces can=
 then be returned in the next call to this function, should they have arriv=
ed then.<br>

<br>
This is an optimization to help bite off the worst problems with the reques=
t/response nature of the SFTP protocol and its small packets. You get the f=
irst data available faster, and chances are that when you subsequently ask =
for more data it might already have been received.<br>

<br>
You should still ask for as much data as possible at once so that libssh2 w=
ill send out requests for all of it, and thus make you get data faster. Thi=
s is especially important if you&#39;re on high latency connections.<span c=
lass=3D""><font color=3D"#888888"><br>

<br>
-- <br>
<br>
=A0/ <a href=3D"http://daniel.haxx.se" target=3D"_blank">daniel.haxx.se</a>=
<br>
______________________________<u></u>_________________<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/<u></u>mailman/list=
info/libssh2-devel</a><br>
</font></span></blockquote></div><br><br clear=3D"all"><div><br></div>-- <b=
r>Best=A0Regards!
</div></div>

--089e011606788c1b9e04e4db334f--

--===============0237823307==
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

--===============0237823307==--

From libssh2-devel-bounces@cool.haxx.se  Mon Aug 26 17:18:52 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QFIoDp018805;
	Mon, 26 Aug 2013 17:18:51 +0200
Received: from mail-oa0-x22c.google.com (mail-oa0-x22c.google.com
 [IPv6:2607:f8b0:4003:c02::22c])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QFIlgq018760
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 17:18:48 +0200
Received: by mail-oa0-f44.google.com with SMTP id l20so3738978oag.31
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 08:18:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:date:message-id:subject:from:to:content-type;
 bh=JHmBwPT5qbXfRdk01f+IWWyyak+G7kV6ejCuSyfIFOY=;
 b=GfFyL35S9F/sLVVmt0QLbMhYKNrjri9xiuJN/Zfcf6Aod3UdfsU2dBxKodg56+Ccbl
 uON4td1BLdzj1xGgQM+sKBvenCVPTttEhW262OlmdPbnhn6oyEWpSKBl0zrDzuOBiFeR
 DrJwkQoEPif+44LvT7B++GH28eI2tN4ExhN0N5ZkQplsveKxTN3d+yazdBbK6OavrIhN
 ByxMAaMWRTeV5wB9R5YS8TkQC8MtKpfhUQ0wIkhmE2l9qtxJA0rcZWoVhDM7uVEK0Wtq
 Xx8kOgH2ueI6Kt9IwGMdB7l3X0mIzKF17AEmVK+icCQZSbJHb4t0edKLJYLY56KkjEW+
 bFQg==
MIME-Version: 1.0
X-Received: by 10.182.230.163 with SMTP id sz3mr266283obc.81.1377530323283;
 Mon, 26 Aug 2013 08:18:43 -0700 (PDT)
Received: by 10.76.172.4 with HTTP; Mon, 26 Aug 2013 08:18:43 -0700 (PDT)
Date: Mon, 26 Aug 2013 18:18:43 +0300
Message-ID: <CAN=WvWv7xECPBPRRyxA83BW+Rp6t60-HaDsgZN2hU-2Pj2BPMg@mail.gmail.com>
Subject: [SFTP] how to determine the creation time of the file when browsing
 directory.
From: Velichko Yuriy <velichko.yuriy@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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="===============1283958633=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============1283958633==
Content-Type: multipart/alternative; boundary=001a11c2f63a9646e604e4db4566

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

Hello!

I need to get list of files in the directory, sorted by creation date.

To get list of files I use the function:

libssh2_sftp_readdir()

Is there a way to retrieve data about file creation from structure
LIBSSH2_SFTP_ATTRIBUTES, or from some one else?

PS: or the attribute "atime" - it what i need?

Thanks!

-- 
Best Regards!

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

<div dir=3D"ltr">Hello!<div><br></div><div>I need to get list of files in t=
he directory, sorted by creation date.</div><div><br></div><div>To get list=
 of files I use the function:<p class=3D"">libssh2_sftp_readdir()</p><p cla=
ss=3D"">
Is there a way to retrieve data about file creation from structure LIBSSH2_=
SFTP_ATTRIBUTES, or from some one else?</p><p class=3D"">PS: or the attribu=
te &quot;atime&quot; - it what i need?</p>







<p class=3D"">Thanks!</p>







<div><br></div>-- <br>Best=A0Regards!
</div></div>

--001a11c2f63a9646e604e4db4566--

--===============1283958633==
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

--===============1283958633==--

From libssh2-devel-bounces@cool.haxx.se  Mon Aug 26 17:34:52 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QFYjLE030191;
	Mon, 26 Aug 2013 17:34:51 +0200
Received: from mail-ee0-x235.google.com (mail-ee0-x235.google.com
 [IPv6:2a00:1450:4013:c00::235])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QFYh8x030116
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 17:34:43 +0200
Received: by mail-ee0-f53.google.com with SMTP id b15so1691624eek.40
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 08:34:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :content-type; bh=qTa7JdQXbd0hjSeu4GOUMQyjgHdCejkXRJmw3zBR6FA=;
 b=DUChyV92I1uimRmlFsRH4yEUg/I5x63lP57aFOGLjbegGKD442nLX7ZKcDsh87K13q
 z5kcT1s7jnUV8eLh+pp7Lccq/iRmHn48G91uieGQ7ad8e3xXTOuSEKVfR4yK/yvjgvFF
 VhKycr/OEJ42z4Ra7jyqcPziKYwRyXWuTcC9xXlb6FcigprFc726KxZdGzOEbimX9PHd
 +YTPeVw9F7f07y5D7IeYfQJSikf74JLamBKkOE6eUYJKpE7IfWY/+RYq/+TAPDchT19U
 dxjcvg0yXvxvdLFtMUkJUKKeOJLT7O+RwTCAqRIYi4IlwvM63Q8HJWznT7/JxzsHeevh
 qulw==
MIME-Version: 1.0
X-Received: by 10.14.88.130 with SMTP id a2mr15937eef.120.1377531279905; Mon,
 26 Aug 2013 08:34:39 -0700 (PDT)
Received: by 10.14.1.134 with HTTP; Mon, 26 Aug 2013 08:34:39 -0700 (PDT)
In-Reply-To: <CAN=WvWv7xECPBPRRyxA83BW+Rp6t60-HaDsgZN2hU-2Pj2BPMg@mail.gmail.com>
References: <CAN=WvWv7xECPBPRRyxA83BW+Rp6t60-HaDsgZN2hU-2Pj2BPMg@mail.gmail.com>
Date: Mon, 26 Aug 2013 19:34:39 +0400
Message-ID: <CAMPTgK00FxHaSn7FA=B3k9APakLokriEp+=O9PC=Orbej2ipZw@mail.gmail.com>
Subject: Re: [SFTP] how to determine the creation time of the file when
 browsing directory.
From: niXman <i.nixman@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>

> PS: or the attribute "atime" - it what i need?
you need the 'mtime' member.


-- 
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

From libssh2-devel-bounces@cool.haxx.se  Mon Aug 26 21:08:47 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QJ7x49007715;
	Mon, 26 Aug 2013 21:08:41 +0200
Received: from mail-oa0-x232.google.com (mail-oa0-x232.google.com
 [IPv6:2607:f8b0:4003:c02::232])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QJ7upm007648
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 21:07:57 +0200
Received: by mail-oa0-f50.google.com with SMTP id i4so4060842oah.23
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 12:07:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :content-type; bh=F+2+LHHC7OGqxbu4xN/pBm/h3MBKI1ULefZB4wLv3o4=;
 b=Gk8QzPvKquXtEHbmlVUo03E+hG0dHvf+Nxhxm/lzXV0ihVZYreaAoP26FYkwbbmrV+
 /XKQAo7uQARCOpLusCSg2T7dB4zUmDd4gQUW9ACi7mMGvn2APyh5TpkRimH/zSyFKsha
 +Yh27+Se/jIKvu/uQ3RU1NDKBYAaTxa7x6zrOYImt06wCSqy5yd0zV9+Iwt6aSur+bQD
 lmIAkmgrsWZCOPG9ZgnOX9CjpZEpxLWIhsn980ni/oIIjs+85P+a1KqF6kXfH8Ajfyu1
 0zOYorjTzAvRwDoH2l7qM7WaGcMQe7IBDCeqYyvt0JjvquiMK0j/c/PNSUjoa6vwnKcR
 DJ0g==
MIME-Version: 1.0
X-Received: by 10.60.80.8 with SMTP id n8mr15314961oex.33.1377544072723; Mon,
 26 Aug 2013 12:07:52 -0700 (PDT)
Received: by 10.76.172.4 with HTTP; Mon, 26 Aug 2013 12:07:52 -0700 (PDT)
In-Reply-To: <CAMPTgK00FxHaSn7FA=B3k9APakLokriEp+=O9PC=Orbej2ipZw@mail.gmail.com>
References: <CAN=WvWv7xECPBPRRyxA83BW+Rp6t60-HaDsgZN2hU-2Pj2BPMg@mail.gmail.com>
 <CAMPTgK00FxHaSn7FA=B3k9APakLokriEp+=O9PC=Orbej2ipZw@mail.gmail.com>
Date: Mon, 26 Aug 2013 22:07:52 +0300
Message-ID: <CAN=WvWu12NQN9EDrytoDAzCs7YXvfMz+L-16N=L+QfOTnvgCZQ@mail.gmail.com>
Subject: Re: [SFTP] how to determine the creation time of the file when
 browsing directory.
From: Velichko Yuriy <velichko.yuriy@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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="===============0133226061=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============0133226061==
Content-Type: multipart/alternative; boundary=089e011606781e03a904e4de79f0

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

On 26 August 2013 18:34, niXman <i.nixman@gmail.com> wrote:

> > PS: or the attribute "atime" - it what i need?
> you need the 'mtime' member.
>

Thanks, but mtime - is the "modified time of file"

http://www.libssh2.org/libssh2_sftp_fstat_ex.html
(and I checked this programmatically)

I need the time of file CREATION.


>
>
> --
> Regards,
> niXman
> ___________________________________________________
> Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
> http://sourceforge.net/projects/mingwbuilds/
> ___________________________________________________
> Another online IDE: http://liveworkspace.org/
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>



-- 
Best Regards!

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

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On 26 August 2013 18:34, niXman <span dir=3D"ltr">&lt;<a href=3D"ma=
ilto:i.nixman@gmail.com" target=3D"_blank">i.nixman@gmail.com</a>&gt;</span=
> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex"><div class=3D"im">&gt; PS: or the attribute &quot;atime&qu=
ot; - it what i need?<br>

</div>you need the &#39;mtime&#39; member.<br></blockquote><div><br></div><=
div>Thanks, but mtime - is the &quot;<span style=3D"color:rgb(0,0,0);font-f=
amily:sans-serif;font-size:medium">modified time of file</span>&quot;</div>
<div><br></div><div><a href=3D"http://www.libssh2.org/libssh2_sftp_fstat_ex=
.html">http://www.libssh2.org/libssh2_sftp_fstat_ex.html</a><br></div><div>=
(and I checked this programmatically)<br></div><div><br></div><div>I need t=
he time of file CREATION.</div>
<div>=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px=
 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left=
-style:solid;padding-left:1ex">
<span class=3D""><font color=3D"#888888"><br>
<br>
--<br>
Regards,<br>
niXman<br>
___________________________________________________<br>
Dual-target(32 &amp; 64-bit) MinGW compilers for 32 and 64-bit Windows:<br>
<a href=3D"http://sourceforge.net/projects/mingwbuilds/" target=3D"_blank">=
http://sourceforge.net/projects/mingwbuilds/</a><br>
___________________________________________________<br>
Another online IDE: <a href=3D"http://liveworkspace.org/" target=3D"_blank"=
>http://liveworkspace.org/</a><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>
</font></span></blockquote></div><br><br clear=3D"all"><div><br></div>-- <b=
r>Best=A0Regards!
</div></div>

--089e011606781e03a904e4de79f0--

--===============0133226061==
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

--===============0133226061==--

From libssh2-devel-bounces@cool.haxx.se  Mon Aug 26 22:19:21 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QKJ25T016303;
	Mon, 26 Aug 2013 22:19:17 +0200
Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QKJ0FF016186
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 22:19:00 +0200
Received: from localhost (dast@localhost)
 by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r7QKJ01I016183
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 22:19:00 +0200
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Mon, 26 Aug 2013 22:19: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: [SFTP] how to determine the creation time of the file when
 browsing directory.
In-Reply-To: <CAN=WvWu12NQN9EDrytoDAzCs7YXvfMz+L-16N=L+QfOTnvgCZQ@mail.gmail.com>
Message-ID: <alpine.DEB.2.00.1308262209280.19251@tvnag.unkk.fr>
References: <CAN=WvWv7xECPBPRRyxA83BW+Rp6t60-HaDsgZN2hU-2Pj2BPMg@mail.gmail.com>
 <CAMPTgK00FxHaSn7FA=B3k9APakLokriEp+=O9PC=Orbej2ipZw@mail.gmail.com>
 <CAN=WvWu12NQN9EDrytoDAzCs7YXvfMz+L-16N=L+QfOTnvgCZQ@mail.gmail.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>

On Mon, 26 Aug 2013, Velichko Yuriy wrote:

> I need the time of file CREATION.

That's unfortunately not exposed by libssh2_sftp_stat_ex() ! The time can be 
retrieved from the server using the SFTP protocol[1] but for some reason the 
code was never written to ask for that so atime and mtime are the only ones 
provided!

I wouldn't mind seeing the code extended to support this. It would need be 
done some clever way to not break compatibility with existing ABI and 
applications.

[1] = 
http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-05.txt 
chapter 5

-- 

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

From libssh2-devel-bounces@cool.haxx.se  Mon Aug 26 23:00:53 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QL0jQn006229;
	Mon, 26 Aug 2013 23:00:52 +0200
Received: from mail-vc0-x22c.google.com (mail-vc0-x22c.google.com
 [IPv6:2607:f8b0:400c:c03::22c])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7QL0gjo006179
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 23:00:43 +0200
Received: by mail-vc0-f172.google.com with SMTP id m17so2504313vca.3
 for <libssh2-devel@cool.haxx.se>; Mon, 26 Aug 2013 14:00:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :content-type; bh=O6THznYnpCFLINQ9tdTkzfZsM5NvmuyQiDqvG4WH4aU=;
 b=IEnDn6H90fZEIJta9TyKhDZ/bfnCoI4fbPxp5SPFOeZboH7ZzTou2AceeZAuB2Ler2
 TTO8GMvOgrKz1NkGEhA3Nhu4hDKn9oMHqv7Tn0wJtu+iMQoVu/KLCuptDJOcDUG3eBoa
 vMZr4zUMYpk0Hyp2hU9q6bWe/vW4DRzfmAH9LY/2WpOaYtOuLObtROFSbrKJAMCWuh70
 GVkbWK3hSnDhQiIkEaeUQt/6KwmCLHkzHdwLjdW5g5eDguOsXz1sys7t5DHggamG0W1g
 e87X7hh88AkMo5cNnoxcIEjvCfEyTA4tcIU67IYBi4MipBymKoRCuOQqyhemowK25U56
 8wjw==
MIME-Version: 1.0
X-Received: by 10.58.217.167 with SMTP id oz7mr16694995vec.15.1377550838793;
 Mon, 26 Aug 2013 14:00:38 -0700 (PDT)
Received: by 10.58.75.76 with HTTP; Mon, 26 Aug 2013 14:00:38 -0700 (PDT)
In-Reply-To: <alpine.DEB.2.00.1308262209280.19251@tvnag.unkk.fr>
References: <CAN=WvWv7xECPBPRRyxA83BW+Rp6t60-HaDsgZN2hU-2Pj2BPMg@mail.gmail.com>
 <CAMPTgK00FxHaSn7FA=B3k9APakLokriEp+=O9PC=Orbej2ipZw@mail.gmail.com>
 <CAN=WvWu12NQN9EDrytoDAzCs7YXvfMz+L-16N=L+QfOTnvgCZQ@mail.gmail.com>
 <alpine.DEB.2.00.1308262209280.19251@tvnag.unkk.fr>
Date: Tue, 27 Aug 2013 00:00:38 +0300
Message-ID: <CAN=WvWt-kQG-U70PWcJe0RFdEMCaZsvc8P0WDkqLWo1Wjk+RhA@mail.gmail.com>
Subject: Re: [SFTP] how to determine the creation time of the file when
 browsing directory.
From: Velichko Yuriy <velichko.yuriy@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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="===============1692106864=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============1692106864==
Content-Type: multipart/alternative; boundary=047d7bd6adfe680be004e4e00ce8

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

Ok. Thanks for the answer!


On 26 August 2013 23:19, Daniel Stenberg <daniel@haxx.se> wrote:

> On Mon, 26 Aug 2013, Velichko Yuriy wrote:
>
>  I need the time of file CREATION.
>>
>
> That's unfortunately not exposed by libssh2_sftp_stat_ex() ! The time can
> be retrieved from the server using the SFTP protocol[1] but for some reason
> the code was never written to ask for that so atime and mtime are the only
> ones provided!
>
> I wouldn't mind seeing the code extended to support this. It would need be
> done some clever way to not break compatibility with existing ABI and
> applications.
>
> [1] = http://tools.ietf.org/wg/**secsh/draft-ietf-secsh-**
> filexfer/draft-ietf-secsh-**filexfer-05.txt<http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/draft-ietf-secsh-filexfer-05.txt>chapter 5
>
> --
>
>  / daniel.haxx.se
> ______________________________**_________________
> libssh2-devel http://cool.haxx.se/cgi-bin/**mailman/listinfo/libssh2-devel<http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>
>



-- 
Best Regards!

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

<div dir=3D"ltr">Ok. Thanks for the answer!</div><div class=3D"gmail_extra"=
><br><br><div class=3D"gmail_quote">On 26 August 2013 23:19, Daniel Stenber=
g <span dir=3D"ltr">&lt;<a href=3D"mailto:daniel@haxx.se" target=3D"_blank"=
>daniel@haxx.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 class=3D"im">On Mon, 26 Aug 2013, Velic=
hko Yuriy 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 need the time of file CREATION.<br>
</blockquote>
<br></div>
That&#39;s unfortunately not exposed by libssh2_sftp_stat_ex() ! The time c=
an be retrieved from the server using the SFTP protocol[1] but for some rea=
son the code was never written to ask for that so atime and mtime are the o=
nly ones provided!<br>

<br>
I wouldn&#39;t mind seeing the code extended to support this. It would need=
 be done some clever way to not break compatibility with existing ABI and a=
pplications.<br>
<br>
[1] =3D <a href=3D"http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer=
/draft-ietf-secsh-filexfer-05.txt" target=3D"_blank">http://tools.ietf.org/=
wg/<u></u>secsh/draft-ietf-secsh-<u></u>filexfer/draft-ietf-secsh-<u></u>fi=
lexfer-05.txt</a> chapter 5<span class=3D"HOEnZb"><font color=3D"#888888"><=
br>

<br>
-- <br>
<br>
=A0/ <a href=3D"http://daniel.haxx.se" target=3D"_blank">daniel.haxx.se</a>=
<br>
______________________________<u></u>_________________<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/<u></u>mailman/list=
info/libssh2-devel</a><br>
</font></span></blockquote></div><br><br clear=3D"all"><div><br></div>-- <b=
r>Best=A0Regards!
</div>

--047d7bd6adfe680be004e4e00ce8--

--===============1692106864==
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

--===============1692106864==--

From libssh2-devel-bounces@cool.haxx.se  Tue Aug 27 13:56:17 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7RBtqv1012938;
	Tue, 27 Aug 2013 13:56:11 +0200
Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7RBto27012913
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 27 Aug 2013 13:55:50 +0200
Received: from localhost (dast@localhost)
 by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r7RBtoHu012909
 for <libssh2-devel@cool.haxx.se>; Tue, 27 Aug 2013 13:55:50 +0200
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Tue, 27 Aug 2013 13:55:50 +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_packet_require() patch
In-Reply-To: <201308091517.r79FHJ4D013323@giant.haxx.se>
Message-ID: <alpine.DEB.2.00.1308271351360.6929@tvnag.unkk.fr>
References: <201308091517.r79FHJ4D013323@giant.haxx.se>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>

On Fri, 9 Aug 2013, Leif Salomonsson wrote:

Sorry for the delay of reviewing this.

>> I noticed this problem when calling sftp_statvfs() when connected to a 
>> server that does not support statvfs extension. This results in the server 
>> returning a STATUS instead of an EXTENDED_REPLY. Libssh2 is not prepared 
>> for this, and just waits for EXTENDED_REPLY to arrive, which never happens. 
>> My proposed fix is attached. It modifies sftp_packet_require() to handle 
>> this specific scenario.
>
> Updated the patch file.
> A "_" character got lost from a _libssh2_debug() call..

First, please follow the existing source code indentation style we use.

Then, I really don't like having the same code chunk pasted twice into that 
sftp_packet_require() function and it seems odd to put that kind of specific 
logic into the generic requrie function.

Isn't it rather so that the funtion that calls sftp_packet_require() in this 
case should rather ask for one of SSH_FXP_EXTENDED_REPLY _or_ SSH_FXP_STATUS ? 
That's what the sftp_packet_requirev() function is for already!

-- 

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

From libssh2-devel-bounces@cool.haxx.se  Tue Aug 27 22:04:58 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7RK4UHV010775;
	Tue, 27 Aug 2013 22:04:52 +0200
Received: from mail-ob0-x22e.google.com (mail-ob0-x22e.google.com
 [IPv6:2607:f8b0:4003:c01::22e])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7RK4RbD010733
 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 27 Aug 2013 22:04:28 +0200
Received: by mail-ob0-f174.google.com with SMTP id wd6so5543885obb.33
 for <libssh2-devel@cool.haxx.se>; Tue, 27 Aug 2013 13:04:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :content-type; bh=j7HcyQ6j/KwBcQSih7ILc1h9fWwYpRVXlLjkA0363FI=;
 b=Z8Fra6MqZaGEgYgtV/6c7ErLHxb1VDsix4MKjx5rO+ggABtqrOG6jwYQyxxF6aITl1
 yJeNuZ6RvEX78H1a+1VZwofoef4jdBVHKtK1XpJjmNWf9OUQ9hviqODOppowVOd5baLm
 zmdJPmOCBKgLABPxBiHpz4nWIuqJXSpe7r2EIJmOSktDp+mUNzHKEhAn96kgtmvwEtfK
 T4Z/FB4+Q/AprPhpl5O988ifE8kzd12cKYyhQE0fwipVszS9agYDe8u22Q7GieiNIpHg
 RlVlkdCVeZmqDE6Q1qIy4B1OG8AwIfQ1P9ErjhXRrwcg+LvHIDo/V/k3jHUzHWipLUw9
 qkWg==
MIME-Version: 1.0
X-Received: by 10.60.117.198 with SMTP id kg6mr1983906oeb.80.1377633862883;
 Tue, 27 Aug 2013 13:04:22 -0700 (PDT)
Received: by 10.76.172.4 with HTTP; Tue, 27 Aug 2013 13:04:22 -0700 (PDT)
In-Reply-To: <CAN=WvWv9+=GQzJDwNMsojbA0E9qDLTm7G5=k92yKR6DUR4=kGA@mail.gmail.com>
References: <CAN=WvWtmE_YTEQs3k+OX8+wLNzRNOb1BWn=uOXm+yvDdxoNSVA@mail.gmail.com>
 <alpine.DEB.2.00.1308231153520.18916@tvnag.unkk.fr>
 <CAN=WvWv9+=GQzJDwNMsojbA0E9qDLTm7G5=k92yKR6DUR4=kGA@mail.gmail.com>
Date: Tue, 27 Aug 2013 23:04:22 +0300
Message-ID: <CAN=WvWs0LvC7BwgQ_sroJqb_suQkj5coS81_7SiGx5AeftEGRw@mail.gmail.com>
Subject: Re: [SFTP] Is there a way to determine the maximum buffer len when
 reading.
From: Velichko Yuriy <velichko.yuriy@gmail.com>
To: libssh2 development <libssh2-devel@cool.haxx.se>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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="===============0177135354=="
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

--===============0177135354==
Content-Type: multipart/alternative; boundary=047d7b3a99f8071dfe04e4f3619e

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

I checked the code again, and unfortunately have not found the answer why
the block size is limited by 2000 bytes.

libssh2_sftp_read() always returns 2000 if I ask read bigger block.

So I had to split reading on several steps with less (fixed) block size.

On 26 August 2013 18:13, Velichko Yuriy <velichko.yuriy@gmail.com> wrote:

> Thank you for the answer. I'll check my code carefully, to determine i get
> such answer from the function.
>
>
> On 23 August 2013 12:58, Daniel Stenberg <daniel@haxx.se> wrote:
>
>> On Fri, 23 Aug 2013, Velichko Yuriy wrote:
>>
>>  I tried to read data from file using function libssh2_sftp_read(3).
>>>
>>> The buffer_maxlen = 8000
>>>
>>> But the "Number of bytes actually populated into buffer"  (the return
>>> value of function) is always 2000.
>>>
>>
>> I don't think it is always 2000.
>>
>> When you ask for data with this function from libssh2, the function will
>> split up the request into multiple requests for several pieces and as soon
>> as the first data has arrived it returns that. The subsequent data pieces
>> can then be returned in the next call to this function, should they have
>> arrived then.
>>
>> This is an optimization to help bite off the worst problems with the
>> request/response nature of the SFTP protocol and its small packets. You get
>> the first data available faster, and chances are that when you subsequently
>> ask for more data it might already have been received.
>>
>> You should still ask for as much data as possible at once so that libssh2
>> will send out requests for all of it, and thus make you get data faster.
>> This is especially important if you're on high latency connections.
>>
>> --
>>
>>  / daniel.haxx.se
>> ______________________________**_________________
>> libssh2-devel http://cool.haxx.se/cgi-bin/**
>> mailman/listinfo/libssh2-devel<http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel>
>>
>
>
>
> --
> Best Regards!
>



-- 
Best Regards!

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

<div dir=3D"ltr"><div class=3D"gmail_extra"><div>I checked the code again, =
and unfortunately have not found the answer why the block size is limited b=
y 2000 bytes.</div><div><br></div><div>libssh2_sftp_read() always returns 2=
000 if I ask read bigger block.</div>
<div><br></div><div>So I had to split reading on several steps with less (f=
ixed) block size.</div><br><div class=3D"gmail_quote">On 26 August 2013 18:=
13, Velichko Yuriy <span dir=3D"ltr">&lt;<a href=3D"mailto:velichko.yuriy@g=
mail.com" target=3D"_blank">velichko.yuriy@gmail.com</a>&gt;</span> wrote:<=
br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex"><div dir=3D"ltr">Thank you for the answer. I&#39;ll check =
my code carefully, to determine i get such answer from the function.=A0<br>
<div class=3D"gmail_extra"><div><div class=3D"h5"><br><br><div class=3D"gma=
il_quote">On 23 August 2013 12:58, Daniel Stenberg <span dir=3D"ltr">&lt;<a=
 href=3D"mailto:daniel@haxx.se" target=3D"_blank">daniel@haxx.se</a>&gt;</s=
pan> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex"><div>On Fri, 23 Aug 2013, Velichko Yuriy wrote:<br>

<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex">
I tried to read data from file using function libssh2_sftp_read(3).<br>
<br>
The buffer_maxlen =3D 8000<br>
<br>
But the &quot;Number of bytes actually populated into buffer&quot; =A0(the =
return value of function) is always 2000.<br>
</blockquote>
<br></div>
I don&#39;t think it is always 2000.<br>
<br>
When you ask for data with this function from libssh2, the function will sp=
lit up the request into multiple requests for several pieces and as soon as=
 the first data has arrived it returns that. The subsequent data pieces can=
 then be returned in the next call to this function, should they have arriv=
ed then.<br>


<br>
This is an optimization to help bite off the worst problems with the reques=
t/response nature of the SFTP protocol and its small packets. You get the f=
irst data available faster, and chances are that when you subsequently ask =
for more data it might already have been received.<br>


<br>
You should still ask for as much data as possible at once so that libssh2 w=
ill send out requests for all of it, and thus make you get data faster. Thi=
s is especially important if you&#39;re on high latency connections.<span><=
font color=3D"#888888"><br>


<br>
-- <br>
<br>
=A0/ <a href=3D"http://daniel.haxx.se" target=3D"_blank">daniel.haxx.se</a>=
<br>
______________________________<u></u>_________________<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/<u></u>mailman/list=
info/libssh2-devel</a><br>
</font></span></blockquote></div><br><br clear=3D"all"><div><br></div></div=
></div><span class=3D""><font color=3D"#888888">-- <br>Best=A0Regards!
</font></span></div></div>
</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br>Best=A0Regar=
ds!
</div></div>

--047d7b3a99f8071dfe04e4f3619e--

--===============0177135354==
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

--===============0177135354==--

From libssh2-devel-bounces@cool.haxx.se  Tue Aug 27 22:10:17 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7RKAE3W014700;
	Tue, 27 Aug 2013 22:10:17 +0200
Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7RKACkI014688
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <libssh2-devel@cool.haxx.se>; Tue, 27 Aug 2013 22:10:12 +0200
Received: from localhost (dast@localhost)
 by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r7RKACPu014684
 for <libssh2-devel@cool.haxx.se>; Tue, 27 Aug 2013 22:10:12 +0200
X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs
Date: Tue, 27 Aug 2013 22:10:12 +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] Is there a way to determine the maximum buffer len when
 reading.
In-Reply-To: <CAN=WvWs0LvC7BwgQ_sroJqb_suQkj5coS81_7SiGx5AeftEGRw@mail.gmail.com>
Message-ID: <alpine.DEB.2.00.1308272209220.12068@tvnag.unkk.fr>
References: <CAN=WvWtmE_YTEQs3k+OX8+wLNzRNOb1BWn=uOXm+yvDdxoNSVA@mail.gmail.com>
 <alpine.DEB.2.00.1308231153520.18916@tvnag.unkk.fr>
 <CAN=WvWv9+=GQzJDwNMsojbA0E9qDLTm7G5=k92yKR6DUR4=kGA@mail.gmail.com>
 <CAN=WvWs0LvC7BwgQ_sroJqb_suQkj5coS81_7SiGx5AeftEGRw@mail.gmail.com>
User-Agent: Alpine 2.00 (DEB 1167 2008-08-23)
X-fromdanielhimself: yes
MIME-Version: 1.0
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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" <libssh2-devel-bounces@cool.haxx.se>

On Tue, 27 Aug 2013, Velichko Yuriy wrote:

> I checked the code again, and unfortunately have not found the answer why 
> the block size is limited by 2000 bytes.
>
> libssh2_sftp_read() always returns 2000 if I ask read bigger block.
>
> So I had to split reading on several steps with less (fixed) block size.

I don't understand what you want. I already explained why it behaves like this 
and why it is _good_ for most (if not all) users.

-- 

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

From libssh2-devel-bounces@cool.haxx.se  Fri Aug 30 09:39:57 2013
Return-Path: <libssh2-devel-bounces@cool.haxx.se>
Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1])
	by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r7U7dU3t021333;
	Fri, 30 Aug 2013 09:39:52 +0200
Received: from vsp-authed-01-02.binero.net (vsp-authed02.binero.net
 [195.74.38.226])
 by giant.haxx.se (8.14.4/8.14.4/Debian-2) with SMTP id r7U7dSW1021269
 for <libssh2-devel@cool.haxx.se>; Fri, 30 Aug 2013 09:39:28 +0200
Message-Id: <201308300739.r7U7dSW1021269@giant.haxx.se>
Received: from smtp01.binero.se (unknown [195.74.38.28])
 by vsp-authed-01-02.binero.net (Halon Mail Gateway) with ESMTP
 for <libssh2-devel@cool.haxx.se>; Fri, 30 Aug 2013 09:39:22 +0200 (CEST)
Received: from blubbedev.net (m176-70-19-233.cust.tele2.se [176.70.19.233])
 (Authenticated sender: dev@blubbedev.net)
 by smtp-08-01.atm.binero.net (Postfix) with ESMTPA id 8C1633A27E
 for <libssh2-devel@cool.haxx.se>; Fri, 30 Aug 2013 09:39:20 +0200 (CEST)
From: Leif Salomonsson <dev@blubbedev.net>
To: libssh2 development <libssh2-devel@cool.haxx.se>
Subject: Re: sftp_packet_require() patch
X-Mailer: SimpleMail 0.38 (MorphOS/MUI) E-Mail Client (c) 2000-2011 by Hynek
 Schlawack and Sebastian Bauer
Date: 30 Aug 2013 09:39:00 +0100
In-Reply-To: <alpine.DEB.2.00.1308271351360.6929@tvnag.unkk.fr>
X-BeenThere: libssh2-devel@cool.haxx.se
X-Mailman-Version: 2.1.15
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>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: libssh2-devel-bounces@cool.haxx.se
Sender: "libssh2-devel" <libssh2-devel-bounces@cool.haxx.se>

Hello Daniel,

On 2013-08-27, you wrote:
> On Fri, 9 Aug 2013, Leif Salomonsson wrote:

> Sorry for the delay of reviewing this.

>>> I noticed this problem when calling sftp_statvfs() when connected to a 
>>> server that does not support statvfs extension. This results in the
>>> server  returning a STATUS instead of an EXTENDED_REPLY. Libssh2 is not
>>> prepared  for this, and just waits for EXTENDED_REPLY to arrive, which
>>> never happens.  My proposed fix is attached. It modifies
>>> sftp_packet_require() to handle  this specific scenario.
>>
>> Updated the patch file.
>> A "_" character got lost from a _libssh2_debug() call..

> First, please follow the existing source code indentation style we use.

Right.

> Then, I really don't like having the same code chunk pasted twice into
> that  sftp_packet_require() function and it seems odd to put that kind of
> specific  logic into the generic requrie function.

> Isn't it rather so that the funtion that calls sftp_packet_require() in
> this  case should rather ask for one of SSH_FXP_EXTENDED_REPLY _or_
> SSH_FXP_STATUS ?  That's what the sftp_packet_requirev() function is for
> already! 

OK, it looks like sftp_packet_requirev() might solve the problem.
I will try that..

Regards
Leif

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

