From libssh2-devel-bounces@cool.haxx.se Tue Oct 1 13:41:57 2013 Return-Path: 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 r91BfQ16021861; Tue, 1 Oct 2013 13:41:51 +0200 Received: from mail-qe0-x22c.google.com (mail-qe0-x22c.google.com [IPv6:2607:f8b0:400d:c02::22c]) by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r91BfNPW021836 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 1 Oct 2013 13:41:24 +0200 Received: by mail-qe0-f44.google.com with SMTP id 3so4867937qeb.3 for ; Tue, 01 Oct 2013 04:41:18 -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=TX2jy4Q5loLr71bKeMvEwVm69CJuvJRBXWJzSXcUZM8=; b=SP4VwcQouYOOI/bBo+EnC42e9zuKcKYOVYr5aEAKyzUN7nYs0s0BAiNyCtdwVO82vp HK87BTSQEJTdx9QRCAo5q0u9dlw9UeY4OAlufd+QdyIjLpTJwVWMdmTPCLccd7GANpuZ LmvIgxCjraVGpvJBgZYS13R3UqwpHvTp4Qbmzu3XviEno36eX6uCw2R6SsS7qNe3ARX5 k4wyAgCBmBPse7Oz/t9gP+U8NE80CyoCpe5XFcZe6NxM3heNNxBLTbSwFe0vnNKtWzd/ Dg5OtOINda3KPkEvAGUv6C18yaXmyZRRbborR4L8dRkjBSBL+1x+poql2ILTxFfKu0bG HDCA== MIME-Version: 1.0 X-Received: by 10.224.166.67 with SMTP id l3mr20037270qay.39.1380627677974; Tue, 01 Oct 2013 04:41:17 -0700 (PDT) Received: by 10.140.85.41 with HTTP; Tue, 1 Oct 2013 04:41:17 -0700 (PDT) Date: Tue, 1 Oct 2013 19:41:17 +0800 Message-ID: Subject: Need help with 'libssh2_userauth_keyboard_interactive' From: Liang Ge To: libssh2-devel@cool.haxx.se X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.15 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============0594323527==" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" --===============0594323527== Content-Type: multipart/alternative; boundary=047d7b62527c50187904e7ac6ec8 --047d7b62527c50187904e7ac6ec8 Content-Type: text/plain; charset=UTF-8 Hi everyone! The 'http://www.libssh2.org/' declares 'libssh2' support both blocking & non-blocking, what is your suggest for 'libssh2_userauth_keyboard', like, 'response_callback' might block? maybe, best, one process should only handle one session? Liang --047d7b62527c50187904e7ac6ec8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi everyone!

The 'http://www.libssh2.org/' declares 'libssh2&#= 39; support both blocking & non-blocking, what is your suggest for '= ;libssh2_userauth_keyboard', like, 'response_callback' might bl= ock?

maybe, best, one process should only handle one session= ?

Liang
--047d7b62527c50187904e7ac6ec8-- --===============0594323527== 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 --===============0594323527==-- From libssh2-devel-bounces@cool.haxx.se Wed Oct 2 11:08:50 2013 Return-Path: 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 r9298Qnd012827; Wed, 2 Oct 2013 11:08:44 +0200 Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r9298NUC012822 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 2 Oct 2013 11:08:24 +0200 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VRIPu-0000Vf-Ty for libssh2-devel@cool.haxx.se; Wed, 02 Oct 2013 11:08:22 +0200 Received: from 213.37.131.197.static.user.ono.com ([213.37.131.197]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 02 Oct 2013 11:08:22 +0200 Received: from sfandino by 213.37.131.197.static.user.ono.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 02 Oct 2013 11:08:22 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: libssh2-devel@cool.haxx.se From: Salvador Fandino Subject: [PATCH] add support for unknown key types in libssh2_knownhost_* Date: Wed, 02 Oct 2013 11:08:09 +0200 Lines: 472 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050404040804030503040001" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 213.37.131.197.static.user.ono.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.15 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" This is a multi-part message in MIME format. --------------050404040804030503040001 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit [I send this yesterday through Trac, but I am not sure it is being monitored] --------------050404040804030503040001 Content-Type: text/x-patch; name="0001-support-unknown-host-key-types-in-known-host.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-support-unknown-host-key-types-in-known-host.patch" From dcdd48c00e6fda6f0e2648fb3426981714b547a0 Mon Sep 17 00:00:00 2001 From: Salvador Date: Tue, 1 Oct 2013 12:59:52 +0200 Subject: [PATCH] store but don't use keys of unsupported types on the known_hosts file. Currently, when libssh2 parses a known_host file containing keys of some type it doesn't natively support, it stops reading the file and returns an error. That means, that the known_host file can not be safely shared with other software supporting other key types (i.e. OpenSSH). This patch adds support for handling keys of unknown type. It can read and write them, even if they are never going to be matched. At the source level the patch does the following things: - add a new unknown key type LIBSSH2_KNOWNHOST_KEY_UNKNOWN - add a new slot (key_type_name) on the known_host struct that is used to store the key type in ascii form when it is not supported - parse correctly known_hosts entries with unknown key types and populate the key_type_name slot - print correctly known_hosts entries of unknown type - when checking a host key ignore keys that do not match the key type --- include/libssh2.h | 3 +- src/knownhost.c | 238 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 142 insertions(+), 99 deletions(-) diff --git a/include/libssh2.h b/include/libssh2.h index 1b0d690..172e9b3 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -865,11 +865,12 @@ libssh2_knownhost_init(LIBSSH2_SESSION *session); #define LIBSSH2_KNOWNHOST_KEYENC_BASE64 (2<<16) /* type of key (2 bits) */ -#define LIBSSH2_KNOWNHOST_KEY_MASK (3<<18) +#define LIBSSH2_KNOWNHOST_KEY_MASK (7<<18) #define LIBSSH2_KNOWNHOST_KEY_SHIFT 18 #define LIBSSH2_KNOWNHOST_KEY_RSA1 (1<<18) #define LIBSSH2_KNOWNHOST_KEY_SSHRSA (2<<18) #define LIBSSH2_KNOWNHOST_KEY_SSHDSS (3<<18) +#define LIBSSH2_KNOWNHOST_KEY_UNKNOWN (7<<18) LIBSSH2_API int libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts, diff --git a/src/knownhost.c b/src/knownhost.c index 8e1889c..9d1b825 100644 --- a/src/knownhost.c +++ b/src/knownhost.c @@ -50,6 +50,7 @@ struct known_host { size_t salt_len; /* size of salt */ char *key; /* the (allocated) associated key. This is kept base64 encoded in memory. */ + char *key_type_name; /* the (allocated) key type name */ char *comment; /* the (allocated) optional comment text, may be NULL */ /* this is the struct we expose externally */ @@ -67,6 +68,8 @@ static void free_host(LIBSSH2_SESSION *session, struct known_host *entry) if(entry) { if(entry->comment) LIBSSH2_FREE(session, entry->comment); + if (entry->key_type_name) + LIBSSH2_FREE(session, entry->key_type_name); if(entry->key) LIBSSH2_FREE(session, entry->key); if(entry->salt) @@ -127,6 +130,7 @@ static struct libssh2_knownhost *knownhost_to_external(struct known_host *node) static int knownhost_add(LIBSSH2_KNOWNHOSTS *hosts, const char *host, const char *salt, + const char *key_type_name, size_t key_type_len, const char *key, size_t keylen, const char *comment, size_t commentlen, int typemask, struct libssh2_knownhost **store) @@ -210,6 +214,17 @@ knownhost_add(LIBSSH2_KNOWNHOSTS *hosts, entry->key = ptr; } + if (key_type_name && ((typemask & LIBSSH2_KNOWNHOST_KEY_MASK) == LIBSSH2_KNOWNHOST_KEY_UNKNOWN)) { + entry->key_type_name = LIBSSH2_ALLOC(hosts->session, key_type_len+1); + if (!entry->key_type_name) { + rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC, + "Unable to allocate memory for key type"); + goto error; + } + memcpy(entry->key_type_name, key_type_name, key_type_len); + entry->key_type_name[key_type_len]=0; + } + if (comment) { entry->comment = LIBSSH2_ALLOC(hosts->session, commentlen+1); if(!entry->comment) { @@ -264,7 +279,7 @@ libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts, const char *key, size_t keylen, int typemask, struct libssh2_knownhost **store) { - return knownhost_add(hosts, host, salt, key, keylen, NULL, 0, typemask, + return knownhost_add(hosts, host, salt, NULL, 0, key, keylen, NULL, 0, typemask, store); } @@ -303,8 +318,8 @@ libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts, const char *comment, size_t commentlen, int typemask, struct libssh2_knownhost **store) { - return knownhost_add(hosts, host, salt, key, keylen, comment, commentlen, - typemask, store); + return knownhost_add(hosts, host, salt, NULL, 0, key, keylen, + comment, commentlen, typemask, store); } /* @@ -414,23 +429,34 @@ knownhost_check(LIBSSH2_KNOWNHOSTS *hosts, break; } if(match) { - /* host name match, now compare the keys */ - if(!strcmp(key, node->key)) { - /* they match! */ - if (ext) - *ext = knownhost_to_external(node); - badkey = NULL; - rc = LIBSSH2_KNOWNHOST_CHECK_MATCH; - break; - } - else { - /* remember the first node that had a host match but a - failed key match since we continue our search from - here */ - if(!badkey) - badkey = node; - match = 0; /* don't count this as a match anymore */ + int host_key_type = typemask & LIBSSH2_KNOWNHOST_KEY_MASK; + int known_key_type = node->typemask & LIBSSH2_KNOWNHOST_KEY_MASK; + /* match on key type as follows: + - never match on an unknown key type + - if key_type is set to zero, ignore it an match always + - otherwise match when both key types are equal + */ + if ( (host_key_type != LIBSSH2_KNOWNHOST_KEY_UNKNOWN ) && + ( (host_key_type == 0) || + (host_key_type == known_key_type) ) ) { + /* host name and key type match, now compare the keys */ + if(!strcmp(key, node->key)) { + /* they match! */ + if (ext) + *ext = knownhost_to_external(node); + badkey = NULL; + rc = LIBSSH2_KNOWNHOST_CHECK_MATCH; + break; + } + else { + /* remember the first node that had a host match but a + failed key match since we continue our search from + here */ + if(!badkey) + badkey = node; + } } + match = 0; /* don't count this as a match anymore */ } node= _libssh2_list_next(&node->node); } @@ -573,6 +599,7 @@ libssh2_knownhost_free(LIBSSH2_KNOWNHOSTS *hosts) */ static int oldstyle_hostline(LIBSSH2_KNOWNHOSTS *hosts, const char *host, size_t hostlen, + const char *key_type_name, size_t key_type_len, const char *key, size_t keylen, int key_type, const char *comment, size_t commentlen) { @@ -607,7 +634,9 @@ static int oldstyle_hostline(LIBSSH2_KNOWNHOSTS *hosts, memcpy(hostbuf, name, namelen); hostbuf[namelen]=0; - rc = knownhost_add(hosts, hostbuf, NULL, key, keylen, + rc = knownhost_add(hosts, hostbuf, NULL, + key_type_name, key_type_len, + key, keylen, comment, commentlen, key_type | LIBSSH2_KNOWNHOST_TYPE_PLAIN | LIBSSH2_KNOWNHOST_KEYENC_BASE64, NULL); @@ -627,6 +656,7 @@ static int oldstyle_hostline(LIBSSH2_KNOWNHOSTS *hosts, /* |1|[salt]|[hash] */ static int hashed_hostline(LIBSSH2_KNOWNHOSTS *hosts, const char *host, size_t hostlen, + const char *key_type_name, size_t key_type_len, const char *key, size_t keylen, int key_type, const char *comment, size_t commentlen) { @@ -670,9 +700,11 @@ static int hashed_hostline(LIBSSH2_KNOWNHOSTS *hosts, memcpy(hostbuf, host, hostlen); hostbuf[hostlen]=0; - return knownhost_add(hosts, hostbuf, salt, key, keylen, comment, - commentlen, - key_type | LIBSSH2_KNOWNHOST_TYPE_SHA1 | + return knownhost_add(hosts, hostbuf, salt, + key_type_name, key_type_len, + key, keylen, + comment, commentlen, + key_type | LIBSSH2_KNOWNHOST_TYPE_SHA1 | LIBSSH2_KNOWNHOST_KEYENC_BASE64, NULL); } else @@ -694,7 +726,9 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts, const char *key, size_t keylen) { const char *comment = NULL; + const char *key_type_name = NULL; size_t commentlen = 0; + size_t key_type_len; int key_type; /* make some checks that the lengths seem sensible */ @@ -703,7 +737,7 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts, LIBSSH2_ERROR_METHOD_NOT_SUPPORTED, "Failed to parse known_hosts line " "(key too short)"); - + switch(key[0]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': @@ -716,19 +750,21 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts, */ break; - case 's': /* ssh-dss or ssh-rsa */ - if(!strncmp(key, "ssh-dss", 7)) + default: + key_type_name = key; + while (keylen && *key && + (*key != ' ') && (*key != '\t')) { + key++; + keylen--; + } + key_type_len = key - key_type_name; + + if (!strncmp(key_type_name, "ssh-dss", key_type_len)) key_type = LIBSSH2_KNOWNHOST_KEY_SSHDSS; - else if(!strncmp(key, "ssh-rsa", 7)) + if (!strncmp(key_type_name, "ssh-rsa", key_type_len)) key_type = LIBSSH2_KNOWNHOST_KEY_SSHRSA; else - /* unknown key type */ - return _libssh2_error(hosts->session, - LIBSSH2_ERROR_METHOD_NOT_SUPPORTED, - "Unknown key type"); - - key += 7; - keylen -= 7; + key_type = LIBSSH2_KNOWNHOST_KEY_UNKNOWN; /* skip whitespaces */ while((*key ==' ') || (*key == '\t')) { @@ -760,11 +796,6 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts, commentlen--; } break; - - default: /* unknown key format */ - return _libssh2_error(hosts->session, - LIBSSH2_ERROR_METHOD_NOT_SUPPORTED, - "Unknown key format"); } /* Figure out host format */ @@ -774,12 +805,12 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts, for the sake of simplicity, we add them as separate hosts with the same key */ - return oldstyle_hostline(hosts, host, hostlen, key, keylen, key_type, + return oldstyle_hostline(hosts, host, hostlen, key_type_name, key_type_len, key, keylen, key_type, comment, commentlen); } else { /* |1|[salt]|[hash] */ - return hashed_hostline(hosts, host, hostlen, key, keylen, key_type, + return hashed_hostline(hosts, host, hostlen, key_type_name, key_type_len, key, keylen, key_type, comment, commentlen); } } @@ -943,7 +974,7 @@ knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts, char *buf, size_t buflen, size_t *outlen, int type) { - int rc = LIBSSH2_ERROR_NONE; + int tindex; const char *keytypes[4]={ "", /* not used */ @@ -951,7 +982,9 @@ knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts, " ssh-rsa", " ssh-dss" }; - const char *keytype; + const char *key_type_name; + size_t key_type_len; + size_t offset = 0; size_t nlen; size_t commentlen = 0; @@ -963,11 +996,28 @@ knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts, "Unsupported type of known-host information " "store"); - tindex = (node->typemask & LIBSSH2_KNOWNHOST_KEY_MASK) >> - LIBSSH2_KNOWNHOST_KEY_SHIFT; + switch(node->typemask & LIBSSH2_KNOWNHOST_KEY_MASK) { + case LIBSSH2_KNOWNHOST_KEY_RSA1: + key_type_name = NULL; + break; + case LIBSSH2_KNOWNHOST_KEY_SSHRSA: + key_type_name = "ssh-rsa"; + break; + case LIBSSH2_KNOWNHOST_KEY_SSHDSS: + key_type_name = "ssh-dss"; + break; + case LIBSSH2_KNOWNHOST_KEY_UNKNOWN: + key_type_name = node->key_type_name; + if (key_type_name) break; + /* otherwise fallback to default and error */ + default: + return _libssh2_error(hosts->session, + LIBSSH2_ERROR_METHOD_NOT_SUPPORTED, + "Unsupported type of known-host entry"); + } - /* set the string used in the file */ - keytype = keytypes[tindex]; + key_type_len = (key_type_name ? strlen(key_type_name) + 1 : 0); + /* calculate extra space needed for comment */ if(node->comment) @@ -975,63 +1025,55 @@ knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts, if((node->typemask & LIBSSH2_KNOWNHOST_TYPE_MASK) == LIBSSH2_KNOWNHOST_TYPE_SHA1) { - char *namealloc; - char *saltalloc; - nlen = _libssh2_base64_encode(hosts->session, node->name, - node->name_len, &namealloc); - if(!nlen) - return _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC, - "Unable to allocate memory for " - "base64-encoded host name"); - - nlen = _libssh2_base64_encode(hosts->session, - node->salt, node->salt_len, - &saltalloc); - if(!nlen) { - LIBSSH2_FREE(hosts->session, namealloc); - return _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC, - "Unable to allocate memory for " - "base64-encoded salt"); - } - - nlen = strlen(saltalloc) + strlen(namealloc) + strlen(keytype) + - strlen(node->key) + commentlen + 7; - /* |1| + | + ' ' + \n + \0 = 7 */ - - if(nlen <= buflen) - if(node->comment) - snprintf(buf, buflen, "|1|%s|%s%s %s %s\n", saltalloc, namealloc, - keytype, node->key, node->comment); - else - snprintf(buf, buflen, "|1|%s|%s%s %s\n", saltalloc, namealloc, - keytype, node->key); + int rc = LIBSSH2_ERROR_NONE; + char *namealloc = NULL; + char *saltalloc = NULL; + if (_libssh2_base64_encode(hosts->session, node->name, + node->name_len, &namealloc) && + _libssh2_base64_encode(hosts->session, + node->salt, node->salt_len, + &saltalloc)) + offset = snprintf(buf, buflen, "|1|%s|%s", saltalloc, namealloc); else - rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_BUFFER_TOO_SMALL, - "Known-host write buffer too small"); + rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC, + "Unable to allocate memory for known-host line"); + + if (namealloc) + LIBSSH2_FREE(hosts->session, namealloc); + if (saltalloc) + LIBSSH2_FREE(hosts->session, saltalloc); - LIBSSH2_FREE(hosts->session, namealloc); - LIBSSH2_FREE(hosts->session, saltalloc); + if (rc != LIBSSH2_ERROR_NONE) return rc; } - else { - nlen = strlen(node->name) + strlen(keytype) + strlen(node->key) + - commentlen + 3; - /* ' ' + '\n' + \0 = 3 */ - if(nlen <= buflen) - /* these types have the plain name */ - if(node->comment) - snprintf(buf, buflen, "%s%s %s %s\n", node->name, keytype, node->key, - node->comment); - else - snprintf(buf, buflen, "%s%s %s\n", node->name, keytype, node->key); - else - rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_BUFFER_TOO_SMALL, - "Known-host write buffer too small"); + else + offset = snprintf(buf, buflen, "%s", node->name); + + if (offset >= buflen) goto buffer_to_small; + + if (key_type_name) { + offset += snprintf(buf + offset, buflen - offset, + " %s", key_type_name); + if (offset >= buflen) goto buffer_to_small; } - /* we report the full length of the data with the trailing zero excluded */ - *outlen = nlen-1; + offset += snprintf(buf + offset, buflen - offset, + " %s", node->key); + if (offset >= buflen) goto buffer_to_small; - return rc; + if (node->comment) + offset += snprintf(buf + offset, buflen - offset, + " %s\n", node->comment); + else + offset += snprintf(buf + offset, buflen - offset, "\n"); + + if (offset >= buflen) goto buffer_to_small; + + *outlen = offset; + return LIBSSH2_ERROR_NONE; + + buffer_to_small: + return _libssh2_error(hosts->session, LIBSSH2_ERROR_BUFFER_TOO_SMALL, + "Known-host write buffer too small"); } /* -- 1.8.3.2 --------------050404040804030503040001 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 --------------050404040804030503040001-- From libssh2-devel-bounces@cool.haxx.se Wed Oct 2 11:40:04 2013 Return-Path: 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 r929du6H027533; Wed, 2 Oct 2013 11:40:04 +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 r929dtsI027514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 2 Oct 2013 11:39:55 +0200 Received: from localhost (dast@localhost) by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r929dtDH027502 for ; Wed, 2 Oct 2013 11:39:55 +0200 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Wed, 2 Oct 2013 11:39:55 +0200 (CEST) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: Re: [PATCH] add support for unknown key types in libssh2_knownhost_* In-Reply-To: Message-ID: References: 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 List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On Wed, 2 Oct 2013, Salvador Fandino wrote: This sounds like awesome functionality that we've really been missing. I'll try to review it within a couple of days. -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Fri Oct 4 11:22:13 2013 Return-Path: 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 r949LiBe018666; Fri, 4 Oct 2013 11:22:07 +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 r949LgaO018652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 4 Oct 2013 11:21:42 +0200 Received: (qmail 4627 invoked from network); 4 Oct 2013 09:20:51 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 4 Oct 2013 09:20:51 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: cody@cutrer.us X-Trac-Project: libssh2 Date: Fri, 04 Oct 2013 09:20:51 -0000 X-URL: https://trac.libssh2.org/ Subject: [libssh2] #274: ssh agent cannot be shared between sessions X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/274 Message-ID: <044.b579f0585029662c19d00111f3b8bd90@libssh2.stuge.se> X-Trac-Ticket-ID: 274 X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r949LgaO018652 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 List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #274: ssh agent cannot be shared between sessions -------------------------+-------------------- Reporter: ccutrer | Owner: Type: enhancement | Status: new Priority: normal | Milestone: 1.4.3 Component: API | Version: 1.4.2 Keywords: | Blocked By: Blocks: | -------------------------+-------------------- besides accessing a session for the alloc/free callbacks, only the actual userauth method needs a session. I propose an userauth_ex method that takes a session as an argument, so that a single agent connection can be shared if you're making many connections (think a dsh or parallel-scp replacement). for now I've worked around this by jsut overwriting the session field in LIBSSH2_AGENT before calling userauth, and it's working great. -- Ticket URL: libssh2 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 Fri Oct 4 11:22:14 2013 Return-Path: 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 r949MDtx018912; Fri, 4 Oct 2013 11:22:14 +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 r949LoN3018717 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 4 Oct 2013 11:21:50 +0200 Received: (qmail 4664 invoked from network); 4 Oct 2013 09:21:02 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 4 Oct 2013 09:21:02 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: cody@cutrer.us X-Trac-Project: libssh2 Date: Fri, 04 Oct 2013 09:21:02 -0000 X-URL: https://trac.libssh2.org/ Subject: [libssh2] #275: ssh agent cannot be used non-blocking X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/275 Message-ID: <044.1dd0bdc92ab38eb2b09bb75accb68c49@libssh2.stuge.se> X-Trac-Ticket-ID: 275 X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r949LoN3018717 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 List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #275: ssh agent cannot be used non-blocking -------------------------+-------------------- Reporter: ccutrer | Owner: Type: enhancement | Status: new Priority: normal | Milestone: 1.4.3 Component: API | Version: 1.4.2 Keywords: | Blocked By: Blocks: | -------------------------+-------------------- if you're accessing an agent that's already been forwarded by an ssh connection, there can be non-insignificant delays in the send/receive, so a non-blocking API is needed -- Ticket URL: libssh2 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 Fri Oct 4 11:22:15 2013 Return-Path: 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 r949MEMe018951; Fri, 4 Oct 2013 11:22:14 +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 r949M5jc018888 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 4 Oct 2013 11:22:05 +0200 Received: (qmail 4686 invoked from network); 4 Oct 2013 09:21:17 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 4 Oct 2013 09:21:17 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: sfandino@yahoo.com X-Trac-Project: libssh2 Date: Fri, 04 Oct 2013 09:21:17 -0000 X-URL: https://trac.libssh2.org/ Subject: [libssh2] #276: do not fail when keys of unknown type are read from known_hosts file X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/276 Message-ID: <042.310bff264790ea0eb774c869a2913cb7@libssh2.stuge.se> X-Trac-Ticket-ID: 276 X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r949M5jc018888 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 List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #276: do not fail when keys of unknown type are read from known_hosts file --------------------+-------------------- Reporter: salva | Owner: Type: defect | Status: new Priority: normal | Milestone: 1.4.3 Component: misc | Version: 1.4.2 Keywords: | Blocked By: Blocks: | --------------------+-------------------- Currently, when `libssh2_knownhost_readfile` finds a key of a type not natively supported by the library, it stops reading and returns an error. This is very annoying as OpenSSH uses other key types and so its known_host can not be used. Even worse, if the programmer is sloppy, and doesn't check for errors when calling `libssh2_knownhost_readfile` and later saves the file, it will wipe out any entries after the unsupported one. The attached patch solves that issue. Commit log follows: {{{ store but don't use keys of unsupported types on the known_hosts file. Currently, when libssh2 parses a known_host file containing keys of some type it doesn't natively support, it stops reading the file and returns an error. That means, that the known_host file can not be safely shared with other software supporting other key types (i.e. OpenSSH). This patch adds support for handling keys of unknown type. It can read and write them, even if they are never going to be matched. At the source level the patch does the following things: - add a new unknown key type LIBSSH2_KNOWNHOST_KEY_UNKNOWN - add a new slot (key_type_name) on the known_host struct that is used to store the key type in ascii form when it is not supported - parse correctly known_hosts entries with unknown key types and populate the key_type_name slot - print correctly known_hosts entries of unknown type - when checking a host key ignore keys that do not match the key type }}} -- Ticket URL: libssh2 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 Fri Oct 4 11:49:36 2013 Return-Path: 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 r949nVlj001484; Fri, 4 Oct 2013 11:49:36 +0200 Received: from mail-ve0-x22a.google.com (mail-ve0-x22a.google.com [IPv6:2607:f8b0:400c:c01::22a]) by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r949nSLo001456 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Fri, 4 Oct 2013 11:49:29 +0200 Received: by mail-ve0-f170.google.com with SMTP id c14so2382100vea.15 for ; Fri, 04 Oct 2013 02:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=roa9zp8upCZwbPEiCX685v4bhf9a+8WmHnGRC+zfOEQ=; b=qPLPs8uE/D8Vau0Sv5I0e/mCjdwTlEOc30+IDGQY4AdVnXOmX7m3Hs+TX9WLD63/Ax 7wMLFMIHUtbDKSMSGptlQD0+6DVQH6tOzqHk9JnwxykiiDeR6NcfahzhqS0WTUS4MGUa wkLyFWY71DvuNZL0hYk9Vq3SgMrToHEM1RslqzIPgLm3dMuw+m9/DJqgzq5O5TF2/4/K wqqSChrV6TqOtDEanZmytwFfL/oMCzh7M+KnxQuekkUhQ5yPX2m14d19KdBm15u11zN7 vlun6otBUFNmSkCS+93gddANc9ghicy8eC4m8T2bcuwIhICohpmyGwIGyLy7a/rORJkX EEUQ== MIME-Version: 1.0 X-Received: by 10.52.64.143 with SMTP id o15mr9880750vds.16.1380880162939; Fri, 04 Oct 2013 02:49:22 -0700 (PDT) Received: by 10.52.106.131 with HTTP; Fri, 4 Oct 2013 02:49:22 -0700 (PDT) In-Reply-To: References: Date: Fri, 4 Oct 2013 10:49:22 +0100 X-Google-Sender-Auth: 17i5UMt4qB8PV_8OvVPQ_6BjJjg Message-ID: Subject: Re: [PATCH] add support for unknown key types in libssh2_knownhost_* From: Alexander Lamaison To: libssh2 development X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.15 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" On 2 October 2013 10:08, Salvador Fandino wrote: > [I send this yesterday through Trac, but I am not sure it is being > monitored] It is monitored but I'm not sure it is correctly notifying us moderators when someone posts. Peter, is it sending you emails when there are items in the queue? I keep approving tickets assigned to you, which have been sat in the queue for weeks. I'm assuming you are unaware of them so maybe something is not set up right. Can it be set up to notify all moderators for all tickets because this delay is a bit disheartening for people who have taken the trouble to file a bug. Alex -- Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org) _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Fri Oct 4 11:57:09 2013 Return-Path: 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 r949v6pd005729; Fri, 4 Oct 2013 11:57:08 +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 r949v4Qs005722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Fri, 4 Oct 2013 11:57:04 +0200 Received: (qmail 13169 invoked from network); 4 Oct 2013 09:56:16 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 4 Oct 2013 09:56:16 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: sfandino@yahoo.com, awl03@doc.ic.ac.uk X-Trac-Project: libssh2 Date: Fri, 04 Oct 2013 09:56:16 -0000 X-URL: https://trac.libssh2.org/ Subject: Re: [libssh2] #276: do not fail when keys of unknown type are read from known_hosts file X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/276#comment:1 Message-ID: <057.ddf14e1a0abdcd4ce4d49725a35c3681@libssh2.stuge.se> References: <042.310bff264790ea0eb774c869a2913cb7@libssh2.stuge.se> X-Trac-Ticket-ID: 276 In-Reply-To: <042.310bff264790ea0eb774c869a2913cb7@libssh2.stuge.se> X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r949v4Qs005722 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 List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #276: do not fail when keys of unknown type are read from known_hosts file ---------------------+------------------- Reporter: salva | Owner: Type: defect | Status: new Priority: normal | Milestone: 1.4.3 Component: misc | Version: 1.4.2 Resolution: | Keywords: Blocked By: | Blocks: ---------------------+------------------- Comment (by alamaison): Yes, we needed this functionality. Thanks. A couple of observations about knownhost.c: - On line 1019 you use `strlen` to find the length of the key type name. But this string may come from the user and they are asked to supply it as a buffer and length pair. Therefore `strlen` isn't usable here as (theoretically) it could contain anything including NUL characters. I know, who would want to do that (multi-byte character set maybe?), but the API should do what it promises. - The bottom of the file uses a `goto`. There are some legitimate uses of `goto` but this is not one of them. If multiple places need to return the buffer-too-small error then multiple places should return that error. -- Ticket URL: libssh2 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 Sat Oct 5 23:08:47 2013 Return-Path: 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 r95L8KvF004063; Sat, 5 Oct 2013 23:08:42 +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 r95L8Jsd004048 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 5 Oct 2013 23:08:19 +0200 Received: from localhost (dast@localhost) by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r95L8JZR004044 for ; Sat, 5 Oct 2013 23:08:19 +0200 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Sat, 5 Oct 2013 23:08:19 +0200 (CEST) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: Re: [PATCH] add support for unknown key types in libssh2_knownhost_* In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) X-fromdanielhimself: yes MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="1129329158-33565826-1381007299=:6366" X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.15 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1129329158-33565826-1381007299=:6366 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Wed, 2 Oct 2013, Salvador Fandino wrote: Okay, I removed some warnings and shortened a few lines and ammended the patch then looks like this one. I don't have any good test case setup to verify this patch so I'll appreciate an extra set of eyes on this patch if possible! Salvador, I assume you successfully use this functionality? -- / daniel.haxx.se --1129329158-33565826-1381007299=:6366 Content-Type: TEXT/x-diff; name=0001-knownhosts-add-support-for-unknown-key-types.patch Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=0001-knownhosts-add-support-for-unknown-key-types.patch RnJvbSBlN2MwYWJmYmRlYTJiNGMzYmY3ZjVjOWFhYThhMzQ1ZWY4YzE2MWFi IE1vbiBTZXAgMTcgMDA6MDA6MDAgMjAwMQ0KRnJvbTogU2FsdmFkb3IgRmFu ZGlubyA8c2ZhbmRpbm9AeWFob28uY29tPg0KRGF0ZTogVHVlLCAxIE9jdCAy MDEzIDEyOjU5OjUyICswMjAwDQpTdWJqZWN0OiBbUEFUQ0hdIGtub3duaG9z dHM6IGFkZCBzdXBwb3J0IGZvciB1bmtub3duIGtleSB0eXBlcw0KDQpzdG9y ZSBidXQgZG9uJ3QgdXNlIGtleXMgb2YgdW5zdXBwb3J0ZWQgdHlwZXMgb24g dGhlIGtub3duX2hvc3RzIGZpbGUuDQoNCkN1cnJlbnRseSwgd2hlbiBsaWJz c2gyIHBhcnNlcyBhIGtub3duX2hvc3QgZmlsZSBjb250YWluaW5nIGtleXMg b2Ygc29tZQ0KdHlwZSBpdCBkb2Vzbid0IG5hdGl2ZWx5IHN1cHBvcnQsIGl0 IHN0b3BzIHJlYWRpbmcgdGhlIGZpbGUgYW5kIHJldHVybnMNCmFuIGVycm9y Lg0KDQpUaGF0IG1lYW5zLCB0aGF0IHRoZSBrbm93bl9ob3N0IGZpbGUgY2Fu IG5vdCBiZSBzYWZlbHkgc2hhcmVkIHdpdGggb3RoZXINCnNvZnR3YXJlIHN1 cHBvcnRpbmcgb3RoZXIga2V5IHR5cGVzIChpLmUuIE9wZW5TU0gpLg0KDQpU aGlzIHBhdGNoIGFkZHMgc3VwcG9ydCBmb3IgaGFuZGxpbmcga2V5cyBvZiB1 bmtub3duIHR5cGUuIEl0IGNhbiByZWFkDQphbmQgd3JpdGUgdGhlbSwgZXZl biBpZiB0aGV5IGFyZSBuZXZlciBnb2luZyB0byBiZSBtYXRjaGVkLg0KDQpB dCB0aGUgc291cmNlIGxldmVsIHRoZSBwYXRjaCBkb2VzIHRoZSBmb2xsb3dp bmcgdGhpbmdzOg0KDQotIGFkZCBhIG5ldyB1bmtub3duIGtleSB0eXBlIExJ QlNTSDJfS05PV05IT1NUX0tFWV9VTktOT1dODQoNCi0gYWRkIGEgbmV3IHNs b3QgKGtleV90eXBlX25hbWUpIG9uIHRoZSBrbm93bl9ob3N0IHN0cnVjdCB0 aGF0IGlzIHVzZWQNCnRvIHN0b3JlIHRoZSBrZXkgdHlwZSBpbiBhc2NpaSBm b3JtIHdoZW4gaXQgaXMgbm90IHN1cHBvcnRlZA0KDQotIHBhcnNlIGNvcnJl Y3RseSBrbm93bl9ob3N0cyBlbnRyaWVzIHdpdGggdW5rbm93biBrZXkgdHlw ZXMgYW5kDQpwb3B1bGF0ZSB0aGUga2V5X3R5cGVfbmFtZSBzbG90DQoNCi0g cHJpbnQgY29ycmVjdGx5IGtub3duX2hvc3RzIGVudHJpZXMgb2YgdW5rbm93 biB0eXBlDQoNCi0gd2hlbiBjaGVja2luZyBhIGhvc3Qga2V5IGlnbm9yZSBr ZXlzIHRoYXQgZG8gbm90IG1hdGNoIHRoZSBrZXkgdHlwZQ0KLS0tDQogaW5j bHVkZS9saWJzc2gyLmggfCAgIDMgKy0NCiBzcmMva25vd25ob3N0LmMgICB8 IDI1OCArKysrKysrKysrKysrKysrKysrKysrKysrKysrKystLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0NCiAyIGZpbGVzIGNoYW5nZWQsIDE0NiBpbnNlcnRp b25zKCspLCAxMTUgZGVsZXRpb25zKC0pDQoNCmRpZmYgLS1naXQgYS9pbmNs dWRlL2xpYnNzaDIuaCBiL2luY2x1ZGUvbGlic3NoMi5oDQppbmRleCAxYjBk NjkwLi4xNzJlOWIzIDEwMDY0NA0KLS0tIGEvaW5jbHVkZS9saWJzc2gyLmgN CisrKyBiL2luY2x1ZGUvbGlic3NoMi5oDQpAQCAtODY1LDExICs4NjUsMTIg QEAgbGlic3NoMl9rbm93bmhvc3RfaW5pdChMSUJTU0gyX1NFU1NJT04gKnNl c3Npb24pOw0KICNkZWZpbmUgTElCU1NIMl9LTk9XTkhPU1RfS0VZRU5DX0JB U0U2NCAgICgyPDwxNikNCiANCiAvKiB0eXBlIG9mIGtleSAoMiBiaXRzKSAq Lw0KLSNkZWZpbmUgTElCU1NIMl9LTk9XTkhPU1RfS0VZX01BU0sgICAgICgz PDwxOCkNCisjZGVmaW5lIExJQlNTSDJfS05PV05IT1NUX0tFWV9NQVNLICAg ICAoNzw8MTgpDQogI2RlZmluZSBMSUJTU0gyX0tOT1dOSE9TVF9LRVlfU0hJ RlQgICAgMTgNCiAjZGVmaW5lIExJQlNTSDJfS05PV05IT1NUX0tFWV9SU0Ex ICAgICAoMTw8MTgpDQogI2RlZmluZSBMSUJTU0gyX0tOT1dOSE9TVF9LRVlf U1NIUlNBICAgKDI8PDE4KQ0KICNkZWZpbmUgTElCU1NIMl9LTk9XTkhPU1Rf S0VZX1NTSERTUyAgICgzPDwxOCkNCisjZGVmaW5lIExJQlNTSDJfS05PV05I T1NUX0tFWV9VTktOT1dOICAoNzw8MTgpDQogDQogTElCU1NIMl9BUEkgaW50 DQogbGlic3NoMl9rbm93bmhvc3RfYWRkKExJQlNTSDJfS05PV05IT1NUUyAq aG9zdHMsDQpkaWZmIC0tZ2l0IGEvc3JjL2tub3duaG9zdC5jIGIvc3JjL2tu b3duaG9zdC5jDQppbmRleCA4ZTE4ODljLi41YjJlMGM0IDEwMDY0NA0KLS0t IGEvc3JjL2tub3duaG9zdC5jDQorKysgYi9zcmMva25vd25ob3N0LmMNCkBA IC0xLDUgKzEsNSBAQA0KIC8qDQotICogQ29weXJpZ2h0IChjKSAyMDA5LTIw MTEgYnkgRGFuaWVsIFN0ZW5iZXJnDQorICogQ29weXJpZ2h0IChjKSAyMDA5 LTIwMTMgYnkgRGFuaWVsIFN0ZW5iZXJnDQogICogQWxsIHJpZ2h0cyByZXNl cnZlZC4NCiAgKg0KICAqIFJlZGlzdHJpYnV0aW9uIGFuZCB1c2UgaW4gc291 cmNlIGFuZCBiaW5hcnkgZm9ybXMsDQpAQCAtNTAsNiArNTAsNyBAQCBzdHJ1 Y3Qga25vd25faG9zdCB7DQogICAgIHNpemVfdCBzYWx0X2xlbjsgLyogc2l6 ZSBvZiBzYWx0ICovDQogICAgIGNoYXIgKmtleTsgICAgICAgLyogdGhlIChh bGxvY2F0ZWQpIGFzc29jaWF0ZWQga2V5LiBUaGlzIGlzIGtlcHQgYmFzZTY0 DQogICAgICAgICAgICAgICAgICAgICAgICAgZW5jb2RlZCBpbiBtZW1vcnku ICovDQorICAgIGNoYXIgKmtleV90eXBlX25hbWU7IC8qIHRoZSAoYWxsb2Nh dGVkKSBrZXkgdHlwZSBuYW1lICovDQogICAgIGNoYXIgKmNvbW1lbnQ7ICAg LyogdGhlIChhbGxvY2F0ZWQpIG9wdGlvbmFsIGNvbW1lbnQgdGV4dCwgbWF5 IGJlIE5VTEwgKi8NCiANCiAgICAgLyogdGhpcyBpcyB0aGUgc3RydWN0IHdl IGV4cG9zZSBleHRlcm5hbGx5ICovDQpAQCAtNjcsNiArNjgsOCBAQCBzdGF0 aWMgdm9pZCBmcmVlX2hvc3QoTElCU1NIMl9TRVNTSU9OICpzZXNzaW9uLCBz dHJ1Y3Qga25vd25faG9zdCAqZW50cnkpDQogICAgIGlmKGVudHJ5KSB7DQog ICAgICAgICBpZihlbnRyeS0+Y29tbWVudCkNCiAgICAgICAgICAgICBMSUJT U0gyX0ZSRUUoc2Vzc2lvbiwgZW50cnktPmNvbW1lbnQpOw0KKyAgICAgICAg aWYgKGVudHJ5LT5rZXlfdHlwZV9uYW1lKQ0KKyAgICAgICAgICAgIExJQlNT SDJfRlJFRShzZXNzaW9uLCBlbnRyeS0+a2V5X3R5cGVfbmFtZSk7DQogICAg ICAgICBpZihlbnRyeS0+a2V5KQ0KICAgICAgICAgICAgIExJQlNTSDJfRlJF RShzZXNzaW9uLCBlbnRyeS0+a2V5KTsNCiAgICAgICAgIGlmKGVudHJ5LT5z YWx0KQ0KQEAgLTEyNyw2ICsxMzAsNyBAQCBzdGF0aWMgc3RydWN0IGxpYnNz aDJfa25vd25ob3N0ICprbm93bmhvc3RfdG9fZXh0ZXJuYWwoc3RydWN0IGtu b3duX2hvc3QgKm5vZGUpDQogc3RhdGljIGludA0KIGtub3duaG9zdF9hZGQo TElCU1NIMl9LTk9XTkhPU1RTICpob3N0cywNCiAgICAgICAgICAgICAgIGNv bnN0IGNoYXIgKmhvc3QsIGNvbnN0IGNoYXIgKnNhbHQsDQorICAgICAgICAg ICAgICBjb25zdCBjaGFyICprZXlfdHlwZV9uYW1lLCBzaXplX3Qga2V5X3R5 cGVfbGVuLA0KICAgICAgICAgICAgICAgY29uc3QgY2hhciAqa2V5LCBzaXpl X3Qga2V5bGVuLA0KICAgICAgICAgICAgICAgY29uc3QgY2hhciAqY29tbWVu dCwgc2l6ZV90IGNvbW1lbnRsZW4sDQogICAgICAgICAgICAgICBpbnQgdHlw ZW1hc2ssIHN0cnVjdCBsaWJzc2gyX2tub3duaG9zdCAqKnN0b3JlKQ0KQEAg LTIxMCw2ICsyMTQsMTggQEAga25vd25ob3N0X2FkZChMSUJTU0gyX0tOT1dO SE9TVFMgKmhvc3RzLA0KICAgICAgICAgZW50cnktPmtleSA9IHB0cjsNCiAg ICAgfQ0KIA0KKyAgICBpZiAoa2V5X3R5cGVfbmFtZSAmJiAoKHR5cGVtYXNr ICYgTElCU1NIMl9LTk9XTkhPU1RfS0VZX01BU0spID09DQorICAgICAgICAg ICAgICAgICAgICAgICAgICBMSUJTU0gyX0tOT1dOSE9TVF9LRVlfVU5LTk9X TikpIHsNCisgICAgICAgIGVudHJ5LT5rZXlfdHlwZV9uYW1lID0gTElCU1NI Ml9BTExPQyhob3N0cy0+c2Vzc2lvbiwga2V5X3R5cGVfbGVuKzEpOw0KKyAg ICAgICAgaWYgKCFlbnRyeS0+a2V5X3R5cGVfbmFtZSkgew0KKyAgICAgICAg ICAgIHJjID0gX2xpYnNzaDJfZXJyb3IoaG9zdHMtPnNlc3Npb24sIExJQlNT SDJfRVJST1JfQUxMT0MsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAiVW5hYmxlIHRvIGFsbG9jYXRlIG1lbW9yeSBmb3Iga2V5IHR5cGUi KTsNCisgICAgICAgICAgICBnb3RvIGVycm9yOw0KKyAgICAgICAgfQ0KKyAg ICAgICAgbWVtY3B5KGVudHJ5LT5rZXlfdHlwZV9uYW1lLCBrZXlfdHlwZV9u YW1lLCBrZXlfdHlwZV9sZW4pOw0KKyAgICAgICAgZW50cnktPmtleV90eXBl X25hbWVba2V5X3R5cGVfbGVuXT0wOw0KKyAgICB9DQorDQogICAgIGlmIChj b21tZW50KSB7DQogICAgICAgICBlbnRyeS0+Y29tbWVudCA9IExJQlNTSDJf QUxMT0MoaG9zdHMtPnNlc3Npb24sIGNvbW1lbnRsZW4rMSk7DQogICAgICAg ICBpZighZW50cnktPmNvbW1lbnQpIHsNCkBAIC0yNjQsOCArMjgwLDggQEAg bGlic3NoMl9rbm93bmhvc3RfYWRkKExJQlNTSDJfS05PV05IT1NUUyAqaG9z dHMsDQogICAgICAgICAgICAgICAgICAgICAgIGNvbnN0IGNoYXIgKmtleSwg c2l6ZV90IGtleWxlbiwNCiAgICAgICAgICAgICAgICAgICAgICAgaW50IHR5 cGVtYXNrLCBzdHJ1Y3QgbGlic3NoMl9rbm93bmhvc3QgKipzdG9yZSkNCiB7 DQotICAgIHJldHVybiBrbm93bmhvc3RfYWRkKGhvc3RzLCBob3N0LCBzYWx0 LCBrZXksIGtleWxlbiwgTlVMTCwgMCwgdHlwZW1hc2ssDQotICAgICAgICAg ICAgICAgICAgICAgICAgIHN0b3JlKTsNCisgICAgcmV0dXJuIGtub3duaG9z dF9hZGQoaG9zdHMsIGhvc3QsIHNhbHQsIE5VTEwsIDAsIGtleSwga2V5bGVu LCBOVUxMLCAwLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlbWFz aywgc3RvcmUpOw0KIH0NCiANCiANCkBAIC0zMDMsOCArMzE5LDggQEAgbGli c3NoMl9rbm93bmhvc3RfYWRkYyhMSUJTU0gyX0tOT1dOSE9TVFMgKmhvc3Rz LA0KICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciAqY29tbWVu dCwgc2l6ZV90IGNvbW1lbnRsZW4sDQogICAgICAgICAgICAgICAgICAgICAg ICBpbnQgdHlwZW1hc2ssIHN0cnVjdCBsaWJzc2gyX2tub3duaG9zdCAqKnN0 b3JlKQ0KIHsNCi0gICAgcmV0dXJuIGtub3duaG9zdF9hZGQoaG9zdHMsIGhv c3QsIHNhbHQsIGtleSwga2V5bGVuLCBjb21tZW50LCBjb21tZW50bGVuLA0K LSAgICAgICAgICAgICAgICAgICAgICAgICB0eXBlbWFzaywgc3RvcmUpOw0K KyAgICByZXR1cm4ga25vd25ob3N0X2FkZChob3N0cywgaG9zdCwgc2FsdCwg TlVMTCwgMCwga2V5LCBrZXlsZW4sDQorICAgICAgICAgICAgICAgICAgICAg ICAgIGNvbW1lbnQsIGNvbW1lbnRsZW4sIHR5cGVtYXNrLCBzdG9yZSk7DQog fQ0KIA0KIC8qDQpAQCAtNDE0LDIzICs0MzAsMzYgQEAga25vd25ob3N0X2No ZWNrKExJQlNTSDJfS05PV05IT1NUUyAqaG9zdHMsDQogICAgICAgICAgICAg ICAgIGJyZWFrOw0KICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICBpZiht YXRjaCkgew0KLSAgICAgICAgICAgICAgICAvKiBob3N0IG5hbWUgbWF0Y2gs IG5vdyBjb21wYXJlIHRoZSBrZXlzICovDQotICAgICAgICAgICAgICAgIGlm KCFzdHJjbXAoa2V5LCBub2RlLT5rZXkpKSB7DQotICAgICAgICAgICAgICAg ICAgICAvKiB0aGV5IG1hdGNoISAqLw0KLSAgICAgICAgICAgICAgICAgICAg aWYgKGV4dCkNCi0gICAgICAgICAgICAgICAgICAgICAgICAqZXh0ID0ga25v d25ob3N0X3RvX2V4dGVybmFsKG5vZGUpOw0KLSAgICAgICAgICAgICAgICAg ICAgYmFka2V5ID0gTlVMTDsNCi0gICAgICAgICAgICAgICAgICAgIHJjID0g TElCU1NIMl9LTk9XTkhPU1RfQ0hFQ0tfTUFUQ0g7DQotICAgICAgICAgICAg ICAgICAgICBicmVhazsNCi0gICAgICAgICAgICAgICAgfQ0KLSAgICAgICAg ICAgICAgICBlbHNlIHsNCi0gICAgICAgICAgICAgICAgICAgIC8qIHJlbWVt YmVyIHRoZSBmaXJzdCBub2RlIHRoYXQgaGFkIGEgaG9zdCBtYXRjaCBidXQg YQ0KLSAgICAgICAgICAgICAgICAgICAgICAgZmFpbGVkIGtleSBtYXRjaCBz aW5jZSB3ZSBjb250aW51ZSBvdXIgc2VhcmNoIGZyb20NCi0gICAgICAgICAg ICAgICAgICAgICAgIGhlcmUgKi8NCi0gICAgICAgICAgICAgICAgICAgIGlm KCFiYWRrZXkpDQotICAgICAgICAgICAgICAgICAgICAgICAgYmFka2V5ID0g bm9kZTsNCi0gICAgICAgICAgICAgICAgICAgIG1hdGNoID0gMDsgLyogZG9u J3QgY291bnQgdGhpcyBhcyBhIG1hdGNoIGFueW1vcmUgKi8NCisgICAgICAg ICAgICAgICAgaW50IGhvc3Rfa2V5X3R5cGUgPSB0eXBlbWFzayAmIExJQlNT SDJfS05PV05IT1NUX0tFWV9NQVNLOw0KKyAgICAgICAgICAgICAgICBpbnQg a25vd25fa2V5X3R5cGUgPQ0KKyAgICAgICAgICAgICAgICAgICAgbm9kZS0+ dHlwZW1hc2sgJiBMSUJTU0gyX0tOT1dOSE9TVF9LRVlfTUFTSzsNCisNCisg ICAgICAgICAgICAgICAgLyogbWF0Y2ggb24ga2V5IHR5cGUgYXMgZm9sbG93 czoNCisgICAgICAgICAgICAgICAgICAgLSBuZXZlciBtYXRjaCBvbiBhbiB1 bmtub3duIGtleSB0eXBlDQorICAgICAgICAgICAgICAgICAgIC0gaWYga2V5 X3R5cGUgaXMgc2V0IHRvIHplcm8sIGlnbm9yZSBpdCBhbiBtYXRjaCBhbHdh eXMNCisgICAgICAgICAgICAgICAgICAgLSBvdGhlcndpc2UgbWF0Y2ggd2hl biBib3RoIGtleSB0eXBlcyBhcmUgZXF1YWwNCisgICAgICAgICAgICAgICAg Ki8NCisgICAgICAgICAgICAgICAgaWYgKCAoaG9zdF9rZXlfdHlwZSAhPSBM SUJTU0gyX0tOT1dOSE9TVF9LRVlfVU5LTk9XTiApICYmDQorICAgICAgICAg ICAgICAgICAgICAgKCAoaG9zdF9rZXlfdHlwZSA9PSAwKSB8fA0KKyAgICAg ICAgICAgICAgICAgICAgICAgKGhvc3Rfa2V5X3R5cGUgPT0ga25vd25fa2V5 X3R5cGUpICkgKSB7DQorICAgICAgICAgICAgICAgICAgICAvKiBob3N0IG5h bWUgYW5kIGtleSB0eXBlIG1hdGNoLCBub3cgY29tcGFyZSB0aGUga2V5cyAq Lw0KKyAgICAgICAgICAgICAgICAgICAgaWYoIXN0cmNtcChrZXksIG5vZGUt PmtleSkpIHsNCisgICAgICAgICAgICAgICAgICAgICAgICAvKiB0aGV5IG1h dGNoISAqLw0KKyAgICAgICAgICAgICAgICAgICAgICAgIGlmIChleHQpDQor ICAgICAgICAgICAgICAgICAgICAgICAgICAgICpleHQgPSBrbm93bmhvc3Rf dG9fZXh0ZXJuYWwobm9kZSk7DQorICAgICAgICAgICAgICAgICAgICAgICAg YmFka2V5ID0gTlVMTDsNCisgICAgICAgICAgICAgICAgICAgICAgICByYyA9 IExJQlNTSDJfS05PV05IT1NUX0NIRUNLX01BVENIOw0KKyAgICAgICAgICAg ICAgICAgICAgICAgIGJyZWFrOw0KKyAgICAgICAgICAgICAgICAgICAgfQ0K KyAgICAgICAgICAgICAgICAgICAgZWxzZSB7DQorICAgICAgICAgICAgICAg ICAgICAgICAgLyogcmVtZW1iZXIgdGhlIGZpcnN0IG5vZGUgdGhhdCBoYWQg YSBob3N0IG1hdGNoIGJ1dCBhDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgZmFpbGVkIGtleSBtYXRjaCBzaW5jZSB3ZSBjb250aW51ZSBvdXIgc2Vh cmNoIGZyb20NCisgICAgICAgICAgICAgICAgICAgICAgICAgICBoZXJlICov DQorICAgICAgICAgICAgICAgICAgICAgICAgaWYoIWJhZGtleSkNCisgICAg ICAgICAgICAgICAgICAgICAgICAgICAgYmFka2V5ID0gbm9kZTsNCisgICAg ICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgfQ0KKyAgICAg ICAgICAgICAgICBtYXRjaCA9IDA7IC8qIGRvbid0IGNvdW50IHRoaXMgYXMg YSBtYXRjaCBhbnltb3JlICovDQogICAgICAgICAgICAgfQ0KICAgICAgICAg ICAgIG5vZGU9IF9saWJzc2gyX2xpc3RfbmV4dCgmbm9kZS0+bm9kZSk7DQog ICAgICAgICB9DQpAQCAtNTczLDYgKzYwMiw3IEBAIGxpYnNzaDJfa25vd25o b3N0X2ZyZWUoTElCU1NIMl9LTk9XTkhPU1RTICpob3N0cykNCiAqLw0KIHN0 YXRpYyBpbnQgb2xkc3R5bGVfaG9zdGxpbmUoTElCU1NIMl9LTk9XTkhPU1RT ICpob3N0cywNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0 IGNoYXIgKmhvc3QsIHNpemVfdCBob3N0bGVuLA0KKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgY29uc3QgY2hhciAqa2V5X3R5cGVfbmFtZSwgc2l6 ZV90IGtleV90eXBlX2xlbiwNCiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIGNvbnN0IGNoYXIgKmtleSwgc2l6ZV90IGtleWxlbiwgaW50IGtleV90 eXBlLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hh ciAqY29tbWVudCwgc2l6ZV90IGNvbW1lbnRsZW4pDQogew0KQEAgLTYwNyw3 ICs2MzcsOSBAQCBzdGF0aWMgaW50IG9sZHN0eWxlX2hvc3RsaW5lKExJQlNT SDJfS05PV05IT1NUUyAqaG9zdHMsDQogICAgICAgICAgICAgbWVtY3B5KGhv c3RidWYsIG5hbWUsIG5hbWVsZW4pOw0KICAgICAgICAgICAgIGhvc3RidWZb bmFtZWxlbl09MDsNCiANCi0gICAgICAgICAgICByYyA9IGtub3duaG9zdF9h ZGQoaG9zdHMsIGhvc3RidWYsIE5VTEwsIGtleSwga2V5bGVuLA0KKyAgICAg ICAgICAgIHJjID0ga25vd25ob3N0X2FkZChob3N0cywgaG9zdGJ1ZiwgTlVM TCwNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5X3R5cGVf bmFtZSwga2V5X3R5cGVfbGVuLA0KKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBrZXksIGtleWxlbiwNCiAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgY29tbWVudCwgY29tbWVudGxlbiwNCiAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAga2V5X3R5cGUgfCBMSUJTU0gyX0tOT1dOSE9T VF9UWVBFX1BMQUlOIHwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgTElCU1NIMl9LTk9XTkhPU1RfS0VZRU5DX0JBU0U2NCwgTlVMTCk7DQpA QCAtNjI3LDYgKzY1OSw3IEBAIHN0YXRpYyBpbnQgb2xkc3R5bGVfaG9zdGxp bmUoTElCU1NIMl9LTk9XTkhPU1RTICpob3N0cywNCiAvKiB8MXxbc2FsdF18 W2hhc2hdICovDQogc3RhdGljIGludCBoYXNoZWRfaG9zdGxpbmUoTElCU1NI Ml9LTk9XTkhPU1RTICpob3N0cywNCiAgICAgICAgICAgICAgICAgICAgICAg ICAgICBjb25zdCBjaGFyICpob3N0LCBzaXplX3QgaG9zdGxlbiwNCisgICAg ICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICprZXlfdHlwZV9u YW1lLCBzaXplX3Qga2V5X3R5cGVfbGVuLA0KICAgICAgICAgICAgICAgICAg ICAgICAgICAgIGNvbnN0IGNoYXIgKmtleSwgc2l6ZV90IGtleWxlbiwgaW50 IGtleV90eXBlLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnN0 IGNoYXIgKmNvbW1lbnQsIHNpemVfdCBjb21tZW50bGVuKQ0KIHsNCkBAIC02 NzAsOSArNzAzLDExIEBAIHN0YXRpYyBpbnQgaGFzaGVkX2hvc3RsaW5lKExJ QlNTSDJfS05PV05IT1NUUyAqaG9zdHMsDQogICAgICAgICBtZW1jcHkoaG9z dGJ1ZiwgaG9zdCwgaG9zdGxlbik7DQogICAgICAgICBob3N0YnVmW2hvc3Rs ZW5dPTA7DQogDQotICAgICAgICByZXR1cm4ga25vd25ob3N0X2FkZChob3N0 cywgaG9zdGJ1Ziwgc2FsdCwga2V5LCBrZXlsZW4sIGNvbW1lbnQsDQotICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBjb21tZW50bGVuLA0KLSAgICAg ICAgICAgICAgICAgICAgICAgICAgICAga2V5X3R5cGUgfCBMSUJTU0gyX0tO T1dOSE9TVF9UWVBFX1NIQTEgfCANCisgICAgICAgIHJldHVybiBrbm93bmhv c3RfYWRkKGhvc3RzLCBob3N0YnVmLCBzYWx0LA0KKyAgICAgICAgICAgICAg ICAgICAgICAgICAgICAga2V5X3R5cGVfbmFtZSwga2V5X3R5cGVfbGVuLA0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5LCBrZXlsZW4sDQor ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb21tZW50LCBjb21tZW50 bGVuLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAga2V5X3R5cGUg fCBMSUJTU0gyX0tOT1dOSE9TVF9UWVBFX1NIQTEgfA0KICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgTElCU1NIMl9LTk9XTkhPU1RfS0VZRU5DX0JB U0U2NCwgTlVMTCk7DQogICAgIH0NCiAgICAgZWxzZQ0KQEAgLTY5NCw3ICs3 MjksOSBAQCBzdGF0aWMgaW50IGhvc3RsaW5lKExJQlNTSDJfS05PV05IT1NU UyAqaG9zdHMsDQogICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICpr ZXksIHNpemVfdCBrZXlsZW4pDQogew0KICAgICBjb25zdCBjaGFyICpjb21t ZW50ID0gTlVMTDsNCisgICAgY29uc3QgY2hhciAqa2V5X3R5cGVfbmFtZSA9 IE5VTEw7DQogICAgIHNpemVfdCBjb21tZW50bGVuID0gMDsNCisgICAgc2l6 ZV90IGtleV90eXBlX2xlbjsNCiAgICAgaW50IGtleV90eXBlOw0KIA0KICAg ICAvKiBtYWtlIHNvbWUgY2hlY2tzIHRoYXQgdGhlIGxlbmd0aHMgc2VlbSBz ZW5zaWJsZSAqLw0KQEAgLTcwMyw3ICs3NDAsNyBAQCBzdGF0aWMgaW50IGhv c3RsaW5lKExJQlNTSDJfS05PV05IT1NUUyAqaG9zdHMsDQogICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgTElCU1NIMl9FUlJPUl9NRVRIT0RfTk9U X1NVUFBPUlRFRCwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAi RmFpbGVkIHRvIHBhcnNlIGtub3duX2hvc3RzIGxpbmUgIg0KICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICIoa2V5IHRvbyBzaG9ydCkiKTsNCi0g ICAgDQorDQogICAgIHN3aXRjaChrZXlbMF0pIHsNCiAgICAgY2FzZSAnMCc6 IGNhc2UgJzEnOiBjYXNlICcyJzogY2FzZSAnMyc6IGNhc2UgJzQnOg0KICAg ICBjYXNlICc1JzogY2FzZSAnNic6IGNhc2UgJzcnOiBjYXNlICc4JzogY2Fz ZSAnOSc6DQpAQCAtNzE2LDE5ICs3NTMsMjEgQEAgc3RhdGljIGludCBob3N0 bGluZShMSUJTU0gyX0tOT1dOSE9TVFMgKmhvc3RzLA0KICAgICAgICAgICov DQogICAgICAgICBicmVhazsNCiANCi0gICAgY2FzZSAncyc6IC8qIHNzaC1k c3Mgb3Igc3NoLXJzYSAqLw0KLSAgICAgICAgaWYoIXN0cm5jbXAoa2V5LCAi c3NoLWRzcyIsIDcpKQ0KKyAgICBkZWZhdWx0Og0KKyAgICAgICAga2V5X3R5 cGVfbmFtZSA9IGtleTsNCisgICAgICAgIHdoaWxlIChrZXlsZW4gJiYgKmtl eSAmJg0KKyAgICAgICAgICAgICAgICgqa2V5ICE9ICcgJykgJiYgKCprZXkg IT0gJ1x0JykpIHsNCisgICAgICAgICAgICBrZXkrKzsNCisgICAgICAgICAg ICBrZXlsZW4tLTsNCisgICAgICAgIH0NCisgICAgICAgIGtleV90eXBlX2xl biA9IGtleSAtIGtleV90eXBlX25hbWU7DQorDQorICAgICAgICBpZiAoIXN0 cm5jbXAoa2V5X3R5cGVfbmFtZSwgInNzaC1kc3MiLCBrZXlfdHlwZV9sZW4p KQ0KICAgICAgICAgICAgIGtleV90eXBlID0gTElCU1NIMl9LTk9XTkhPU1Rf S0VZX1NTSERTUzsNCi0gICAgICAgIGVsc2UgaWYoIXN0cm5jbXAoa2V5LCAi c3NoLXJzYSIsIDcpKQ0KKyAgICAgICAgaWYgKCFzdHJuY21wKGtleV90eXBl X25hbWUsICJzc2gtcnNhIiwga2V5X3R5cGVfbGVuKSkNCiAgICAgICAgICAg ICBrZXlfdHlwZSA9IExJQlNTSDJfS05PV05IT1NUX0tFWV9TU0hSU0E7DQog ICAgICAgICBlbHNlDQotICAgICAgICAgICAgLyogdW5rbm93biBrZXkgdHlw ZSAqLw0KLSAgICAgICAgICAgIHJldHVybiBfbGlic3NoMl9lcnJvcihob3N0 cy0+c2Vzc2lvbiwNCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgTElCU1NIMl9FUlJPUl9NRVRIT0RfTk9UX1NVUFBPUlRFRCwNCi0gICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlVua25vd24ga2V5IHR5 cGUiKTsNCi0NCi0gICAgICAgIGtleSArPSA3Ow0KLSAgICAgICAga2V5bGVu IC09IDc7DQorICAgICAgICAgICAga2V5X3R5cGUgPSBMSUJTU0gyX0tOT1dO SE9TVF9LRVlfVU5LTk9XTjsNCiANCiAgICAgICAgIC8qIHNraXAgd2hpdGVz cGFjZXMgKi8NCiAgICAgICAgIHdoaWxlKCgqa2V5ID09JyAnKSB8fCAoKmtl eSA9PSAnXHQnKSkgew0KQEAgLTc2MCwxMSArNzk5LDYgQEAgc3RhdGljIGlu dCBob3N0bGluZShMSUJTU0gyX0tOT1dOSE9TVFMgKmhvc3RzLA0KICAgICAg ICAgICAgIGNvbW1lbnRsZW4tLTsNCiAgICAgICAgIH0NCiAgICAgICAgIGJy ZWFrOw0KLQ0KLSAgICBkZWZhdWx0OiAvKiB1bmtub3duIGtleSBmb3JtYXQg Ki8NCi0gICAgICAgIHJldHVybiBfbGlic3NoMl9lcnJvcihob3N0cy0+c2Vz c2lvbiwNCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICBMSUJTU0gy X0VSUk9SX01FVEhPRF9OT1RfU1VQUE9SVEVELA0KLSAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICJVbmtub3duIGtleSBmb3JtYXQiKTsNCiAgICAg fQ0KIA0KICAgICAvKiBGaWd1cmUgb3V0IGhvc3QgZm9ybWF0ICovDQpAQCAt Nzc0LDEyICs4MDgsMTQgQEAgc3RhdGljIGludCBob3N0bGluZShMSUJTU0gy X0tOT1dOSE9TVFMgKmhvc3RzLA0KICAgICAgICAgICAgZm9yIHRoZSBzYWtl IG9mIHNpbXBsaWNpdHksIHdlIGFkZCB0aGVtIGFzIHNlcGFyYXRlIGhvc3Rz IHdpdGggdGhlDQogICAgICAgICAgICBzYW1lIGtleQ0KICAgICAgICAgKi8N Ci0gICAgICAgIHJldHVybiBvbGRzdHlsZV9ob3N0bGluZShob3N0cywgaG9z dCwgaG9zdGxlbiwga2V5LCBrZXlsZW4sIGtleV90eXBlLA0KKyAgICAgICAg cmV0dXJuIG9sZHN0eWxlX2hvc3RsaW5lKGhvc3RzLCBob3N0LCBob3N0bGVu LCBrZXlfdHlwZV9uYW1lLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIGtleV90eXBlX2xlbiwga2V5LCBrZXlsZW4sIGtleV90eXBlLA0K ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1lbnQsIGNv bW1lbnRsZW4pOw0KICAgICB9DQogICAgIGVsc2Ugew0KICAgICAgICAgLyog fDF8W3NhbHRdfFtoYXNoXSAqLw0KLSAgICAgICAgcmV0dXJuIGhhc2hlZF9o b3N0bGluZShob3N0cywgaG9zdCwgaG9zdGxlbiwga2V5LCBrZXlsZW4sIGtl eV90eXBlLA0KKyAgICAgICAgcmV0dXJuIGhhc2hlZF9ob3N0bGluZShob3N0 cywgaG9zdCwgaG9zdGxlbiwga2V5X3R5cGVfbmFtZSwNCisgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAga2V5X3R5cGVfbGVuLCBrZXksIGtleWxl biwga2V5X3R5cGUsDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IGNvbW1lbnQsIGNvbW1lbnRsZW4pOw0KICAgICB9DQogfQ0KQEAgLTk0Mywx NyArOTc5LDkgQEAga25vd25ob3N0X3dyaXRlbGluZShMSUJTU0gyX0tOT1dO SE9TVFMgKmhvc3RzLA0KICAgICAgICAgICAgICAgICAgICAgY2hhciAqYnVm LCBzaXplX3QgYnVmbGVuLA0KICAgICAgICAgICAgICAgICAgICAgc2l6ZV90 ICpvdXRsZW4sIGludCB0eXBlKQ0KIHsNCi0gICAgaW50IHJjID0gTElCU1NI Ml9FUlJPUl9OT05FOw0KLSAgICBpbnQgdGluZGV4Ow0KLSAgICBjb25zdCBj aGFyICprZXl0eXBlc1s0XT17DQotICAgICAgICAiIiwgLyogbm90IHVzZWQg Ki8NCi0gICAgICAgICIiLCAvKiB0aGlzIHR5cGUgaGFzIG5vIG5hbWUgaW4g dGhlIGZpbGUgKi8NCi0gICAgICAgICIgc3NoLXJzYSIsDQotICAgICAgICAi IHNzaC1kc3MiDQotICAgIH07DQotICAgIGNvbnN0IGNoYXIgKmtleXR5cGU7 DQotICAgIHNpemVfdCBubGVuOw0KLSAgICBzaXplX3QgY29tbWVudGxlbiA9 IDA7DQorDQorICAgIGNvbnN0IGNoYXIgKmtleV90eXBlX25hbWU7DQorICAg IHNpemVfdCBvZmZzZXQgPSAwOw0KIA0KICAgICAvKiB3ZSBvbmx5IHN1cHBv cnQgdGhpcyBzaW5nbGUgZmlsZSB0eXBlIGZvciBub3csIGJhaWwgb3V0IG9u IGFsbCBvdGhlcg0KICAgICAgICBhdHRlbXB0cyAqLw0KQEAgLTk2Myw3NSAr OTkxLDc3IEBAIGtub3duaG9zdF93cml0ZWxpbmUoTElCU1NIMl9LTk9XTkhP U1RTICpob3N0cywNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAi VW5zdXBwb3J0ZWQgdHlwZSBvZiBrbm93bi1ob3N0IGluZm9ybWF0aW9uICIN CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAic3RvcmUiKTsNCiAN Ci0gICAgdGluZGV4ID0gKG5vZGUtPnR5cGVtYXNrICYgTElCU1NIMl9LTk9X TkhPU1RfS0VZX01BU0spID4+DQotICAgICAgICBMSUJTU0gyX0tOT1dOSE9T VF9LRVlfU0hJRlQ7DQotDQotICAgIC8qIHNldCB0aGUgc3RyaW5nIHVzZWQg aW4gdGhlIGZpbGUgKi8NCi0gICAga2V5dHlwZSA9IGtleXR5cGVzW3RpbmRl eF07DQotDQotICAgIC8qIGNhbGN1bGF0ZSBleHRyYSBzcGFjZSBuZWVkZWQg Zm9yIGNvbW1lbnQgKi8NCi0gICAgaWYobm9kZS0+Y29tbWVudCkNCi0gICAg ICAgIGNvbW1lbnRsZW4gPSBzdHJsZW4obm9kZS0+Y29tbWVudCkgKyAxOw0K KyAgICBzd2l0Y2gobm9kZS0+dHlwZW1hc2sgJiBMSUJTU0gyX0tOT1dOSE9T VF9LRVlfTUFTSykgew0KKyAgICBjYXNlIExJQlNTSDJfS05PV05IT1NUX0tF WV9SU0ExOg0KKyAgICAgICAga2V5X3R5cGVfbmFtZSA9IE5VTEw7DQorICAg ICAgICBicmVhazsNCisgICAgY2FzZSBMSUJTU0gyX0tOT1dOSE9TVF9LRVlf U1NIUlNBOg0KKyAgICAgICAga2V5X3R5cGVfbmFtZSA9ICJzc2gtcnNhIjsN CisgICAgICAgIGJyZWFrOw0KKyAgICBjYXNlIExJQlNTSDJfS05PV05IT1NU X0tFWV9TU0hEU1M6DQorICAgICAgICBrZXlfdHlwZV9uYW1lID0gInNzaC1k c3MiOw0KKyAgICAgICAgYnJlYWs7DQorICAgIGNhc2UgTElCU1NIMl9LTk9X TkhPU1RfS0VZX1VOS05PV046DQorICAgICAgICBrZXlfdHlwZV9uYW1lID0g bm9kZS0+a2V5X3R5cGVfbmFtZTsNCisgICAgICAgIGlmIChrZXlfdHlwZV9u YW1lKSBicmVhazsNCisgICAgICAgIC8qIG90aGVyd2lzZSBmYWxsYmFjayB0 byBkZWZhdWx0IGFuZCBlcnJvciAqLw0KKyAgICBkZWZhdWx0Og0KKyAgICAg ICAgcmV0dXJuIF9saWJzc2gyX2Vycm9yKGhvc3RzLT5zZXNzaW9uLA0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIExJQlNTSDJfRVJST1JfTUVU SE9EX05PVF9TVVBQT1JURUQsDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIlVuc3VwcG9ydGVkIHR5cGUgb2Yga25vd24taG9zdCBlbnRyeSIp Ow0KKyAgICB9DQogDQogICAgIGlmKChub2RlLT50eXBlbWFzayAmIExJQlNT SDJfS05PV05IT1NUX1RZUEVfTUFTSykgPT0NCiAgICAgICAgTElCU1NIMl9L Tk9XTkhPU1RfVFlQRV9TSEExKSB7DQotICAgICAgICBjaGFyICpuYW1lYWxs b2M7DQotICAgICAgICBjaGFyICpzYWx0YWxsb2M7DQotICAgICAgICBubGVu ID0gX2xpYnNzaDJfYmFzZTY0X2VuY29kZShob3N0cy0+c2Vzc2lvbiwgbm9k ZS0+bmFtZSwNCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIG5vZGUtPm5hbWVfbGVuLCAmbmFtZWFsbG9jKTsNCi0gICAgICAgIGlm KCFubGVuKQ0KLSAgICAgICAgICAgIHJldHVybiBfbGlic3NoMl9lcnJvciho b3N0cy0+c2Vzc2lvbiwgTElCU1NIMl9FUlJPUl9BTExPQywNCi0gICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIlVuYWJsZSB0byBhbGxvY2F0 ZSBtZW1vcnkgZm9yICINCi0gICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgImJhc2U2NC1lbmNvZGVkIGhvc3QgbmFtZSIpOw0KLQ0KLSAgICAg ICAgbmxlbiA9IF9saWJzc2gyX2Jhc2U2NF9lbmNvZGUoaG9zdHMtPnNlc3Np b24sDQotICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBu b2RlLT5zYWx0LCBub2RlLT5zYWx0X2xlbiwNCi0gICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICZzYWx0YWxsb2MpOw0KLSAgICAgICAg aWYoIW5sZW4pIHsNCi0gICAgICAgICAgICBMSUJTU0gyX0ZSRUUoaG9zdHMt PnNlc3Npb24sIG5hbWVhbGxvYyk7DQotICAgICAgICAgICAgcmV0dXJuIF9s aWJzc2gyX2Vycm9yKGhvc3RzLT5zZXNzaW9uLCBMSUJTU0gyX0VSUk9SX0FM TE9DLA0KLSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiVW5h YmxlIHRvIGFsbG9jYXRlIG1lbW9yeSBmb3IgIg0KLSAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAiYmFzZTY0LWVuY29kZWQgc2FsdCIpOw0K LSAgICAgICAgfQ0KLQ0KLSAgICAgICAgbmxlbiA9IHN0cmxlbihzYWx0YWxs b2MpICsgc3RybGVuKG5hbWVhbGxvYykgKyBzdHJsZW4oa2V5dHlwZSkgKw0K LSAgICAgICAgICAgIHN0cmxlbihub2RlLT5rZXkpICsgY29tbWVudGxlbiAr IDc7DQotICAgICAgICAvKiB8MXwgKyB8ICsgJyAnICsgXG4gKyBcMCA9IDcg Ki8NCi0NCi0gICAgICAgIGlmKG5sZW4gPD0gYnVmbGVuKQ0KLSAgICAgICAg ICAgIGlmKG5vZGUtPmNvbW1lbnQpDQotICAgICAgICAgICAgICAgIHNucHJp bnRmKGJ1ZiwgYnVmbGVuLCAifDF8JXN8JXMlcyAlcyAlc1xuIiwgc2FsdGFs bG9jLCBuYW1lYWxsb2MsDQotICAgICAgICAgICAgICAgICAgICAgICAga2V5 dHlwZSwgbm9kZS0+a2V5LCBub2RlLT5jb21tZW50KTsNCi0gICAgICAgICAg ICBlbHNlDQotICAgICAgICAgICAgICAgIHNucHJpbnRmKGJ1ZiwgYnVmbGVu LCAifDF8JXN8JXMlcyAlc1xuIiwgc2FsdGFsbG9jLCBuYW1lYWxsb2MsDQot ICAgICAgICAgICAgICAgICAgICAgICAga2V5dHlwZSwgbm9kZS0+a2V5KTsN CisgICAgICAgIGludCByYyA9IExJQlNTSDJfRVJST1JfTk9ORTsNCisgICAg ICAgIGNoYXIgKm5hbWVhbGxvYyA9IE5VTEw7DQorICAgICAgICBjaGFyICpz YWx0YWxsb2MgPSBOVUxMOw0KKyAgICAgICAgaWYgKF9saWJzc2gyX2Jhc2U2 NF9lbmNvZGUoaG9zdHMtPnNlc3Npb24sIG5vZGUtPm5hbWUsDQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2RlLT5uYW1lX2xlbiwg Jm5hbWVhbGxvYykgJiYNCisgICAgICAgICAgICBfbGlic3NoMl9iYXNlNjRf ZW5jb2RlKGhvc3RzLT5zZXNzaW9uLA0KKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgbm9kZS0+c2FsdCwgbm9kZS0+c2FsdF9sZW4sDQor ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAmc2FsdGFsbG9j KSkNCisgICAgICAgICAgICBvZmZzZXQgPSBzbnByaW50ZihidWYsIGJ1Zmxl biwgInwxfCVzfCVzIiwgc2FsdGFsbG9jLCBuYW1lYWxsb2MpOw0KICAgICAg ICAgZWxzZQ0KLSAgICAgICAgICAgIHJjID0gX2xpYnNzaDJfZXJyb3IoaG9z dHMtPnNlc3Npb24sIExJQlNTSDJfRVJST1JfQlVGRkVSX1RPT19TTUFMTCwN Ci0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJLbm93bi1ob3N0 IHdyaXRlIGJ1ZmZlciB0b28gc21hbGwiKTsNCisgICAgICAgICAgICByYyA9 IF9saWJzc2gyX2Vycm9yKGhvc3RzLT5zZXNzaW9uLCBMSUJTU0gyX0VSUk9S X0FMTE9DLA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIlVu YWJsZSB0byBhbGxvY2F0ZSBtZW1vcnkgZm9yIGtub3duLWhvc3QgbGluZSIp Ow0KIA0KLSAgICAgICAgTElCU1NIMl9GUkVFKGhvc3RzLT5zZXNzaW9uLCBu YW1lYWxsb2MpOw0KLSAgICAgICAgTElCU1NIMl9GUkVFKGhvc3RzLT5zZXNz aW9uLCBzYWx0YWxsb2MpOw0KKyAgICAgICAgaWYgKG5hbWVhbGxvYykNCisg ICAgICAgICAgICBMSUJTU0gyX0ZSRUUoaG9zdHMtPnNlc3Npb24sIG5hbWVh bGxvYyk7DQorICAgICAgICBpZiAoc2FsdGFsbG9jKQ0KKyAgICAgICAgICAg IExJQlNTSDJfRlJFRShob3N0cy0+c2Vzc2lvbiwgc2FsdGFsbG9jKTsNCisN CisgICAgICAgIGlmIChyYyAhPSBMSUJTU0gyX0VSUk9SX05PTkUpIHJldHVy biByYzsNCiAgICAgfQ0KLSAgICBlbHNlIHsNCi0gICAgICAgIG5sZW4gPSBz dHJsZW4obm9kZS0+bmFtZSkgKyBzdHJsZW4oa2V5dHlwZSkgKyBzdHJsZW4o bm9kZS0+a2V5KSArDQotICAgICAgICAgICAgY29tbWVudGxlbiArIDM7DQot ICAgICAgICAvKiAnICcgKyAnXG4nICsgXDAgPSAzICovDQotICAgICAgICBp ZihubGVuIDw9IGJ1ZmxlbikNCi0gICAgICAgICAgICAvKiB0aGVzZSB0eXBl cyBoYXZlIHRoZSBwbGFpbiBuYW1lICovDQotICAgICAgICAgICAgaWYobm9k ZS0+Y29tbWVudCkNCi0gICAgICAgICAgICAgICAgc25wcmludGYoYnVmLCBi dWZsZW4sICIlcyVzICVzICVzXG4iLCBub2RlLT5uYW1lLCBrZXl0eXBlLCBu b2RlLT5rZXksDQotICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS0+Y29t bWVudCk7DQotICAgICAgICAgICAgZWxzZQ0KLSAgICAgICAgICAgICAgICBz bnByaW50ZihidWYsIGJ1ZmxlbiwgIiVzJXMgJXNcbiIsIG5vZGUtPm5hbWUs IGtleXR5cGUsIG5vZGUtPmtleSk7DQotICAgICAgICBlbHNlDQotICAgICAg ICAgICAgcmMgPSBfbGlic3NoMl9lcnJvcihob3N0cy0+c2Vzc2lvbiwgTElC U1NIMl9FUlJPUl9CVUZGRVJfVE9PX1NNQUxMLA0KLSAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgIktub3duLWhvc3Qgd3JpdGUgYnVmZmVyIHRv byBzbWFsbCIpOw0KKyAgICBlbHNlDQorICAgICAgICBvZmZzZXQgPSBzbnBy aW50ZihidWYsIGJ1ZmxlbiwgIiVzIiwgbm9kZS0+bmFtZSk7DQorDQorICAg IGlmIChvZmZzZXQgPj0gYnVmbGVuKSBnb3RvIGJ1ZmZlcl90b19zbWFsbDsN CisNCisgICAgaWYgKGtleV90eXBlX25hbWUpIHsNCisgICAgICAgIG9mZnNl dCArPSBzbnByaW50ZihidWYgKyBvZmZzZXQsIGJ1ZmxlbiAtIG9mZnNldCwN CisgICAgICAgICAgICAgICAgICAgICAgICAgICAiICVzIiwga2V5X3R5cGVf bmFtZSk7DQorICAgICAgICBpZiAob2Zmc2V0ID49IGJ1ZmxlbikgZ290byBi dWZmZXJfdG9fc21hbGw7DQogICAgIH0NCiANCi0gICAgLyogd2UgcmVwb3J0 IHRoZSBmdWxsIGxlbmd0aCBvZiB0aGUgZGF0YSB3aXRoIHRoZSB0cmFpbGlu ZyB6ZXJvIGV4Y2x1ZGVkICovDQotICAgICpvdXRsZW4gPSBubGVuLTE7DQor ICAgIG9mZnNldCArPSBzbnByaW50ZihidWYgKyBvZmZzZXQsIGJ1ZmxlbiAt IG9mZnNldCwNCisgICAgICAgICAgICAgICAgICAgICAgICIgJXMiLCBub2Rl LT5rZXkpOw0KKyAgICBpZiAob2Zmc2V0ID49IGJ1ZmxlbikgZ290byBidWZm ZXJfdG9fc21hbGw7DQogDQotICAgIHJldHVybiByYzsNCisgICAgaWYgKG5v ZGUtPmNvbW1lbnQpDQorICAgICAgICBvZmZzZXQgKz0gc25wcmludGYoYnVm ICsgb2Zmc2V0LCBidWZsZW4gLSBvZmZzZXQsDQorICAgICAgICAgICAgICAg ICAgICAgICAgICAgIiAlc1xuIiwgbm9kZS0+Y29tbWVudCk7DQorICAgIGVs c2UNCisgICAgICAgIG9mZnNldCArPSBzbnByaW50ZihidWYgKyBvZmZzZXQs IGJ1ZmxlbiAtIG9mZnNldCwgIlxuIik7DQorDQorICAgIGlmIChvZmZzZXQg Pj0gYnVmbGVuKSBnb3RvIGJ1ZmZlcl90b19zbWFsbDsNCisNCisgICAgKm91 dGxlbiA9IG9mZnNldDsNCisgICAgcmV0dXJuIExJQlNTSDJfRVJST1JfTk9O RTsNCisNCisgIGJ1ZmZlcl90b19zbWFsbDoNCisgICAgcmV0dXJuIF9saWJz c2gyX2Vycm9yKGhvc3RzLT5zZXNzaW9uLCBMSUJTU0gyX0VSUk9SX0JVRkZF Ul9UT09fU01BTEwsDQorICAgICAgICAgICAgICAgICAgICAgICAgICAiS25v d24taG9zdCB3cml0ZSBidWZmZXIgdG9vIHNtYWxsIik7DQogfQ0KIA0KIC8q DQotLSANCjEuOC40LnJjMw0KDQo= --1129329158-33565826-1381007299=:6366 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel --1129329158-33565826-1381007299=:6366-- From libssh2-devel-bounces@cool.haxx.se Sat Oct 5 23:36:19 2013 Return-Path: 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 r95LaD0m021177; Sat, 5 Oct 2013 23:36:19 +0200 Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r95LaANF021169 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Sat, 5 Oct 2013 23:36:12 +0200 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VSZWE-0000sw-Ts for libssh2-devel@cool.haxx.se; Sat, 05 Oct 2013 23:36:10 +0200 Received: from 92.56.140.52 ([92.56.140.52]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 05 Oct 2013 23:36:10 +0200 Received: from sfandino by 92.56.140.52 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 05 Oct 2013 23:36:10 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: libssh2-devel@cool.haxx.se From: =?ISO-8859-1?Q?Salvador_Fandi=F1o?= Subject: Re: [PATCH] add support for unknown key types in libssh2_knownhost_* Date: Sat, 05 Oct 2013 23:35:59 +0200 Lines: 29 Message-ID: References: Mime-Version: 1.0 X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 92.56.140.52 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.15 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On 10/05/2013 11:08 PM, Daniel Stenberg wrote: > On Wed, 2 Oct 2013, Salvador Fandino wrote: > > Okay, I removed some warnings and shortened a few lines and ammended the > patch then looks like this one. I attached two extra patches yesterday to the Trac ticket but I think they are still waiting for moderation. They solve the issues you had pointed in your previous mail (using strlen and using goto inappropriately). > I don't have any good test case setup to verify this patch so I'll > appreciate an extra set of eyes on this patch if possible! > > Salvador, I assume you successfully use this functionality? Yes, it is a bit convoluted, as I am using that feature from my Perl module Net::SSH::Any that builds on top of Net::SSH2 which also needs patching. But I am able to parse my known_hosts files which contain lots of keys in formats not supported by libssh2 and write them back. I have also checked that OpenSSH can then use the files modified by libssh2. In any case, it is easy to test with any application based on libssh2 that uses the knownhost functionality. Just fake a new key type and see how libssh2 is able to read the known_hosts file and write it back complete. _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Sun Oct 6 02:07:38 2013 Return-Path: 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 r9607K81004798; Sun, 6 Oct 2013 02:07:36 +0200 Received: from earth.stuge.se (earth.stuge.se [212.116.89.126]) by giant.haxx.se (8.14.4/8.14.4/Debian-2) with ESMTP id r9607Ftq004762 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sun, 6 Oct 2013 02:07:16 +0200 Received: (qmail 28709 invoked from network); 6 Oct 2013 00:06:27 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 6 Oct 2013 00:06:27 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: amnw14545@gmail.com X-Trac-Project: libssh2 Date: Sun, 06 Oct 2013 00:06:27 -0000 X-URL: https://trac.libssh2.org/ Subject: [libssh2] #277: libgcrypt and gcry_check_version in a multithreaded application. X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/277 Message-ID: <041.57577457ef996dbe253515c97fbf69c5@libssh2.stuge.se> X-Trac-Ticket-ID: 277 X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r9607Ftq004762 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 List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #277: libgcrypt and gcry_check_version in a multithreaded application. -------------------------------------------------+------------------------- Reporter: TMcC | Owner: Type: defect | Status: new Priority: normal | Milestone: 1.4.3 Component: crypto | Version: 1.4.2 Keywords: threads, mt, multithreaded, crypto, | Blocked By: sigabrt, gcry_check_version, gcrpyt, | libgcrypt | Blocks: | -------------------------------------------------+------------------------- In a multithreaded application, libssh2_init() ought to call gcry_check_version(), or the documentation for libssh2 ought to advise that libgcrpyt's gcry_check_version() must be called, before libssh2_init() is executed. Please see here: http://www.gnupg.org/documentation/manuals/gcrypt-devel /Initializing-the-library.html Without this call, we get SIGABRTs from gcrpyt. In summary, in a multithread application, the sequence of calls should be: {{{#!c // Enable thread safety for gcrypt. int result = gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); if (!gcry_check_version (GCRYPT_VERSION)) { std::cerr << "libgcrypt version mismatch" << std::endl; exit (2); } libssh2_init(); }}} -- Ticket URL: libssh2 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 Sun Oct 6 02:08:11 2013 Return-Path: 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 r96086vC005214; Sun, 6 Oct 2013 02:08:10 +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 r96084FA005205 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sun, 6 Oct 2013 02:08:04 +0200 Received: (qmail 28907 invoked from network); 6 Oct 2013 00:07:16 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 6 Oct 2013 00:07:16 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: sfandino@yahoo.com, awl03@doc.ic.ac.uk X-Trac-Project: libssh2 Date: Sun, 06 Oct 2013 00:07:16 -0000 X-URL: https://trac.libssh2.org/ Subject: Re: [libssh2] #276: do not fail when keys of unknown type are read from known_hosts file X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/276#comment:2 Message-ID: <057.f54326b3800ba4b4c4a53d2e385e30e0@libssh2.stuge.se> References: <042.310bff264790ea0eb774c869a2913cb7@libssh2.stuge.se> X-Trac-Ticket-ID: 276 In-Reply-To: <042.310bff264790ea0eb774c869a2913cb7@libssh2.stuge.se> X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r96084FA005205 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 List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #276: do not fail when keys of unknown type are read from known_hosts file ---------------------+------------------- Reporter: salva | Owner: Type: defect | Status: new Priority: normal | Milestone: 1.4.3 Component: misc | Version: 1.4.2 Resolution: | Keywords: Blocked By: | Blocks: ---------------------+------------------- Comment (by salva): I have submitted two new patches, one for every one of your observations. The first one keeps the length of the key-type and uses it. Actually I have found that the host and comment slots are affected by the same issue, so I have also modified the code related to those, keeping their lengths in the known_host struct, and using memcpy to move then into the buffer instead of snprintf(..., "%s", ...) which stops at nulls. Regarding the usage of "goto", well, I don't see it as inappropriate in that case, but it is your code and so your choice. The second patch replaces the jumps by calls to _libssh2_error. -- Ticket URL: libssh2 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 Sun Oct 6 05:46:56 2013 Return-Path: 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 r963kVkH024829; Sun, 6 Oct 2013 05:46:51 +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 r963kTsg024823 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sun, 6 Oct 2013 05:46:30 +0200 Received: (qmail 13058 invoked from network); 6 Oct 2013 03:45:40 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 6 Oct 2013 03:45:40 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: cody@cutrer.us, maxmtl2002@yahoo.ca X-Trac-Project: libssh2 Date: Sun, 06 Oct 2013 03:45:40 -0000 X-URL: https://trac.libssh2.org/ Subject: Re: [libssh2] #275: ssh agent cannot be used non-blocking X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/275#comment:1 Message-ID: <059.b82340ede8bd40fa1d235a578bc720fd@libssh2.stuge.se> References: <044.1dd0bdc92ab38eb2b09bb75accb68c49@libssh2.stuge.se> X-Trac-Ticket-ID: 275 In-Reply-To: <044.1dd0bdc92ab38eb2b09bb75accb68c49@libssh2.stuge.se> X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r963kTsg024823 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 List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #275: ssh agent cannot be used non-blocking --------------------------+------------------- Reporter: ccutrer | Owner: Type: enhancement | Status: new Priority: normal | Milestone: 1.4.3 Component: API | Version: 1.4.2 Resolution: | Keywords: Blocked By: | Blocks: --------------------------+------------------- Comment (by maxmtl): I am not sure if it applies to your case, but I found out that the socket used by libssh2 must be set non-blocking, even if the libssh2 API is used blocking. I did not find this in the API reference or in the examples. (submitting a patch for this is on my list of things to do....). Is your socket set to non-blocking? -- Ticket URL: libssh2 C library for writing portable SSH2 clients _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Tue Oct 8 14:34:31 2013 Return-Path: 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 r98CY8Fm023841; Tue, 8 Oct 2013 14:34:26 +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 r98CY7aX023826 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 8 Oct 2013 14:34:07 +0200 Received: (qmail 31911 invoked from network); 8 Oct 2013 12:33:15 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 8 Oct 2013 12:33:15 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: cody@cutrer.us, maxmtl2002@yahoo.ca X-Trac-Project: libssh2 Date: Tue, 08 Oct 2013 12:33:15 -0000 X-URL: https://trac.libssh2.org/ Subject: Re: [libssh2] #275: ssh agent cannot be used non-blocking X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/275#comment:2 Message-ID: <059.fab2f8985bb61564d95bfdc11c40c8b5@libssh2.stuge.se> References: <044.1dd0bdc92ab38eb2b09bb75accb68c49@libssh2.stuge.se> X-Trac-Ticket-ID: 275 In-Reply-To: <044.1dd0bdc92ab38eb2b09bb75accb68c49@libssh2.stuge.se> X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r98CY7aX023826 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 List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #275: ssh agent cannot be used non-blocking --------------------------+------------------- Reporter: ccutrer | Owner: Type: enhancement | Status: new Priority: normal | Milestone: 1.4.3 Component: API | Version: 1.4.2 Resolution: | Keywords: Blocked By: | Blocks: --------------------------+------------------- Comment (by ccutrer): Yes, my socket for the session object is set to non-blocking. But for the agent, the agent allocates the AF_UNIX socket itself, and does not expose it, nor set it to non-blocking internally. -- Ticket URL: libssh2 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 Sat Oct 12 16:29:08 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9CESf51008804; Sat, 12 Oct 2013 16:29:02 +0200 Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9CESdwM007968 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Sat, 12 Oct 2013 16:28:39 +0200 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VV0BK-0002tB-93 for libssh2-devel@cool.haxx.se; Sat, 12 Oct 2013 16:28:38 +0200 Received: from 92.56.140.52 ([92.56.140.52]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 12 Oct 2013 16:28:38 +0200 Received: from sfandino by 92.56.140.52 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 12 Oct 2013 16:28:38 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: libssh2-devel@cool.haxx.se From: =?ISO-8859-1?Q?Salvador_Fandi=F1o?= Subject: [PATCH] Fix flow control Date: Sat, 12 Oct 2013 16:28:24 +0200 Lines: 162 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070809080304070404020506" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 92.56.140.52 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" This is a multi-part message in MIME format. --------------070809080304070404020506 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit See the commit message on the patch. With out this patch, libssh2 memory usage was growing uncontrolled when receiving large amounts of data. With this patch applied I have been able to perform transfers of hundreds of GBs correctly. --------------070809080304070404020506 Content-Type: text/x-patch; name="0001-Fix-flow-control.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-flow-control.patch" From f4eb1dbd837ba169a7198c74b3b4fcf459b53643 Mon Sep 17 00:00:00 2001 From: Salvador Fandino Date: Sat, 12 Oct 2013 02:51:46 +0200 Subject: [PATCH] Fix flow control Until now, the window size (channel->remote.window_size) was being updated just after receiving the packet from the transport layer. That behaviour is wrong because the channel queue may grow uncontrolled when data arrives from the network faster that the upper layer consumes it. This patch adds a new counter, read_avail, which keeps a count of the bytes available from the packet queue for reading. Also, now the window size is adjusted when the data is actually read by an upper layer. That way, if the upper layer stops reading data, the window will eventually fill and the remote host will stop sending data. When the upper layers reads enough data, a window adjust packet is delivered and the transfer resumes. The read_avail counter is used to detect the situation when the remote server tries to send data surpassing the window size. In that case, the extra data is discarded. Signed-off-by: Salvador Fandino --- src/channel.c | 8 +++++++- src/libssh2_priv.h | 2 ++ src/packet.c | 33 +++++++++++++++++++++++++-------- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/channel.c b/src/channel.c index 128a04e..68b1857 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1414,6 +1414,9 @@ _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid) channel->flush_state = libssh2_NB_state_created; } + channel->read_avail -= channel->flush_flush_bytes; + channel->remote.window_size -= channel->flush_flush_bytes; + if (channel->flush_refund_bytes) { int rc; @@ -1871,11 +1874,14 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, /* if the transport layer said EAGAIN then we say so as well */ return _libssh2_error(session, rc, "would block"); } - else + else { + channel->read_avail -= bytes_read; + channel->remote.window_size -= bytes_read; /* make sure we remain in the created state to focus on emptying the data we already have in the packet brigade before we try to read 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! */ diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index 05b1ffc..461d14c 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -356,6 +356,8 @@ struct _LIBSSH2_CHANNEL libssh2_channel_data local, remote; /* Amount of bytes to be refunded to receive window (but not yet sent) */ uint32_t adjust_queue; + /* Data immediately available for reading */ + uint32_t read_avail; LIBSSH2_SESSION *session; diff --git a/src/packet.c b/src/packet.c index a4887c8..7887e61 100644 --- a/src/packet.c +++ b/src/packet.c @@ -654,8 +654,18 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, _libssh2_debug(session, LIBSSH2_TRACE_CONN, "Ignoring extended data and refunding %d bytes", (int) (datalen - 13)); - session->packAdd_channelp = channelp; + if (channelp->read_avail + datalen - data_head >= channelp->remote.window_size) + datalen = channelp->remote.window_size - channelp->read_avail + data_head; + channelp->remote.window_size -= datalen - data_head; + _libssh2_debug(session, LIBSSH2_TRACE_CONN, + "shrinking window size by %lu bytes to %lu, read_avail %lu", + datalen - data_head, + channelp->remote.window_size, + channelp->read_avail); + + session->packAdd_channelp = channelp; + /* Adjust the window based on the block we just freed */ libssh2_packet_add_jump_point1: session->packAdd_state = libssh2_NB_state_jump1; @@ -685,7 +695,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, " to receive, truncating"); datalen = channelp->remote.packet_size + data_head; } - if (channelp->remote.window_size <= 0) { + if (channelp->remote.window_size <= channelp->read_avail) { /* * Spec says we MAY ignore bytes sent beyond * window_size @@ -701,17 +711,24 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, /* Reset EOF status */ channelp->remote.eof = 0; - if ((datalen - data_head) > channelp->remote.window_size) { + if (channelp->read_avail + datalen - data_head > channelp->remote.window_size) { _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED, "Remote sent more data than current " "window allows, truncating"); - datalen = channelp->remote.window_size + data_head; - channelp->remote.window_size = 0; + datalen = channelp->remote.window_size - channelp->read_avail + data_head; } - else - /* Now that we've received it, shrink our window */ - channelp->remote.window_size -= datalen - data_head; + + /* Update the read_avail counter. The window size will be + * updated once the data is actually read from the queue + * from an upper layer */ + channelp->read_avail += datalen - data_head; + + _libssh2_debug(session, LIBSSH2_TRACE_CONN, + "increasing read_avail by %lu bytes to %lu/%lu", + (long)(datalen - data_head), + (long)channelp->read_avail, + (long)channelp->remote.window_size); break; -- 1.8.3.2 --------------070809080304070404020506 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 --------------070809080304070404020506-- From libssh2-devel-bounces@cool.haxx.se Sun Oct 13 13:16:46 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9DBGSPJ006004; Sun, 13 Oct 2013 13:16:42 +0200 Received: from mx.uxnr.de (mx.uxnr.de [IPv6:2a00:1828:2000:378:2525:0:59ee:542f]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9DBGRnc005997 for ; Sun, 13 Oct 2013 13:16:27 +0200 Received: from [10.2.2.10] (p5B0A42FE.dip0.t-ipconnect.de [91.10.66.254]) by mx.uxnr.de (Postfix) with ESMTPSA id EB2C11C5A277 for ; Sun, 13 Oct 2013 13:16:22 +0200 (CEST) X-DKIM: OpenDKIM Filter v2.6.8 mx.uxnr.de EB2C11C5A277 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=marc-hoersken.de; s=picard; t=1381662983; bh=1gCzWepdyw5Eq83azMFvrU3ZXdiKu4nuz6CH4Hgb/CQ=; h=Date:From:To:Subject:References:In-Reply-To:From; b=5xjqXMOo4ypLhsgBn02e/1cDCVlxY3xOlVO0yjcXbHVBaSGJeYvhH5Kn9QNSX5wtr jLlm0l/0+S2DH9cKctlnLsHfWrrKexpO5dQWV++/zRmnu//ju5BL3IFr7RZddWxRfR +SAtSOuKUJmxF/TptflXxdscZZjQ+AfZ0Qnr0cpA= Message-ID: <525A8106.40603@marc-hoersken.de> Date: Sun, 13 Oct 2013 13:16:22 +0200 From: =?ISO-8859-1?Q?Marc_H=F6rsken?= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 MIME-Version: 1.0 To: libssh2 development Subject: Re: [PATCH] Added Windows Cryptography API: Next Generation backend References: <20130601231229.11420.qmail@stuge.se> <20130602175922.5525.qmail@stuge.se> <523EA678.8010707@marc-hoersken.de> <20130922151824.23037.qmail@stuge.se> In-Reply-To: <20130922151824.23037.qmail@stuge.se> X-Enigmail-Version: 1.5.2 X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,T_DKIM_INVALID autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on picard.vpn.uxnr.de X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Hi Peter, Am 22.09.2013 17:18, schrieb Peter Stuge: > It does, but current master still needs to be fixed. I'll push the > suggested update I had for it in a bit. >> I wanted to send you a new patch in order to get an idea. any update on your changes yet? > Will do. I'll also send you some more comments on this patch, there > are a few small things to take care of still. Okay, thanks. > Please don't compress patches when attaching them though, that makes it a lot harder to work with them in email software. It's OK that it's a big long. :) Will do, thanks for the hint. > It also seems that we need to do a bit of preparatory work in pem.c. Yes, it could probably use some re-structuring since I only need parts of it for WinCNG. Best regards, Marc _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Tue Oct 15 12:16:47 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9FAGIpW003069; Tue, 15 Oct 2013 12:16:39 +0200 Received: from thor.qindel.com (smtp.qindel.com [89.140.90.34]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9FAGFse003042 for ; Tue, 15 Oct 2013 12:16:16 +0200 Received: from localhost (localhost [127.0.0.1]) by thor.qindel.com (Postfix) with ESMTP id 37F2B61B9 for ; Tue, 15 Oct 2013 12:16:00 +0200 (CEST) Received: from thor.qindel.com ([127.0.0.1]) by localhost (thor.qindel.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 706jwL_3N0rr for ; Tue, 15 Oct 2013 12:15:59 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by thor.qindel.com (Postfix) with ESMTP id 223B4617C for ; Tue, 15 Oct 2013 12:15:59 +0200 (CEST) X-Virus-Scanned: amavisd-new at thor.qindel.com Received: from thor.qindel.com ([127.0.0.1]) by localhost (thor.qindel.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Ful3KNTb1k9t for ; Tue, 15 Oct 2013 12:15:58 +0200 (CEST) Received: from [172.26.8.242] (sfandino.qindel.com [172.26.8.242]) by thor.qindel.com (Postfix) with ESMTPSA id E7E5F613C for ; Tue, 15 Oct 2013 12:15:58 +0200 (CEST) Message-ID: <525D15E8.5080403@yahoo.com> Date: Tue, 15 Oct 2013 12:16:08 +0200 From: Salvador Fandino User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: libssh2-devel@cool.haxx.se Subject: [PATCH] fix bugs causing data drops Content-Type: multipart/mixed; boundary="------------090203070505050408090806" X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" This is a multi-part message in MIME format. --------------090203070505050408090806 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit See the commit messages on the attached patches for the details. In summary: 1) _libssh2_channel_read() could drop data under some rare circusnstances. 2) zlib inflate() usage was wrong resulting in corruption on the channel stream. This bug only manifested when transferring highly compressible data. My previous patch "Fix flow control" (also attached) has to be applied before the other two. --------------090203070505050408090806 Content-Type: text/x-patch; name="0001-Fix-flow-control.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Fix-flow-control.patch" From f1e4bf04a05fca8f0b5f7bcbf293b9908cd74404 Mon Sep 17 00:00:00 2001 From: Salvador Fandino Date: Sat, 12 Oct 2013 02:51:46 +0200 Subject: [PATCH 1/3] Fix flow control Until now, the window size (channel->remote.window_size) was being updated just after receiving the packet from the transport layer. That behaviour is wrong because the channel queue may grow uncontrolled when data arrives from the network faster that the upper layer consumes it. This patch adds a new counter, read_avail, which keeps a count of the bytes available from the packet queue for reading. Also, now the window size is adjusted when the data is actually read by an upper layer. That way, if the upper layer stops reading data, the window will eventually fill and the remote host will stop sending data. When the upper layers reads enough data, a window adjust packet is delivered and the transfer resumes. The read_avail counter is used to detect the situation when the remote server tries to send data surpassing the window size. In that case, the extra data is discarded. Signed-off-by: Salvador --- src/channel.c | 8 +++++++- src/libssh2_priv.h | 2 ++ src/packet.c | 33 +++++++++++++++++++++++++-------- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/channel.c b/src/channel.c index 128a04e..68b1857 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1414,6 +1414,9 @@ _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid) channel->flush_state = libssh2_NB_state_created; } + channel->read_avail -= channel->flush_flush_bytes; + channel->remote.window_size -= channel->flush_flush_bytes; + if (channel->flush_refund_bytes) { int rc; @@ -1871,11 +1874,14 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, /* if the transport layer said EAGAIN then we say so as well */ return _libssh2_error(session, rc, "would block"); } - else + else { + channel->read_avail -= bytes_read; + channel->remote.window_size -= bytes_read; /* make sure we remain in the created state to focus on emptying the data we already have in the packet brigade before we try to read 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! */ diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index 05b1ffc..461d14c 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -356,6 +356,8 @@ struct _LIBSSH2_CHANNEL libssh2_channel_data local, remote; /* Amount of bytes to be refunded to receive window (but not yet sent) */ uint32_t adjust_queue; + /* Data immediately available for reading */ + uint32_t read_avail; LIBSSH2_SESSION *session; diff --git a/src/packet.c b/src/packet.c index a4887c8..7887e61 100644 --- a/src/packet.c +++ b/src/packet.c @@ -654,8 +654,18 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, _libssh2_debug(session, LIBSSH2_TRACE_CONN, "Ignoring extended data and refunding %d bytes", (int) (datalen - 13)); - session->packAdd_channelp = channelp; + if (channelp->read_avail + datalen - data_head >= channelp->remote.window_size) + datalen = channelp->remote.window_size - channelp->read_avail + data_head; + channelp->remote.window_size -= datalen - data_head; + _libssh2_debug(session, LIBSSH2_TRACE_CONN, + "shrinking window size by %lu bytes to %lu, read_avail %lu", + datalen - data_head, + channelp->remote.window_size, + channelp->read_avail); + + session->packAdd_channelp = channelp; + /* Adjust the window based on the block we just freed */ libssh2_packet_add_jump_point1: session->packAdd_state = libssh2_NB_state_jump1; @@ -685,7 +695,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, " to receive, truncating"); datalen = channelp->remote.packet_size + data_head; } - if (channelp->remote.window_size <= 0) { + if (channelp->remote.window_size <= channelp->read_avail) { /* * Spec says we MAY ignore bytes sent beyond * window_size @@ -701,17 +711,24 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data, /* Reset EOF status */ channelp->remote.eof = 0; - if ((datalen - data_head) > channelp->remote.window_size) { + if (channelp->read_avail + datalen - data_head > channelp->remote.window_size) { _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_WINDOW_EXCEEDED, "Remote sent more data than current " "window allows, truncating"); - datalen = channelp->remote.window_size + data_head; - channelp->remote.window_size = 0; + datalen = channelp->remote.window_size - channelp->read_avail + data_head; } - else - /* Now that we've received it, shrink our window */ - channelp->remote.window_size -= datalen - data_head; + + /* Update the read_avail counter. The window size will be + * updated once the data is actually read from the queue + * from an upper layer */ + channelp->read_avail += datalen - data_head; + + _libssh2_debug(session, LIBSSH2_TRACE_CONN, + "increasing read_avail by %lu bytes to %lu/%lu", + (long)(datalen - data_head), + (long)channelp->read_avail, + (long)channelp->remote.window_size); break; -- 1.8.3.2 --------------090203070505050408090806 Content-Type: text/x-patch; name="0002-_libssh2_channel_read-was-dropping-data.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-_libssh2_channel_read-was-dropping-data.patch" From 259723476e8e7e31af7ac007ca7a8bf250e76419 Mon Sep 17 00:00:00 2001 From: Salvador Date: Tue, 15 Oct 2013 11:45:10 +0200 Subject: [PATCH 2/3] _libssh2_channel_read was dropping data After filling the read buffer with data from the read queue, when the window size was too small, "libssh2_channel_receive_window_adjust" was called to increase it. In non-blocking mode that function could return EAGAIN and, in that case, the EAGAIN was propagated upwards and the data already read on the buffer lost. The function was also moving between the two read states "libssh2_NB_state_idle" and "libssh2_NB_state_created" both of which behave in the same way (excepting a debug statment). This patch modifies "_libssh2_channel_read" so that the "libssh2_channel_receive_window_adjust" call is performed first (when required) and if everything goes well, then it reads the data from the queued packets into the read buffer. It also removes the useless "libssh2_NB_state_created" read state. Some rotted comments have also been updated. Signed-off-by: Salvador --- src/channel.c | 76 ++++++++++++++++++++--------------------------------------- 1 file changed, 25 insertions(+), 51 deletions(-) diff --git a/src/channel.c b/src/channel.c index 68b1857..9df2f8d 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1754,31 +1754,33 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, LIBSSH2_PACKET *read_packet; LIBSSH2_PACKET *read_next; - if (channel->read_state == libssh2_NB_state_idle) { - _libssh2_debug(session, LIBSSH2_TRACE_CONN, - "channel_read() wants %d bytes from channel %lu/%lu " - "stream #%d", - (int) buflen, channel->local.id, channel->remote.id, - stream_id); - channel->read_state = libssh2_NB_state_created; - } + _libssh2_debug(session, LIBSSH2_TRACE_CONN, + "channel_read() wants %d bytes from channel %lu/%lu " + "stream #%d", + (int) buflen, channel->local.id, channel->remote.id, + stream_id); - /* - * =============================== 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; - } + /* expand the receiving window first if it has become too narrow */ + if((channel->read_state == libssh2_NB_state_jump1) || + (channel->remote.window_size < (LIBSSH2_CHANNEL_WINDOW_DEFAULT*30))) { + + /* the actual window adjusting may not finish so we need to deal with + this special state here */ + channel->read_state = libssh2_NB_state_jump1; + rc = _libssh2_channel_receive_window_adjust(channel, + (LIBSSH2_CHANNEL_WINDOW_DEFAULT*60), + 0, NULL); + if (rc) + return rc; - rc = 1; /* set to >0 to let the while loop start */ + channel->read_state = libssh2_NB_state_idle; + } - /* Process all pending incoming packets in all states in order to "even - out" the network readings. Tests prove that this way produces faster - transfers. */ - while (rc > 0) + /* Process all pending incoming packets. Tests prove that this way + produces faster transfers. */ + do { rc = _libssh2_transport_read(session); + } while (rc > 0); if ((rc < 0) && (rc != LIBSSH2_ERROR_EAGAIN)) return _libssh2_error(session, rc, "transport read"); @@ -1860,8 +1862,6 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, } if (!bytes_read) { - channel->read_state = libssh2_NB_state_idle; - /* If the channel is already at EOF or even closed, we need to signal that back. We may have gotten that info while draining the incoming transport layer until EAGAIN so we must not be fooled by that @@ -1874,35 +1874,9 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, /* if the transport layer said EAGAIN then we say so as well */ return _libssh2_error(session, rc, "would block"); } - else { - channel->read_avail -= bytes_read; - channel->remote.window_size -= bytes_read; - /* make sure we remain in the created state to focus on emptying the - data we already have in the packet brigade before we try to read - 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; - } + channel->read_avail -= bytes_read; + channel->remote.window_size -= bytes_read; return bytes_read; } -- 1.8.3.2 --------------090203070505050408090806 Content-Type: text/x-patch; name="0003-Fix-zlib-usage.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0003-Fix-zlib-usage.patch" From 7e2146dc962948eb01fc335dfdc6213b9d0cfa0a Mon Sep 17 00:00:00 2001 From: Salvador Date: Tue, 15 Oct 2013 11:00:52 +0200 Subject: [PATCH 3/3] Fix zlib usage Data may remain in zlib internal buffers when inflate() returns Z_OK and avail_out == 0. In that case, inflate has to be called again. Also, once all the data has been inflated, it returns Z_BUF_ERROR to signal that the input buffer has been exhausted. Until now, the way to detect that a packet payload had been completely decompressed was to check that no data remained on the input buffer but that didn't account for the case where data remained on the internal zlib buffers. That resulted in packets not being completely decompressed and the missing data reappearing on the next packet, though the bug was masked by the buffer allocation algorithm most of the time and only manifested when transferring highly compressible data. This patch fixes the zlib usage. Signed-off-by: Salvador --- src/comp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/comp.c b/src/comp.c index 4593ce4..c9226ed 100644 --- a/src/comp.c +++ b/src/comp.c @@ -259,12 +259,12 @@ comp_method_zlib_decomp(LIBSSH2_SESSION * session, status = inflate(strm, Z_PARTIAL_FLUSH); if (status == Z_OK) { - if (! strm->avail_in) { - /* status is OK and input all used so we're done */ + if (strm->avail_out > 0) + /* status is OK and the output buffer has not been exhausted so we're done */ break; - } } else if (status == Z_BUF_ERROR) { - /* This is OK, just drop through to grow the buffer */ + /* the input data has been exhausted so we are done */ + break; } else { /* error state */ LIBSSH2_FREE(session, out); -- 1.8.3.2 --------------090203070505050408090806 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 --------------090203070505050408090806-- From libssh2-devel-bounces@cool.haxx.se Wed Oct 16 09:57:09 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9G7uhPg027759; Wed, 16 Oct 2013 09:57:02 +0200 Received: from thor.qindel.com (smtp.qindel.com [89.140.90.34]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9G7ugbE027746 for ; Wed, 16 Oct 2013 09:56:42 +0200 Received: from localhost (localhost [127.0.0.1]) by thor.qindel.com (Postfix) with ESMTP id 644E561EE for ; Wed, 16 Oct 2013 09:56:25 +0200 (CEST) Received: from thor.qindel.com ([127.0.0.1]) by localhost (thor.qindel.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id MnOJZJu4IRuQ for ; Wed, 16 Oct 2013 09:56:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by thor.qindel.com (Postfix) with ESMTP id 2529D620E for ; Wed, 16 Oct 2013 09:56:10 +0200 (CEST) X-Virus-Scanned: amavisd-new at thor.qindel.com Received: from thor.qindel.com ([127.0.0.1]) by localhost (thor.qindel.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id xB2RdKg399Ge for ; Wed, 16 Oct 2013 09:56:09 +0200 (CEST) Received: from [172.26.8.242] (sfandino.qindel.com [172.26.8.242]) by thor.qindel.com (Postfix) with ESMTPSA id D968961FD for ; Wed, 16 Oct 2013 09:56:09 +0200 (CEST) Message-ID: <525E46A4.2010200@yahoo.com> Date: Wed, 16 Oct 2013 09:56:20 +0200 From: Salvador Fandino User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: libssh2-devel@cool.haxx.se Subject: Re: [PATCH] fix bugs causing data drops References: <525D15E8.5080403@yahoo.com> In-Reply-To: <525D15E8.5080403@yahoo.com> Content-Type: multipart/mixed; boundary="------------000208080302050409040302" X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" This is a multi-part message in MIME format. --------------000208080302050409040302 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Two additional minor improviments on src/comp.c. See the commits messages from the attached patchs for the details. --------------000208080302050409040302 Content-Type: text/x-patch; name="0004-Improve-buffer-growing-algorithm-in-comp_method_zlib.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0004-Improve-buffer-growing-algorithm-in-comp_method_zlib.pa"; filename*1="tch" From 2e52715df004759e42aa757d1236e4ac7c7fdebd Mon Sep 17 00:00:00 2001 From: Salvador Date: Tue, 15 Oct 2013 13:07:00 +0200 Subject: [PATCH 4/5] Improve buffer growing algorithm in comp_method_zlib_decomp. The old algorithm was O(N^2), causing lots and lots of reallocations when highly compressed data was transferred. This patch implements a simpler one that just doubles the buffer size everytime it is exhausted. It results in O(N) complexity. Also a smaller inflate ratio is used to calculate the initial size (x4). Signed-off-by: Salvador --- src/comp.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/comp.c b/src/comp.c index c9226ed..7281418 100644 --- a/src/comp.c +++ b/src/comp.c @@ -226,8 +226,7 @@ comp_method_zlib_decomp(LIBSSH2_SESSION * session, /* A short-term alloc of a full data chunk is better than a series of reallocs */ char *out; - int out_maxlen = 8 * src_len; - int limiter = 0; + int out_maxlen = 4 * src_len; /* If strm is null, then we have not yet been initialized. */ if (strm == NULL) @@ -252,7 +251,7 @@ comp_method_zlib_decomp(LIBSSH2_SESSION * session, /* Loop until it's all inflated or hit error */ for (;;) { - int status, grow_size; + int status; size_t out_ofs; char *newout; @@ -274,22 +273,15 @@ comp_method_zlib_decomp(LIBSSH2_SESSION * session, "decompression failure"); } - /* If we get here we need to grow the output buffer and try again */ - out_ofs = out_maxlen - strm->avail_out; - if (strm->avail_in) { - grow_size = strm->avail_in * 8; - } else { - /* Not sure how much to grow by */ - grow_size = 32; - } - out_maxlen += grow_size; - - if ((out_maxlen > (int) payload_limit) && limiter++) { + if (out_maxlen >= (int) payload_limit) { LIBSSH2_FREE(session, out); return _libssh2_error(session, LIBSSH2_ERROR_ZLIB, "Excessive growth in decompression phase"); } + /* If we get here we need to grow the output buffer and try again */ + out_ofs = out_maxlen - strm->avail_out; + out_maxlen *= 2; newout = LIBSSH2_REALLOC(session, out, out_maxlen); if (!newout) { LIBSSH2_FREE(session, out); @@ -298,7 +290,7 @@ comp_method_zlib_decomp(LIBSSH2_SESSION * session, } out = newout; strm->next_out = (unsigned char *) out + out_ofs; - strm->avail_out += grow_size; + strm->avail_out = out_maxlen - out_ofs; } *dest = (unsigned char *) out; -- 1.8.3.2 --------------000208080302050409040302 Content-Type: text/x-patch; name="0005-Fix-zlib-deflate-usage.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0005-Fix-zlib-deflate-usage.patch" From 98f38a144350e90f06581fb7a149ca926df322e2 Mon Sep 17 00:00:00 2001 From: Salvador Date: Wed, 16 Oct 2013 09:44:18 +0200 Subject: [PATCH 5/5] Fix zlib deflate usage Deflate may return Z_OK even when not all data has been compressed if the output buffer becomes full. In practice this is very unlikely to happen because the output buffer size is always some KBs larger than the size of the data passed for compression from the upper layers and I think that zlib never expands the data so much, even on the worst cases. Anyway, this patch plays on the safe side checking that the output buffer is not exhausted. Signed-off-by: Salvador --- src/comp.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/comp.c b/src/comp.c index 7281418..79b8ee2 100644 --- a/src/comp.c +++ b/src/comp.c @@ -198,15 +198,14 @@ comp_method_zlib_comp(LIBSSH2_SESSION *session, status = deflate(strm, Z_PARTIAL_FLUSH); - if (status != Z_OK) { - _libssh2_debug(session, LIBSSH2_TRACE_TRANS, - "unhandled zlib compression error %d", status); - return _libssh2_error(session, LIBSSH2_ERROR_ZLIB, - "compression failure"); + if ((status == Z_OK) && (strm->avail_out > 0)) { + *dest_len = out_maxlen - strm->avail_out; + return 0; } - *dest_len = out_maxlen - strm->avail_out; - return 0; + _libssh2_debug(session, LIBSSH2_TRACE_TRANS, + "unhandled zlib compression error %d, avail_out", status, strm->avail_out); + return _libssh2_error(session, LIBSSH2_ERROR_ZLIB, "compression failure"); } /* -- 1.8.3.2 --------------000208080302050409040302 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 --------------000208080302050409040302-- From libssh2-devel-bounces@cool.haxx.se Wed Oct 16 15:00:14 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GCxi56010636; Wed, 16 Oct 2013 15:00:01 +0200 Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GCxgKn010631 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 16 Oct 2013 14:59:42 +0200 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VWQhP-00027G-0T for libssh2-devel@cool.haxx.se; Wed, 16 Oct 2013 14:59:39 +0200 Received: from 213.37.131.197.static.user.ono.com ([213.37.131.197]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Oct 2013 14:59:39 +0200 Received: from sfandino by 213.37.131.197.static.user.ono.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 16 Oct 2013 14:59:39 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: libssh2-devel@cool.haxx.se From: Salvador Fandino Subject: [PATCH] Honour window_size_initial from _libssh2_channel_read Date: Wed, 16 Oct 2013 14:59:26 +0200 Lines: 82 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050800030107020609040800" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 213.37.131.197.static.user.ono.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" This is a multi-part message in MIME format. --------------050800030107020609040800 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit See the commit message for the details. The other five patches I have previously sent to this list should be applied first. --------------050800030107020609040800 Content-Type: text/x-patch; name="0006-Honour-window_size_initial-from-_libssh2_channel_rea.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0006-Honour-window_size_initial-from-_libssh2_channel_rea.pa"; filename*1="tch" From 510468d4734a931408e8b40f03dcb975ce70ec9f Mon Sep 17 00:00:00 2001 From: Salvador Date: Wed, 16 Oct 2013 13:31:31 +0200 Subject: [PATCH 6/6] Honour window_size_initial from _libssh2_channel_read _libssh2_channel_read was using an arbitrary hard-coded limit to trigger the window adjusting code. The adjustment used was also hard-coded and arbitrary, 15MB actually, which would limit the usability of libssh2 on systems with little RAM. This patch, uses the window_size parameter passed to libssh2_channel_open_ex (stored as remote.window_size_initial) plus the buflen as the base for the trigger and the adjustment calculation. The memory usage when using the default window size is reduced from 22MB to 256KB per channel (actually, if compression is used, these numbers should be incremented by ~50% to account for the errors between the decompressed packet sizes and the predicted sizes). My tests indicate that this change does not impact the performance of transfers across localhost or a LAN, being it on par with that of OpenSSH. On the other hand, it will probably slow down transfers on networks with high bandwidth*delay when the default window size (LIBSSH2_CHANNEL_WINDOW_DEFAULT=256KB) is used. Signed-off-by: Salvador --- src/channel.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/channel.c b/src/channel.c index 9df2f8d..d6bfb98 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1761,14 +1761,17 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, stream_id); /* expand the receiving window first if it has become too narrow */ - if((channel->read_state == libssh2_NB_state_jump1) || - (channel->remote.window_size < (LIBSSH2_CHANNEL_WINDOW_DEFAULT*30))) { + if( (channel->read_state == libssh2_NB_state_jump1) || + (channel->remote.window_size < channel->remote.window_size_initial / 4 * 3 + buflen) ) { + + uint32_t adjustment = channel->remote.window_size_initial + buflen - channel->remote.window_size; + if (adjustment < LIBSSH2_CHANNEL_MINADJUST) + adjustment = LIBSSH2_CHANNEL_MINADJUST; /* the actual window adjusting may not finish so we need to deal with this special state here */ channel->read_state = libssh2_NB_state_jump1; - rc = _libssh2_channel_receive_window_adjust(channel, - (LIBSSH2_CHANNEL_WINDOW_DEFAULT*60), + rc = _libssh2_channel_receive_window_adjust(channel, adjustment, 0, NULL); if (rc) return rc; -- 1.8.3.2 --------------050800030107020609040800 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 --------------050800030107020609040800-- From libssh2-devel-bounces@cool.haxx.se Wed Oct 16 22:48:26 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GKm7F0006569; Wed, 16 Oct 2013 22:48:21 +0200 Received: from earth.stuge.se (earth.stuge.se [212.116.89.126]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GKm42x006557 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 16 Oct 2013 22:48:04 +0200 Received: (qmail 4206 invoked from network); 16 Oct 2013 20:47:14 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 16 Oct 2013 20:47:14 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: sfandino@yahoo.com, awl03@doc.ic.ac.uk, daniel@haxx.se X-Trac-Project: libssh2 Date: Wed, 16 Oct 2013 20:47:14 -0000 X-URL: https://trac.libssh2.org/ Subject: Re: [libssh2] #276: do not fail when keys of unknown type are read from known_hosts file X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/276#comment:3 Message-ID: <057.0a8b6e517235ce8baeb1c565f928e815@libssh2.stuge.se> References: <042.310bff264790ea0eb774c869a2913cb7@libssh2.stuge.se> X-Trac-Ticket-ID: 276 In-Reply-To: <042.310bff264790ea0eb774c869a2913cb7@libssh2.stuge.se> X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r9GKm42x006557 Cc: libssh2-devel@cool.haxx.se X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Reply-To: trac@libssh2.stuge.se, libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #276: do not fail when keys of unknown type are read from known_hosts file ---------------------+------------------- Reporter: salva | Owner: Type: defect | Status: new Priority: normal | Milestone: 1.4.3 Component: misc | Version: 1.4.2 Resolution: | Keywords: Blocked By: | Blocks: ---------------------+------------------- Comment (by bagder): Sorry, but can you please post a single squashed patch of the complete change for easier review? -- Ticket URL: libssh2 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 Oct 16 23:14:28 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GLEMS7007273; Wed, 16 Oct 2013 23:14:27 +0200 Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GLELvx007232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 16 Oct 2013 23:14:21 +0200 Received: from localhost (dast@localhost) by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r9GLELUW007228 for ; Wed, 16 Oct 2013 23:14:21 +0200 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Wed, 16 Oct 2013 23:14:21 +0200 (CEST) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: Re: [PATCH] Honour window_size_initial from _libssh2_channel_read In-Reply-To: Message-ID: References: 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.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On Wed, 16 Oct 2013, Salvador Fandino wrote: > See the commit message for the details. This is the first one in your series that I'm not totally convinced is correct. When we do SFTP over big pipes with really large RTT, I fear that having a "mere" 256KB in maximum window is a potential problem to users. Have you done any performance tests with and without this patch? -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Wed Oct 16 23:15:30 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GLFSsU008777; Wed, 16 Oct 2013 23:15:30 +0200 Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GLFROd008730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 16 Oct 2013 23:15:27 +0200 Received: from localhost (dast@localhost) by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r9GLFRmT008726 for ; Wed, 16 Oct 2013 23:15:27 +0200 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Wed, 16 Oct 2013 23:15:27 +0200 (CEST) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: Re: [PATCH] fix bugs causing data drops In-Reply-To: <525E46A4.2010200@yahoo.com> Message-ID: References: <525D15E8.5080403@yahoo.com> <525E46A4.2010200@yahoo.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.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On Wed, 16 Oct 2013, Salvador Fandino wrote: > Two additional minor improviments on src/comp.c. I've merged and pushed your five first patches in the series. Some of them with minor edits. Thanks a lot! -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Wed Oct 16 23:20:18 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GLKF2o013449; Wed, 16 Oct 2013 23:20:18 +0200 Received: from earth.stuge.se (earth.stuge.se [212.116.89.126]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GLKDxk013385 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 16 Oct 2013 23:20:13 +0200 Received: (qmail 14414 invoked from network); 16 Oct 2013 21:19:23 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 16 Oct 2013 21:19:23 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Cc: libssh2-devel@cool.haxx.se Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software X-Trac-Project: libssh2 Date: Wed, 16 Oct 2013 21:19:23 -0000 X-URL: https://trac.libssh2.org/ Subject: Re: [libssh2] #262: libssh2_userauth_publickey_fromfile_ex declaration in man missis one parameter X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/262#comment:1 Message-ID: <058.e1f0643078b29741bd30b8e3204faadb@libssh2.stuge.se> References: <043.3f4d80c32629f22bc6b0711c717e8148@libssh2.stuge.se> X-Trac-Ticket-ID: 262 In-Reply-To: <043.3f4d80c32629f22bc6b0711c717e8148@libssh2.stuge.se> X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r9GLKDxk013385 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Reply-To: trac@libssh2.stuge.se, libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #262: libssh2_userauth_publickey_fromfile_ex declaration in man missis one parameter ---------------------+-------------------- Reporter: pastey | Owner: bagder Type: defect | Status: closed Priority: low | Milestone: 1.4.3 Component: SFTP | Version: 1.4.2 Resolution: fixed | Keywords: man Blocked By: | Blocks: ---------------------+-------------------- Changes (by bagder): * owner: => bagder * status: new => closed * resolution: => fixed Comment: In [changeset:"fa15fded72c3d51508448e6f841b3a68ac477bab/libssh2"]: {{{ #!CommitTicketReference repository="libssh2" revision="fa15fded72c3d51508448e6f841b3a68ac477bab" man page: add missing function argument for libssh2_userauth_publickey_fromfile_ex() Reported-by: "pastey" Fixes #262 }}} -- Ticket URL: libssh2 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 Oct 16 23:24:42 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GLOdp7017310; Wed, 16 Oct 2013 23:24:41 +0200 Received: from earth.stuge.se (earth.stuge.se [212.116.89.126]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GLOcX9017293 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 16 Oct 2013 23:24:38 +0200 Received: (qmail 17373 invoked from network); 16 Oct 2013 21:23:48 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 16 Oct 2013 21:23:48 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Cc: libssh2-devel@cool.haxx.se Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software X-Trac-Project: libssh2 Date: Wed, 16 Oct 2013 21:23:48 -0000 X-URL: https://trac.libssh2.org/ Subject: Re: [libssh2] #272: Build errors on Windows X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/272#comment:1 Message-ID: <059.6af14927ad0dc21c02cbd019d2445621@libssh2.stuge.se> References: <044.362c1383726160a8162702e0f39d323a@libssh2.stuge.se> X-Trac-Ticket-ID: 272 In-Reply-To: <044.362c1383726160a8162702e0f39d323a@libssh2.stuge.se> X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r9GLOcX9017293 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Reply-To: trac@libssh2.stuge.se, libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #272: Build errors on Windows ----------------------+------------------------- Reporter: kdekker | Owner: bagder Type: defect | Status: closed Priority: normal | Milestone: 1.4.3 Component: misc | Version: 1.4.2 Resolution: fixed | Keywords: build error Blocked By: | Blocks: ----------------------+------------------------- Changes (by bagder): * owner: => bagder * status: new => closed * resolution: => fixed Comment: In [changeset:"c49cc8411fcbcf201f3200ad989b3dfdd0a63e41/libssh2"]: {{{ #!CommitTicketReference repository="libssh2" revision="c49cc8411fcbcf201f3200ad989b3dfdd0a63e41" windows build: fix build errors Fixes various link errors with VS2010 Reported-by: "kdekker" Fixes #272 }}} -- Ticket URL: libssh2 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 Oct 16 23:27:19 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GLRHxc020714; Wed, 16 Oct 2013 23:27:19 +0200 Received: from earth.stuge.se (earth.stuge.se [212.116.89.126]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GLRF2M020615 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 16 Oct 2013 23:27:15 +0200 Received: (qmail 18680 invoked from network); 16 Oct 2013 21:26:25 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 16 Oct 2013 21:26:25 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: kees.dekker@infor.com, daniel@haxx.se X-Trac-Project: libssh2 Date: Wed, 16 Oct 2013 21:26:25 -0000 X-URL: https://trac.libssh2.org/ Subject: Re: [libssh2] #222: Windows build settings enhancement request (diff included) X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/222#comment:7 Message-ID: <059.496170ee5a2abd58a30a36c7f0a1c7c5@libssh2.stuge.se> References: <044.6d29715d27c09a1644ade1a12f190ed2@libssh2.stuge.se> X-Trac-Ticket-ID: 222 In-Reply-To: <044.6d29715d27c09a1644ade1a12f190ed2@libssh2.stuge.se> X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r9GLRF2M020615 Cc: libssh2-devel@cool.haxx.se X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Reply-To: trac@libssh2.stuge.se, libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #222: Windows build settings enhancement request (diff included) -----------------------+----------------------- Reporter: kdekker | Owner: bagder Type: defect | Status: closed Priority: normal | Milestone: 1.4.3 Component: misc | Version: 1.2.8 Resolution: outdated | Keywords: win build Blocked By: | Blocks: -----------------------+----------------------- Changes (by bagder): * status: assigned => closed * resolution: => outdated * milestone: => 1.4.3 Comment: I've just pushed another set of changes to these files. I consider this ticket out of date. -- Ticket URL: libssh2 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 Oct 17 01:48:49 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GNmQHI007023; Thu, 17 Oct 2013 01:48:43 +0200 Received: from nm16-vm1.bullet.mail.ird.yahoo.com (nm16-vm1.bullet.mail.ird.yahoo.com [77.238.189.88]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9GNUtCS021853 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 17 Oct 2013 01:30:55 +0200 Received: from [77.238.189.238] by nm16.bullet.mail.ird.yahoo.com with NNFMP; 16 Oct 2013 23:30:51 -0000 Received: from [46.228.39.99] by tm19.bullet.mail.ird.yahoo.com with NNFMP; 16 Oct 2013 23:30:51 -0000 Received: from [127.0.0.1] by smtp136.mail.ir2.yahoo.com with NNFMP; 16 Oct 2013 23:30:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1381966251; bh=3oZqtyNM+nlITpVyvwe2poBt6YI9Jk4f6EOmKz/IGcM=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=rCd7ErM7j/4zqaFJzjexCTxfN2HQ4tklgILhk6OJXaNhW/V5FyIsLwFi972OUIXFctMIn0cs/ox1ruKMe6JXrc7ZUyotnLYE6IHF3m+Mr/bsXftJUpYDrMW0LnqgyduXd+Np0kPYsOrsWboGxxGKhB8nKv66V7ZunGR6UB9RPOA= X-Yahoo-Newman-Id: 430469.26349.bm@smtp136.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 5baLULwVM1m.G7uCBujRtrZ4ok6LWmt70BKxrEvpm7.aim1 0BclmTlGsOz1dBIle4.5FRRnLII8kHR.p0_01BUPgFrC3YxhfTzf.04.PsNH TuKuOG1V9WcPnkFTU8XG.lHg2Jrrxg72_yK.sHgA4Qpw9CAbyBnZsOCAFxX4 q_lJp.Ib_ZUMlyMu4VOR7xJyq9EXWs8i28Wlk27xmG_A8tl0O1b5RZa.ftvd 7H.mYXlBN9XQSXPOrgYCAAYh_TUQd5ZLc6YI6HUvoDaD.wGjIIn8M85A17ex 6jH.vcwmYlatpi5jW935y1ahXTXabUnI2XGD9cF8HJ.oZRLXSe4HeCsgNOw. 4gXORg0KeWnG77Tu045.N8qNkacOoZdZA0JP6ob38TDMIIkOB39jrjyPbFvN xtN88RXYCw5oRgnoollMnBFVAkCIUogpG6fAFR8Snc6jKi4FcY20C8RN82AU dKxfVyhGQ6uQbCw3TCSeNeBpsN6nIdHuhx5iae9RNl6jBUS47ZWW1KUWlyqv De1_d8Irr2U5MB9Hpjavtj_Qn X-Yahoo-SMTP: YHDhoKeswBBUWTyRp8e39VlvJYCW X-Rocket-Received: from [192.168.20.104] (sfandino@92.56.140.52 with ) by smtp136.mail.ir2.yahoo.com with SMTP; 16 Oct 2013 23:30:51 +0000 UTC Message-ID: <525F21A7.5010209@yahoo.com> Date: Thu, 17 Oct 2013 01:30:47 +0200 From: =?ISO-8859-1?Q?Salvador_Fandi=F1o?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: libssh2-devel@cool.haxx.se Subject: Re: [PATCH] Honour window_size_initial from _libssh2_channel_read References: In-Reply-To: X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On 10/16/2013 11:14 PM, Daniel Stenberg wrote: > On Wed, 16 Oct 2013, Salvador Fandino wrote: > >> See the commit message for the details. > > This is the first one in your series that I'm not totally convinced is > correct. When we do SFTP over big pipes with really large RTT, I fear > that having a "mere" 256KB in maximum window is a potential problem to > users. 256000 is also too low for my taste. But in any case, the correct way to solve that is not to hard-code some arbitrary size but to use a better value for LIBSSH2_CHANNEL_WINDOW_DEFAULT . OpenSSH uses 2MB for its window size, that would probably be a good field-tested default. > Have you done any performance tests with and without this patch? As stated on the patch, just over a LAN with out any noticeable speed degradation. I would try to write some script to simulate different network conditions and measure the transfer speed for a few window sizes. _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Thu Oct 17 17:00:37 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9HF0Dqm019048; Thu, 17 Oct 2013 17:00:30 +0200 Received: from thor.qindel.com (smtp.qindel.com [89.140.90.34]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9HF0CLN018408 for ; Thu, 17 Oct 2013 17:00:12 +0200 Received: from localhost (localhost [127.0.0.1]) by thor.qindel.com (Postfix) with ESMTP id 6EEBB51D2 for ; Thu, 17 Oct 2013 16:59:55 +0200 (CEST) Received: from thor.qindel.com ([127.0.0.1]) by localhost (thor.qindel.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 8EDMeZdolq8W for ; Thu, 17 Oct 2013 16:59:54 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by thor.qindel.com (Postfix) with ESMTP id CBFE55C82 for ; Thu, 17 Oct 2013 16:59:54 +0200 (CEST) X-Virus-Scanned: amavisd-new at thor.qindel.com Received: from thor.qindel.com ([127.0.0.1]) by localhost (thor.qindel.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id TH0bqZm2bKnb for ; Thu, 17 Oct 2013 16:59:54 +0200 (CEST) Received: from [172.26.8.242] (sfandino.qindel.com [172.26.8.242]) by thor.qindel.com (Postfix) with ESMTPSA id A29D451D2 for ; Thu, 17 Oct 2013 16:59:54 +0200 (CEST) Message-ID: <525FFB74.9050807@yahoo.com> Date: Thu, 17 Oct 2013 17:00:04 +0200 From: Salvador Fandino User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: libssh2-devel@cool.haxx.se Subject: Re: [PATCH] Honour window_size_initial from _libssh2_channel_read References: <525F21A7.5010209@yahoo.com> In-Reply-To: <525F21A7.5010209@yahoo.com> X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id r9HF0CLN018408 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by giant.haxx.se id r9HF0Dqm019048 On 10/17/2013 01:30 AM, Salvador Fandiño wrote: > On 10/16/2013 11:14 PM, Daniel Stenberg wrote: >> On Wed, 16 Oct 2013, Salvador Fandino wrote: >> >>> See the commit message for the details. >> >> This is the first one in your series that I'm not totally convinced is >> correct. When we do SFTP over big pipes with really large RTT, I fear >> that having a "mere" 256KB in maximum window is a potential problem to >> users. > > 256000 is also too low for my taste. > > But in any case, the correct way to solve that is not to hard-code some > arbitrary size but to use a better value for > LIBSSH2_CHANNEL_WINDOW_DEFAULT . > > OpenSSH uses 2MB for its window size, that would probably be a good > field-tested default. > >> Have you done any performance tests with and without this patch? > > As stated on the patch, just over a LAN with out any noticeable speed > degradation. I would try to write some script to simulate different > network conditions and measure the transfer speed for a few window sizes. I have been running some transfer test and measuring their speed. My setup was composed of a quad-core Linux machine running Ubuntu 13.10 x86_64 with a LXC container inside. The data transfers were performed from the container to the host (never crossing through a physical network device). Network delays were simulated using the tc tool. And ping was used to verify that they worked as intended during the tests. The operation performed was the equivalent to the following ssh command: $ ssh container "dd bs=16K count=8K if=/dev/zero" >/dev/null Though, establishment and closing of the SSH connection was excluded from the timings. I run the tests several times transferring files of sizes up to 128MB and the results were consistent between runs. The results corresponding to the 128MB transfer are available here: https://docs.google.com/spreadsheet/ccc?key=0Ao1yRmX6PQQzdG5wSFlrZl9HRWNET3ZyN0hnaGo5ZFE&usp=sharing It clearly shows that 256KB is too small as the default window size. Moving to a 512MB generates a great improvement and after the 1MB mark the returns rapidly diminish. Other factors (TCP window size, probably) become more limiting than the channel window size For comparison I also performed the same transfers using OpenSSH. Its speed is usually on par with that of libssh2 using a window size of 1MB (even if it uses a 2MB window, maybe it is less aggressive sending the window adjust msgs). In summary, the conclusion I get from these results is that LIBSSH2_CHANNEL_WINDOW_DEFAULT value should be increased to 1 or 2 MB. The script used run the tests and generate the data is here: https://github.com/salva/p5-Net-SSH-Any/blob/master/examples/window_size.pl It requires the development versions of the Perl modules Net::SSH::Any and Net::SSH2 available from the following URLs: https://github.com/salva/p5-Net-SSH-Any https://github.com/salva/p5-Net-SSH2 Net::SSH2 should be compiled against the git version of libssh2 with the patch "Honour window_size_initial from _libssh2_channel_read" applied. _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Fri Oct 18 14:27:53 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9ICRSPd000539; Fri, 18 Oct 2013 14:27:48 +0200 Received: from scorpion.us.mahle.com (scorpion.us.mahle.com [97.78.163.20]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9ICRQTr000373 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Fri, 18 Oct 2013 14:27:26 +0200 X-IronPort-AV: E=Sophos;i="4.93,522,1378872000"; d="scan'208";a="300503" Received: from farldma1.na.global.mahle ([10.18.201.33]) by scorpion.na.global.mahle with ESMTP; 18 Oct 2013 08:27:21 -0400 Subject: Using libssh2 1.4.3 is creating corrupt files. X-KeepSent: E4E92EDE:E7B84133-85257C08:00437764; type=4; name=$KeepSent To: libssh2-devel@cool.haxx.se X-Mailer: Lotus Notes Release 8.5.2 August 10, 2010 Message-ID: From: Aaron.Stokes@us.mahle.com Date: Fri, 18 Oct 2013 08:27:20 -0400 X-MIMETrack: Serialize by Router on FARLDMA1/SRV/MAHLE(Release 8.5.3FP3|November 15, 2012) at 10/18/2013 08:27:21 AM MIME-Version: 1.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" We are currently using libssh2 1.4.3 libraries and we ran into a problem. Before using 1.4.3 we were able to send 180MB files through FTP successfully with no problems using 1.2.7. Since upgrading to 1.4.3, we have had issues of ftp receiving corrupt files. Our solution was to increase the buffer size to 10MB solved this problem, but we want to understand why this is happening. _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Fri Oct 18 23:49:27 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9ILn5qu032591; Fri, 18 Oct 2013 23:49:22 +0200 Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9ILn4HD032352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 18 Oct 2013 23:49:04 +0200 Received: from localhost (dast@localhost) by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r9ILn3QD032264 for ; Fri, 18 Oct 2013 23:49:03 +0200 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Fri, 18 Oct 2013 23:49:03 +0200 (CEST) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: Re: [PATCH] Honour window_size_initial from _libssh2_channel_read In-Reply-To: <525FFB74.9050807@yahoo.com> Message-ID: References: <525F21A7.5010209@yahoo.com> <525FFB74.9050807@yahoo.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.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On Thu, 17 Oct 2013, Salvador Fandino wrote: > In summary, the conclusion I get from these results is that > LIBSSH2_CHANNEL_WINDOW_DEFAULT value should be increased to 1 or 2 MB. I can only agree. You up to making a patch with that change and parts of your great explanation here in the commit message to help future hackers? I think it makes sense to pick OpenSSH's default here. -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Sat Oct 19 23:20:27 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9JLJv8q026956; Sat, 19 Oct 2013 23:20:21 +0200 Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9JLJspd026880 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 19 Oct 2013 23:19:54 +0200 Received: from localhost (dast@localhost) by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r9JLJsSe026876 for ; Sat, 19 Oct 2013 23:19:54 +0200 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Sat, 19 Oct 2013 23:19:54 +0200 (CEST) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: Re: Using libssh2 1.4.3 is creating corrupt files. In-Reply-To: Message-ID: References: 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.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On Fri, 18 Oct 2013, Aaron.Stokes@us.mahle.com wrote: > Before using 1.4.3 we were able to send 180MB files through FTP successfully > with no problems using 1.2.7. Since upgrading to 1.4.3, we have had issues > of ftp receiving corrupt files. Our solution was to increase the buffer > size to 10MB solved this problem, but we want to understand why this is > happening. Wow, that sounds so... unexpected. You increased the buffer from which size? And did you check to see if there's a magic limit exactly where the breakage stopped? Can you write up a test code and show us that breaks for you? On what operating system are you using libssh2? Which crypto backend are you using? How's the RTT to the server, roughly? Any chance you can try out the latest git version just to make sure the problem hasn't been fixed already? -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Sun Oct 20 17:28:35 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9KFS7O2022733; Sun, 20 Oct 2013 17:28:29 +0200 Received: from hedgehog.aldebaran.co.uk (smtp.aldebaran.co.uk [62.128.215.131]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9KFS5aT022540 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT) for ; Sun, 20 Oct 2013 17:28:05 +0200 Received: from HEDGEHOG.aldebaran.co.uk ([fe80::7d3c:197:bf1d:1984]) by hedgehog.aldebaran.co.uk ([fe80::7d3c:197:bf1d:1984%10]) with mapi; Sun, 20 Oct 2013 16:28:01 +0100 From: Graham Bradshaw To: "'libssh2-devel@cool.haxx.se'" Subject: Bug in sign_fromfile (userauth.c) Thread-Topic: Bug in sign_fromfile (userauth.c) Thread-Index: Ac7NqPYNT8jvWtOVRICpX5p3Eyi+CQ== Date: Sun, 20 Oct 2013 15:28:00 +0000 Message-ID: <81741C8F2F9F0F4AA9F592A008D0286766E9F118@hedgehog.aldebaran.co.uk> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: MIME-Version: 1.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============1845961558==" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" --===============1845961558== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_81741C8F2F9F0F4AA9F592A008D0286766E9F118hedgehogaldebar_" --_000_81741C8F2F9F0F4AA9F592A008D0286766E9F118hedgehogaldebar_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable There might be a bug in userauth.c, in sign_fromfile. privkeyobj->dtor is c= alled to clean up, but the first time it is called (if privkeyobj->signv re= turns non-zero), it passes abstract in. The other time it passes in hostkey= _abstract, which seems sensible. abstract is passed in and points to a poin= ter to a privkey_file structure which is declared on the stack in userauth_= publickey_fromfile, so freeing it looks wrong. I'm actually trying to find out how to authenticate using a private key, bu= t one that I already have in memory. I realise I can simply write it out to= a temporary file and use that temporary file in a call to userauth_publick= ey_fromfile, but I'd like to avoid having the private key on disk at all if= possible. I've looked at http://libssh2.org/libssh2_userauth_publickey.html, but the = information on what's needed for the callback function isn't complete. Are = there any other examples anywhere, or can someone point me in the right dir= ection? --_000_81741C8F2F9F0F4AA9F592A008D0286766E9F118hedgehogaldebar_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

There might be a= bug in userauth.c, in sign_fromfile. privkeyobj->dtor is called to clean up, but the first time it is ca= lled (if privkeyobj->signv returns non-zero), it passes abstract in. The= other time it passes in hostkey_abstract, which seems sensible. abstract i= s passed in and points to a pointer to a privkey_file structure which is de= clared on the stack in userauth_publickey_fromfile, so freeing it looks wro= ng.

 

I’m actually trying to find out how to= authenticate using a private key, but one that I already have in memory. I= realise I can simply write it out to a temporary file and use that tempora= ry file in a call to userauth_publickey_fromfile, but I’d like to avo= id having the private key on disk at all if possible.

=

 <= /o:p>

I’ve looked at http://libssh2.org/libssh2_userauth_publickey.html, but th= e information on what’s needed for the callback function isn’t = complete. Are there any other examples anywhere, or can someone point me in= the right direction?

 

 

= --_000_81741C8F2F9F0F4AA9F592A008D0286766E9F118hedgehogaldebar_-- --===============1845961558== 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 --===============1845961558==-- From libssh2-devel-bounces@cool.haxx.se Sun Oct 20 19:16:52 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9KHGcJi026900; Sun, 20 Oct 2013 19:16:51 +0200 Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9KHGaEO026881 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 20 Oct 2013 19:16:36 +0200 Received: from localhost (dast@localhost) by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r9KHGah0026877 for ; Sun, 20 Oct 2013 19:16:36 +0200 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Sun, 20 Oct 2013 19:16:36 +0200 (CEST) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: Re: Bug in sign_fromfile (userauth.c) In-Reply-To: <81741C8F2F9F0F4AA9F592A008D0286766E9F118@hedgehog.aldebaran.co.uk> Message-ID: References: <81741C8F2F9F0F4AA9F592A008D0286766E9F118@hedgehog.aldebaran.co.uk> 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.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On Sun, 20 Oct 2013, Graham Bradshaw wrote: > There might be a bug in userauth.c, in sign_fromfile. privkeyobj->dtor is > called to clean up, but the first time it is called (if privkeyobj->signv > returns non-zero), it passes abstract in. The other time it passes in > hostkey_abstract, which seems sensible. abstract is passed in and points to > a pointer to a privkey_file structure which is declared on the stack in > userauth_publickey_fromfile, so freeing it looks wrong. Right, only one of them can be right so the other has to be wrong! > I've looked at http://libssh2.org/libssh2_userauth_publickey.html, but the > information on what's needed for the callback function isn't complete. Are > there any other examples anywhere, or can someone point me in the right > direction? I think we should fix the code and add the missing description to the man page! You up for it? -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Mon Oct 21 14:52:35 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9LCq97I000925; Mon, 21 Oct 2013 14:52:28 +0200 Received: from scorpion.us.mahle.com (scorpion.us.mahle.com [97.78.163.20]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9LCq6FV000776 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Mon, 21 Oct 2013 14:52:07 +0200 X-IronPort-AV: E=Sophos;i="4.93,539,1378872000"; d="scan'208";a="317725" Received: from farldma1.na.global.mahle ([10.18.201.33]) by scorpion.na.global.mahle with ESMTP; 21 Oct 2013 08:52:00 -0400 In-Reply-To: References: Subject: Re: Using libssh2 1.4.3 is creating corrupt files. X-KeepSent: 03440E25:F2858E5C-85257C0B:00461EBE; type=4; name=$KeepSent To: libssh2 development X-Mailer: Lotus Notes Release 8.5.2 August 10, 2010 Message-ID: From: Aaron.Stokes@us.mahle.com Date: Mon, 21 Oct 2013 08:52:01 -0400 X-MIMETrack: Serialize by Router on FARLDMA1/SRV/MAHLE(Release 8.5.3FP3|November 15, 2012) at 10/21/2013 08:52:00 AM MIME-Version: 1.0 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Buffer size change (we have no idea what the 33 was for, but it was probably required in the old version) -#define WRITEBUFFERSIZE (1024*32)-33 +#define WRITEBUFFERSIZE 1024*128 Behavior wasn't reproducible when I moved the code, it instead 'hung' at a different part of the file transfer (in terms of bytes). Haven't tried putting it in a separate application yet. As it won't reproducible independently, we haven't been able to test if there is some magic file size that causes the problem. We're using Windows, server is Tectia on Windows. The application was compiled on a 32 bit Windows XP machine using Builder XE. We also switched from openssl to libgcrypt when we migrated from 1.2.7 to 1.4.3 This happens across multiple client/server environments with differing amounts of RTT, but here it is essentially negligible. From: Daniel Stenberg To: libssh2 development Date: 10/19/2013 05:24 PM Subject: Re: Using libssh2 1.4.3 is creating corrupt files. Sent by: "libssh2-devel" On Fri, 18 Oct 2013, Aaron.Stokes@us.mahle.com wrote: > Before using 1.4.3 we were able to send 180MB files through FTP successfully > with no problems using 1.2.7. Since upgrading to 1.4.3, we have had issues > of ftp receiving corrupt files. Our solution was to increase the buffer > size to 10MB solved this problem, but we want to understand why this is > happening. Wow, that sounds so... unexpected. You increased the buffer from which size? And did you check to see if there's a magic limit exactly where the breakage stopped? Can you write up a test code and show us that breaks for you? On what operating system are you using libssh2? Which crypto backend are you using? How's the RTT to the server, roughly? Any chance you can try out the latest git version just to make sure the problem hasn't been fixed already? -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Mon Oct 21 15:47:41 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9LDlWZi032014; Mon, 21 Oct 2013 15:47:39 +0200 Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9LDlUpU031988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 21 Oct 2013 15:47:30 +0200 Received: from localhost (dast@localhost) by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r9LDlT16031985 for ; Mon, 21 Oct 2013 15:47:29 +0200 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Mon, 21 Oct 2013 15:47:29 +0200 (CEST) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: Re: Using libssh2 1.4.3 is creating corrupt files. In-Reply-To: Message-ID: References: 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.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On Mon, 21 Oct 2013, Aaron.Stokes@us.mahle.com wrote: > Buffer size change (we have no idea what the 33 was for, but it was > probably required in the old version) > -#define WRITEBUFFERSIZE (1024*32)-33 > +#define WRITEBUFFERSIZE 1024*128 Ah, you're talking about the buffer size you pass in to a libssh2 function. libssh2_sftp_write() I take it. > Behavior wasn't reproducible when I moved the code, it instead 'hung' at a > different part of the file transfer (in terms of bytes). Haven't tried > putting it in a separate application yet. As it won't reproducible > independently, we haven't been able to test if there is some magic file size > that causes the problem. But if the problem can't be repeated independently, how can you then be sure it is due to the buffer size change? If it truly is a problem with a 32K buffer, then surely it won't work if you write a small stand-alone program using a 32K upload buffer? Could it be that the -33 is causing the problem? > We're using Windows, server is Tectia on Windows. The application was > compiled on a 32 bit Windows XP machine using Builder XE. > > We also switched from openssl to libgcrypt when we migrated from 1.2.7 to > 1.4.3 And you decided that could not be a reason for the new problem? > This happens across multiple client/server environments with differing > amounts of RTT, but here it is essentially negligible. That's good information as SFTP is fairly sensitive to RTT and could potentially show different behaviors. -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Mon Oct 21 17:56:40 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9LFuGIK012185; Mon, 21 Oct 2013 17:56:33 +0200 Received: from thor.qindel.com (smtp.qindel.com [89.140.90.34]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9LFuEZH012110 for ; Mon, 21 Oct 2013 17:56:14 +0200 Received: from localhost (localhost [127.0.0.1]) by thor.qindel.com (Postfix) with ESMTP id DA9EA64E5 for ; Mon, 21 Oct 2013 17:55:56 +0200 (CEST) Received: from thor.qindel.com ([127.0.0.1]) by localhost (thor.qindel.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id J44jzPfRG06n for ; Mon, 21 Oct 2013 17:55:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by thor.qindel.com (Postfix) with ESMTP id 2F39464E9 for ; Mon, 21 Oct 2013 17:55:53 +0200 (CEST) X-Virus-Scanned: amavisd-new at thor.qindel.com Received: from thor.qindel.com ([127.0.0.1]) by localhost (thor.qindel.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KPm3lgrF3vfp for ; Mon, 21 Oct 2013 17:55:52 +0200 (CEST) Received: from [172.26.8.242] (sfandino.qindel.com [172.26.8.242]) by thor.qindel.com (Postfix) with ESMTPSA id B894C64E5 for ; Mon, 21 Oct 2013 17:55:52 +0200 (CEST) Message-ID: <52654E93.2080608@yahoo.com> Date: Mon, 21 Oct 2013 17:56:03 +0200 From: Salvador Fandino User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: libssh2-devel@cool.haxx.se Subject: Re: [PATCH] Honour window_size_initial from _libssh2_channel_read References: <525F21A7.5010209@yahoo.com> <525FFB74.9050807@yahoo.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------050900060102030203010506" X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" This is a multi-part message in MIME format. --------------050900060102030203010506 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 10/18/2013 11:49 PM, Daniel Stenberg wrote: > On Thu, 17 Oct 2013, Salvador Fandino wrote: > >> In summary, the conclusion I get from these results is that >> LIBSSH2_CHANNEL_WINDOW_DEFAULT value should be increased to 1 or 2 MB. > > I can only agree. You up to making a patch with that change and parts of > your great explanation here in the commit message to help future > hackers? I think it makes sense to pick OpenSSH's default here. Here is another run of patches. I have gone a bit further and, besides increasing the default window size to 2MB, I have also added two new slots into the session structure channel_window_size and channel_packet_size that are used as the default values for new channels. The issue I try to avoid is that the window and packet sizes are not always settable with the current API. I.e. they can not be set for "tcp-ip" channels or for those created implicitly as for instance, reverse tunnels. The most controversial change is the way those new parameters are set as I have added a new unified interface for setting/retrieving all the session parameters "libssh2_session_config_(set|get)" and deprecated "libssh2_session_flag" and "libssh2_session_(set|get)_(timeout|blocking)". A more detailed explanation is on the commit message. The alternative would be to use a pair of functions to set/get every parameter. I don't have a strong preference for one way or the other. My only point is that the API should be consistent in the way those accessors work. In any case, IMO, patches 1 an 2 can be applied right now as they implement changes we have already discussed. --------------050900060102030203010506 Content-Type: text/x-patch; name="0001-Honour-window_size_initial-from-_libssh2_channel_rea.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Honour-window_size_initial-from-_libssh2_channel_rea.pa"; filename*1="tch" From 0404db14b41d2c6c96cb26129b038785019da917 Mon Sep 17 00:00:00 2001 From: Salvador Date: Wed, 16 Oct 2013 13:31:31 +0200 Subject: [PATCH 1/5] Honour window_size_initial from _libssh2_channel_read _libssh2_channel_read was using an arbitrary hard-coded limit to trigger the window adjusting code. The adjustment used was also hard-coded and arbitrary, 15MB actually, which would limit the usability of libssh2 on systems with little RAM. This patch, uses the window_size parameter passed to libssh2_channel_open_ex (stored as remote.window_size_initial) plus the buflen as the base for the trigger and the adjustment calculation. The memory usage when using the default window size is reduced from 22MB to 256KB per channel (actually, if compression is used, these numbers should be incremented by ~50% to account for the errors between the decompressed packet sizes and the predicted sizes). My tests indicate that this change does not impact the performance of transfers across localhost or a LAN, being it on par with that of OpenSSH. On the other hand, it will probably slow down transfers on networks with high bandwidth*delay when the default window size (LIBSSH2_CHANNEL_WINDOW_DEFAULT=256KB) is used. Signed-off-by: Salvador Fandino --- src/channel.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/channel.c b/src/channel.c index 9df2f8d..d6bfb98 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1761,14 +1761,17 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, stream_id); /* expand the receiving window first if it has become too narrow */ - if((channel->read_state == libssh2_NB_state_jump1) || - (channel->remote.window_size < (LIBSSH2_CHANNEL_WINDOW_DEFAULT*30))) { + if( (channel->read_state == libssh2_NB_state_jump1) || + (channel->remote.window_size < channel->remote.window_size_initial / 4 * 3 + buflen) ) { + + uint32_t adjustment = channel->remote.window_size_initial + buflen - channel->remote.window_size; + if (adjustment < LIBSSH2_CHANNEL_MINADJUST) + adjustment = LIBSSH2_CHANNEL_MINADJUST; /* the actual window adjusting may not finish so we need to deal with this special state here */ channel->read_state = libssh2_NB_state_jump1; - rc = _libssh2_channel_receive_window_adjust(channel, - (LIBSSH2_CHANNEL_WINDOW_DEFAULT*60), + rc = _libssh2_channel_receive_window_adjust(channel, adjustment, 0, NULL); if (rc) return rc; -- 1.8.3.2 --------------050900060102030203010506 Content-Type: text/x-patch; name="0002-Set-default-window-size-to-2MB.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-Set-default-window-size-to-2MB.patch" From 59df29ae35c8c59c0d18ccc9852bcd9f55aa6944 Mon Sep 17 00:00:00 2001 From: Salvador Fandino Date: Mon, 21 Oct 2013 11:58:55 +0200 Subject: [PATCH 2/5] Set default window size to 2MB The default channel window size used until now was 256KB. This value is too small and results on a bottleneck on real-life networks where round-trip delays can easily reach 300ms. The issue was not visible because the configured channel window size was being ignored and a hard-coded value of ~22MB being used instead, but that was fixed on a previous commit. This patch just changes the default window size (LIBSSH2_CHANNEL_WINDOW_DEFAULT) to 2MB. It is the same value used by OpenSSH and in our opinion represents a good compromise between memory used and transfer speed. Performance tests were run to determine the optimum value. The details and related discussion are available from the following thread on the libssh2 mailing-list: http://www.libssh2.org/mail/libssh2-devel-archive-2013-10/0018.shtml http://article.gmane.org/gmane.network.ssh.libssh2.devel/6543 An excerpt follows: "I have been running some transfer test and measuring their speed. My setup was composed of a quad-core Linux machine running Ubuntu 13.10 x86_64 with a LXC container inside. The data transfers were performed from the container to the host (never crossing through a physical network device). Network delays were simulated using the tc tool. And ping was used to verify that they worked as intended during the tests. The operation performed was the equivalent to the following ssh command: $ ssh container "dd bs=16K count=8K if=/dev/zero" >/dev/null Though, establishment and closing of the SSH connection was excluded from the timings. I run the tests several times transferring files of sizes up to 128MB and the results were consistent between runs. The results corresponding to the 128MB transfer are available here: https://docs.google.com/spreadsheet/ccc?key=0Ao1yRmX6PQQzdG5wSFlrZl9HRWNET3ZyN0hnaGo5ZFE&usp=sharing It clearly shows that 256KB is too small as the default window size. Moving to a 512MB generates a great improvement and after the 1MB mark the returns rapidly diminish. Other factors (TCP window size, probably) become more limiting than the channel window size For comparison I also performed the same transfers using OpenSSH. Its speed is usually on par with that of libssh2 using a window size of 1MB (even if it uses a 2MB window, maybe it is less aggressive sending the window adjust msgs)." Signed-off-by: Salvador Fandino --- include/libssh2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/libssh2.h b/include/libssh2.h index 1b0d690..56cb9a1 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -593,7 +593,7 @@ LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeout); /* Channel API */ -#define LIBSSH2_CHANNEL_WINDOW_DEFAULT (256*1024) +#define LIBSSH2_CHANNEL_WINDOW_DEFAULT (2*1024*1024) #define LIBSSH2_CHANNEL_PACKET_DEFAULT 32768 #define LIBSSH2_CHANNEL_MINADJUST 1024 -- 1.8.3.2 --------------050900060102030203010506 Content-Type: text/x-patch; name="0003-Set-channel-window-and-packet-size-from-configurable.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0003-Set-channel-window-and-packet-size-from-configurable.pa"; filename*1="tch" From 4a692b4d1158b0ac3bcdb821d8a711301fb85cb4 Mon Sep 17 00:00:00 2001 From: Salvador Fandino Date: Mon, 21 Oct 2013 12:59:02 +0200 Subject: [PATCH 3/5] Set channel window and packet size from configurable values on the session object Currently, the channel and packet window sizes can only be configured when "libssh2_channel_open_ex" is used to create the channel. Unfortunatelly this is not always an option. For instance, for some channel types (i.e. tcp-ip) a different function must be used; in other cases, the channel is not created explicitly by the user. This patch adds two new slots into the session structure to store the default window and packet sizes. Every channel created in this session will use these values by default (unless a set of different ones are explicitly set). A new pair of constants (LIBSSH2_CHANNEL_WINDOW_CONFIGURED and LIBSSH2_CHANNEL_PACKET_CONFIGURED) are also defined. These can be used on function calls were the packet and/or window size are passed to indicate that the configured values are to be used. Note that this patch does not introduce any way to set or change the values on the session object yet. Signed-off-by: Salvador Fandino --- include/libssh2.h | 6 ++++-- src/channel.c | 10 ++++++++-- src/libssh2_priv.h | 4 ++++ src/packet.c | 14 ++++++++------ src/session.c | 2 ++ 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/include/libssh2.h b/include/libssh2.h index 56cb9a1..ea6d449 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -594,7 +594,9 @@ LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, /* Channel API */ #define LIBSSH2_CHANNEL_WINDOW_DEFAULT (2*1024*1024) +#define LIBSSH2_CHANNEL_WINDOW_CONFIGURED (~(unsigned int)0) #define LIBSSH2_CHANNEL_PACKET_DEFAULT 32768 +#define LIBSSH2_CHANNEL_PACKET_CONFIGURED (~(unsigned int)0) #define LIBSSH2_CHANNEL_MINADJUST 1024 /* Extended Data Handling */ @@ -615,8 +617,8 @@ libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *channel_type, #define libssh2_channel_open_session(session) \ libssh2_channel_open_ex((session), "session", sizeof("session") - 1, \ - LIBSSH2_CHANNEL_WINDOW_DEFAULT, \ - LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL, 0) + LIBSSH2_CHANNEL_WINDOW_CONFIGURED, \ + LIBSSH2_CHANNEL_PACKET_CONFIGURED, NULL, 0) LIBSSH2_API LIBSSH2_CHANNEL * libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, const char *host, diff --git a/src/channel.c b/src/channel.c index d6bfb98..b208530 100644 --- a/src/channel.c +++ b/src/channel.c @@ -154,6 +154,12 @@ _libssh2_channel_open(LIBSSH2_SESSION * session, const char *channel_type, memset(&session->open_packet_requirev_state, 0, sizeof(session->open_packet_requirev_state)); + if (window_size == LIBSSH2_CHANNEL_WINDOW_CONFIGURED) + window_size = session->channel_window_size; + + if (packet_size == LIBSSH2_CHANNEL_PACKET_CONFIGURED) + packet_size = session->channel_packet_size; + _libssh2_debug(session, LIBSSH2_TRACE_CONN, "Opening Channel - win %d pack %d", window_size, packet_size); @@ -375,8 +381,8 @@ channel_direct_tcpip(LIBSSH2_SESSION * session, const char *host, channel = _libssh2_channel_open(session, "direct-tcpip", sizeof("direct-tcpip") - 1, - LIBSSH2_CHANNEL_WINDOW_DEFAULT, - LIBSSH2_CHANNEL_PACKET_DEFAULT, + session->channel_window_size, + session->channel_packet_size, session->direct_message, session->direct_message_len); diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index 461d14c..b901316 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -638,6 +638,10 @@ struct _LIBSSH2_SESSION void* tracehandler_context; /* context for the trace handler */ #endif + /* configured values */ + unsigned int channel_window_size; + unsigned int channel_packet_size; + /* State variables used in libssh2_banner_send() */ libssh2_nonblocking_states banner_TxRx_state; char banner_TxRx_banner[256]; diff --git a/src/packet.c b/src/packet.c index 47bbf2b..94df7bf 100644 --- a/src/packet.c +++ b/src/packet.c @@ -172,11 +172,11 @@ packet_queue_listener(LIBSSH2_SESSION * session, unsigned char *data, channel->remote.id = listen_state->sender_channel; channel->remote.window_size_initial = - LIBSSH2_CHANNEL_WINDOW_DEFAULT; + session->channel_window_size; channel->remote.window_size = - LIBSSH2_CHANNEL_WINDOW_DEFAULT; + session->channel_window_size; channel->remote.packet_size = - LIBSSH2_CHANNEL_PACKET_DEFAULT; + session->channel_packet_size; channel->local.id = _libssh2_channel_nextid(session); channel->local.window_size_initial = @@ -323,9 +323,11 @@ packet_x11_open(LIBSSH2_SESSION * session, unsigned char *data, channel->remote.id = x11open_state->sender_channel; channel->remote.window_size_initial = - LIBSSH2_CHANNEL_WINDOW_DEFAULT; - channel->remote.window_size = LIBSSH2_CHANNEL_WINDOW_DEFAULT; - channel->remote.packet_size = LIBSSH2_CHANNEL_PACKET_DEFAULT; + session->channel_window_size; + channel->remote.window_size = + session->channel_window_size; + channel->remote.packet_size = + session->channel_packet_size; channel->local.id = _libssh2_channel_nextid(session); channel->local.window_size_initial = diff --git a/src/session.c b/src/session.c index 9838d2b..e00b132 100644 --- a/src/session.c +++ b/src/session.c @@ -493,6 +493,8 @@ libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)), session->send = _libssh2_send; session->recv = _libssh2_recv; session->abstract = abstract; + session->channel_window_size = LIBSSH2_CHANNEL_WINDOW_DEFAULT; + session->channel_packet_size = LIBSSH2_CHANNEL_PACKET_DEFAULT; session->api_timeout = 0; /* timeout-free API by default */ session->api_block_mode = 1; /* blocking API by default */ _libssh2_debug(session, LIBSSH2_TRACE_TRANS, -- 1.8.3.2 --------------050900060102030203010506 Content-Type: text/x-patch; name="0004-add-functions-libssh2_session_config_-set-get.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0004-add-functions-libssh2_session_config_-set-get.patch" From 040409112882844176f744892d0c55d2bf5d4129 Mon Sep 17 00:00:00 2001 From: Salvador Fandino Date: Mon, 21 Oct 2013 17:09:06 +0200 Subject: [PATCH 4/5] add functions libssh2_session_config_(set|get) There are several session parameters that can be reconfigured by the user (compress, sigpipe, blocking, timeout and channel window and packet size). Currently, libssh2 lacks an uniform way to manipulate those parameters. For "compress" and "sigpipe" "libssh2_session_flag" is available which allows to change but not to retrieve these flags values. For "blocking" and "timeout" there are "libssh2_session_(set|get}_(blocking|timeout)" functions available, though "libssh2_session_set_blocking" returns the old blocking setting while "libssh2_session_set_timeout" is a void function. The new "libssh2_session_config_set" and "libssh2_session_config_get" functions provide a uniform interface for setting and getting respectively the configurable session parameters. A new set of constants to be used as the selector keys are also defined (they are LIBSSH2_SESSION_CONFIG_SIGPIPE, LIBSSH2_SESSION_CONFIG_COMPRESS, LIBSSH2_SESSION_CONFIG_CHANNEL_WINDOW_SIZE, LIBSSH2_SESSION_CONFIG_CHANNEL_PACKET_SIZE, LIBSSH2_SESSION_CONFIG_TIMEOUT and LIBSSH2_SESSION_CONFIG_BLOCKING). Signed-off-by: Salvador Fandino --- docs/Makefile.am | 2 + docs/libssh2_session_config_get.3 | 27 ++++++++ docs/libssh2_session_config_set.3 | 65 +++++++++++++++++ docs/libssh2_session_flag.3 | 4 ++ docs/libssh2_session_get_blocking.3 | 4 ++ docs/libssh2_session_get_timeout.3 | 5 ++ docs/libssh2_session_set_blocking.3 | 4 ++ docs/libssh2_session_set_timeout.3 | 5 ++ include/libssh2.h | 43 ++++++++---- src/channel.c | 4 +- src/session.c | 135 +++++++++++++++++------------------- src/session.h | 3 - 12 files changed, 215 insertions(+), 86 deletions(-) create mode 100644 docs/libssh2_session_config_get.3 create mode 100644 docs/libssh2_session_config_set.3 diff --git a/docs/Makefile.am b/docs/Makefile.am index e6ab394..a2196e5 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -96,6 +96,8 @@ dist_man_MANS = \ libssh2_session_banner_set.3 \ libssh2_session_block_directions.3 \ libssh2_session_callback_set.3 \ + libssh2_session_config_set.3 \ + libssh2_session_config_get.3 \ libssh2_session_disconnect.3 \ libssh2_session_disconnect_ex.3 \ libssh2_session_flag.3 \ diff --git a/docs/libssh2_session_config_get.3 b/docs/libssh2_session_config_get.3 new file mode 100644 index 0000000..e2fd6b6 --- /dev/null +++ b/docs/libssh2_session_config_get.3 @@ -0,0 +1,27 @@ +.TH libssh2_session_config_get 3 "21 Oct 2013" "libssh2 1.4.4" "libssh2 manual" +.SH NAME +libssh2_session_config_get - get configurable session parameters +.SH SYNOPSIS +#include + +unsigned long +libssh2_session_config_get(LIBSSH2_SESSION *session, int key); + +.SH DESCRIPTION +This function returns the current value for the configurable parameter +given by \fIkey\fP. + +See +.BR libssh2_session_config_set(3) +for the list of available parameters. + +.SH RETURN VALUE +Returns the value of the given parameter. + +.SH AVAILABILITY +This function has been available since version 1.4.4. + +.SH SEE ALSO + +.BR libssh2_session_config_set(3) + diff --git a/docs/libssh2_session_config_set.3 b/docs/libssh2_session_config_set.3 new file mode 100644 index 0000000..27ed16b --- /dev/null +++ b/docs/libssh2_session_config_set.3 @@ -0,0 +1,65 @@ +.TH libssh2_session_config_set 3 "21 Oct 2013" "libssh2 1.4.4" "libssh2 manual" +.SH NAME +libssh2_session_config_set - set configurable session parameters +.SH SYNOPSIS +#include + +unsigned long +libssh2_session_config_set(LIBSSH2_SESSION *session, int key, unsigned long value); + +.SH DESCRIPTION +This function allows one to set the session configurable +parameters. \fIkey\fP is the parameter to set, and \fIvalue\fP is its +new value. + +.SH KEYS +The parameters that can be currently set are as follows: + +.IP LIBSSH2_SESSION_CONFIG_BLOCKING +Sets or clears the session blocking mode. This will instantly affect any +channels associated with this session. + +If a read is performed on a session with no data currently available, +a blocking session will wait for data to arrive and return what it +receives. A non-blocking session will return immediately with an empty +buffer. + +If a write is performed on a session with no room for more data, a +blocking session will wait for room. A non-blocking session will +return immediately without writing anything. + +.IP LIBSSH2_SESSION_CONFIG_SIGPIPE +If set to a true value, libssh2 will not attempt to block SIGPIPEs but +will let them trigger from the underlying socket layer. + +.IP LIBSSH2_SESSION_CONFIG_COMPRESS +If set to a true value before the connection handshake is performed, +libssh2 will try to use compression for the session negotiating it +with the server. + +libssh2 does not attempt to use compression by default. + +.IP LIBSSH2_SESSION_TIMEOUT +Sets the session timeout in miliseconds. The timeout repressents for +how long a blocking libssh2 function call may wait before failing with +a LIBSSH2_ERROR_TIMEOUT error. + +.IP LIBSSH2_SESSION_CHANNEL_WINDOW_SIZE +Sets the window size in bytes used for new created channels. The +default value is 2MB. + +.IP LIBSSH2_SESSION_CHANNEL_PACKET_SIZE +Sets the maximum packet size in bytes for new created channels. The +default value is 32KB. + +.SH RETURN VALUE +Returns the value the parameter had previously. + +.SH AVAILABILITY +This function has been available since version 1.4.4. + +.SH SEE ALSO +.BR libssh2_session_config_get(3) , +.BR libssh2_session_flag(3) , +.BR libssh2_session_set_blocking(3) , +.BR libssh2_session_set_timeout(3) . diff --git a/docs/libssh2_session_flag.3 b/docs/libssh2_session_flag.3 index 3a9e5e5..e52baad 100644 --- a/docs/libssh2_session_flag.3 +++ b/docs/libssh2_session_flag.3 @@ -5,6 +5,10 @@ libssh2_session_flag - TODO int libssh2_session_flag(LIBSSH2_SESSION *session, int flag, int value); .SH DESCRIPTION + +This function is deprecated. Use the +\fIlibssh2_session_config_set(3)\fP function instead! + Set options for the created session. \fIflag\fP is the option to set, while \fIvalue\fP is typically set to 1 or 0 to enable or disable the option. .SH FLAGS diff --git a/docs/libssh2_session_get_blocking.3 b/docs/libssh2_session_get_blocking.3 index 8d98fa3..f1f02af 100644 --- a/docs/libssh2_session_get_blocking.3 +++ b/docs/libssh2_session_get_blocking.3 @@ -4,6 +4,10 @@ libssh2_session_get_blocking - TODO .SH SYNOPSIS int libssh2_session_get_blocking(LIBSSH2_SESSION *session); .SH DESCRIPTION + +This function is deprecated. Use the +\fIlibssh2_session_config_get(3)\fP function instead! + Returns 0 if the state of the session has previously be set to non-blocking and it returns 1 if the state was set to blocking. .SH RETURN VALUE diff --git a/docs/libssh2_session_get_timeout.3 b/docs/libssh2_session_get_timeout.3 index 94aacd6..4e6f2ad 100644 --- a/docs/libssh2_session_get_timeout.3 +++ b/docs/libssh2_session_get_timeout.3 @@ -5,7 +5,12 @@ libssh2_session_get_timeout - get the timeout for blocking functions #include .nf long libssh2_session_get_timeout(LIBSSH2_SESSION *session); + .SH DESCRIPTION + +This function is deprecated. Use the +\fIlibssh2_session_config_get(3)\fP function instead! + Returns the \fBtimeout\fP (in milliseconds) for how long a blocking the libssh2 function calls may wait until they consider the situation an error and return LIBSSH2_ERROR_TIMEOUT. diff --git a/docs/libssh2_session_set_blocking.3 b/docs/libssh2_session_set_blocking.3 index b16e009..d7ba251 100644 --- a/docs/libssh2_session_set_blocking.3 +++ b/docs/libssh2_session_set_blocking.3 @@ -8,6 +8,10 @@ void libssh2_session_set_blocking(LIBSSH2_SESSION *session, int blocking); .SH DESCRIPTION + +This function is deprecated. Use the +\fIlibssh2_session_config_set(3)\fP function instead! + \fIsession\fP - session instance as returned by .BR libssh2_session_init_ex(3) diff --git a/docs/libssh2_session_set_timeout.3 b/docs/libssh2_session_set_timeout.3 index 2d4f10f..56fa02b 100644 --- a/docs/libssh2_session_set_timeout.3 +++ b/docs/libssh2_session_set_timeout.3 @@ -5,7 +5,12 @@ libssh2_session_set_timeout - set timeout for blocking functions #include .nf void libssh2_session_set_timeout(LIBSSH2_SESSION *session, long timeout); + .SH DESCRIPTION + +This function is deprecated. Use the +\fIlibssh2_session_config_set(3)\fP function instead! + Set the \fBtimeout\fP in milliseconds for how long a blocking the libssh2 function calls may wait until they consider the situation an error and return LIBSSH2_ERROR_TIMEOUT. diff --git a/include/libssh2.h b/include/libssh2.h index ea6d449..01ec0fe 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -267,9 +267,17 @@ typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE #define LIBSSH2_METHOD_LANG_CS 8 #define LIBSSH2_METHOD_LANG_SC 9 -/* flags */ -#define LIBSSH2_FLAG_SIGPIPE 1 -#define LIBSSH2_FLAG_COMPRESS 2 +/* configurable keys */ +#define LIBSSH2_SESSION_CONFIG_SIGPIPE 1 +#define LIBSSH2_SESSION_CONFIG_COMPRESS 2 +#define LIBSSH2_SESSION_CONFIG_CHANNEL_WINDOW_SIZE 3 +#define LIBSSH2_SESSION_CONFIG_CHANNEL_PACKET_SIZE 4 +#define LIBSSH2_SESSION_CONFIG_TIMEOUT 5 +#define LIBSSH2_SESSION_CONFIG_BLOCKING 6 + +/* flags, obsolete */ +#define LIBSSH2_FLAG_SIGPIPE LIBSSH2_SESSION_CONFIG_SIGPIPE +#define LIBSSH2_FLAG_COMPRESS LIBSSH2_SESSION_CONFIG_COMPRESS typedef struct _LIBSSH2_SESSION LIBSSH2_SESSION; typedef struct _LIBSSH2_CHANNEL LIBSSH2_CHANNEL; @@ -503,8 +511,6 @@ LIBSSH2_API int libssh2_session_last_error(LIBSSH2_SESSION *session, LIBSSH2_API int libssh2_session_last_errno(LIBSSH2_SESSION *session); LIBSSH2_API int libssh2_session_block_directions(LIBSSH2_SESSION *session); -LIBSSH2_API int libssh2_session_flag(LIBSSH2_SESSION *session, int flag, - int value); LIBSSH2_API const char *libssh2_session_banner_get(LIBSSH2_SESSION *session); /* Userauth API */ @@ -738,17 +744,30 @@ libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel, #define libssh2_channel_window_write(channel) \ libssh2_channel_window_write_ex((channel), NULL) -LIBSSH2_API void libssh2_session_set_blocking(LIBSSH2_SESSION* session, - int blocking); -LIBSSH2_API int libssh2_session_get_blocking(LIBSSH2_SESSION* session); +LIBSSH2_API unsigned long libssh2_session_config_set(LIBSSH2_SESSION *session, + int key, unsigned long value); + +LIBSSH2_API unsigned long libssh2_session_config_get(LIBSSH2_SESSION *session, + int key); + +#define libssh2_session_set_blocking(session, blocking) \ + libssh2_session_config_set((session), LIBSSH2_SESSION_CONFIG_BLOCKING, (blocking)) + +#define libssh2_session_get_blocking(session) \ + libssh2_session_config_get((session), LIBSSH2_SESSION_CONFIG_BLOCKING) + +#define libssh2_session_set_timeout(session, timeout) \ + libssh2_session_config_set((session), LIBSSH2_SESSION_CONFIG_TIMEOUT, (timeout)) + +#define libssh2_session_get_timeout(session) \ + libssh2_session_config_get((session), LIBSSH2_SESSION_CONFIG_TIMEOUT) + +#define libssh2_session_flag(session, flag, value) \ + (libssh2_session_config_set((session), (flag), (value)), 1) LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel, int blocking); -LIBSSH2_API void libssh2_session_set_timeout(LIBSSH2_SESSION* session, - long timeout); -LIBSSH2_API long libssh2_session_get_timeout(LIBSSH2_SESSION* session); - /* libssh2_channel_handle_extended_data is DEPRECATED, do not use! */ LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode); diff --git a/src/channel.c b/src/channel.c index b208530..f5c6092 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1360,7 +1360,9 @@ LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL * channel, int blocking) { if(channel) - (void) _libssh2_session_set_blocking(channel->session, blocking); + (void) libssh2_session_config_set(channel->session, + LIBSSH2_SESSION_CONFIG_BLOCKING, + blocking); } /* diff --git a/src/session.c b/src/session.c index e00b132..769d5ed 100644 --- a/src/session.c +++ b/src/session.c @@ -1269,88 +1269,83 @@ libssh2_session_last_errno(LIBSSH2_SESSION * session) return session->err_code; } -/* libssh2_session_flag +/* libssh2_session_config_set * - * Set/Get session flags - * - * Return error code. + * Sets the configurable value for the given session setting. Returns + * the previous value. */ -LIBSSH2_API int -libssh2_session_flag(LIBSSH2_SESSION * session, int flag, int value) + +LIBSSH2_API unsigned long +libssh2_session_config_set(LIBSSH2_SESSION *session, int key, unsigned long value) { - switch(flag) { - case LIBSSH2_FLAG_SIGPIPE: - session->flag.sigpipe = value; + unsigned int old = 0; + switch (key) { + case LIBSSH2_SESSION_CONFIG_BLOCKING: + old = session->api_block_mode; + session->api_block_mode = (value ? 1: 0); + _libssh2_debug(session, LIBSSH2_TRACE_CONN, + "Setting blocking mode %s, was %s", + (value ? "ON" : "OFF"), + (old ? "ON" : "OFF") ); + break; + case LIBSSH2_SESSION_CONFIG_SIGPIPE: + old = session->flag.sigpipe; + session->flag.sigpipe = (value ? 1 : 0); + break; + case LIBSSH2_SESSION_CONFIG_COMPRESS: + old = session->flag.compress; + session->flag.compress = (value ? 1 : 0); break; - case LIBSSH2_FLAG_COMPRESS: - session->flag.compress = value; + case LIBSSH2_SESSION_CONFIG_CHANNEL_WINDOW_SIZE: + old = session->channel_window_size; + session->channel_window_size = value; + break; + case LIBSSH2_SESSION_CONFIG_CHANNEL_PACKET_SIZE: + old = session->channel_packet_size; + session->channel_packet_size = value; + break; + case LIBSSH2_SESSION_CONFIG_TIMEOUT: + old = session->api_timeout; + session->api_timeout = value; break; default: - /* unknown flag */ - return LIBSSH2_ERROR_INVAL; + old = 0; + _libssh2_debug(session, LIBSSH2_TRACE_CONN, + "Error, can't set config, unknown setting %d, value %lu", + key, value); } - - return LIBSSH2_ERROR_NONE; + return old; } -/* _libssh2_session_set_blocking - * - * Set a session's blocking mode on or off, return the previous status when - * this function is called. Note this function does not alter the state of the - * actual socket involved. +/* libssh2_session_config_get + * + * Returns the current value for the given session configurable + * setting */ -int -_libssh2_session_set_blocking(LIBSSH2_SESSION *session, int blocking) -{ - int bl = session->api_block_mode; - _libssh2_debug(session, LIBSSH2_TRACE_CONN, - "Setting blocking mode %s", blocking?"ON":"OFF"); - session->api_block_mode = blocking; - return bl; -} - -/* libssh2_session_set_blocking - * - * Set a channel's blocking mode on or off, similar to a socket's - * fcntl(fd, F_SETFL, O_NONBLOCK); type command - */ -LIBSSH2_API void -libssh2_session_set_blocking(LIBSSH2_SESSION * session, int blocking) +LIBSSH2_API unsigned long +libssh2_session_config_get(LIBSSH2_SESSION *session, int key) { - (void) _libssh2_session_set_blocking(session, blocking); -} - -/* libssh2_session_get_blocking - * - * Returns a session's blocking mode on or off - */ -LIBSSH2_API int -libssh2_session_get_blocking(LIBSSH2_SESSION * session) -{ - return session->api_block_mode; -} - - -/* libssh2_session_set_timeout - * - * Set a session's timeout (in msec) for blocking mode, - * or 0 to disable timeouts. - */ -LIBSSH2_API void -libssh2_session_set_timeout(LIBSSH2_SESSION * session, long timeout) -{ - session->api_timeout = timeout; -} - -/* libssh2_session_get_timeout - * - * Returns a session's timeout, or 0 if disabled - */ -LIBSSH2_API long -libssh2_session_get_timeout(LIBSSH2_SESSION * session) -{ - return session->api_timeout; + unsigned int old = 0; + switch (key) { + case LIBSSH2_SESSION_CONFIG_BLOCKING: + return session->api_block_mode; + case LIBSSH2_SESSION_CONFIG_SIGPIPE: + return session->flag.sigpipe; + case LIBSSH2_SESSION_CONFIG_COMPRESS: + return session->flag.compress; + case LIBSSH2_SESSION_CONFIG_CHANNEL_WINDOW_SIZE: + return session->channel_window_size; + case LIBSSH2_SESSION_CONFIG_CHANNEL_PACKET_SIZE: + return session->channel_packet_size; + case LIBSSH2_SESSION_CONFIG_TIMEOUT: + return session->api_timeout; + default: + _libssh2_debug(session, LIBSSH2_TRACE_CONN, + "Error, can't get config, unknown setting %d", + key); + return 0; + } } /* diff --git a/src/session.h b/src/session.h index aff4f2c..77aa4fa 100644 --- a/src/session.h +++ b/src/session.h @@ -87,7 +87,4 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t entry_time); -/* this is the lib-internal set blocking function */ -int _libssh2_session_set_blocking(LIBSSH2_SESSION * session, int blocking); - #endif /* LIBSSH2_SESSION_H */ -- 1.8.3.2 --------------050900060102030203010506 Content-Type: text/x-patch; name="0005-modify-examples-to-use-the-new-libssh2_session_confi.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0005-modify-examples-to-use-the-new-libssh2_session_confi.pa"; filename*1="tch" From 99c50ad042a968ef6a4a6bc27f97fc6835bc18c6 Mon Sep 17 00:00:00 2001 From: Salvador Fandino Date: Mon, 21 Oct 2013 17:22:10 +0200 Subject: [PATCH 5/5] modify examples to use the new libssh2_session_config_(set|get) functions Signed-off-by: Salvador Fandino --- example/direct_tcpip.c | 2 +- example/scp_nonblock.c | 2 +- example/scp_write_nonblock.c | 2 +- example/sftp.c | 2 +- example/sftp_RW_nonblock.c | 2 +- example/sftp_append.c | 2 +- example/sftp_mkdir.c | 2 +- example/sftp_mkdir_nonblock.c | 2 +- example/sftp_nonblock.c | 2 +- example/sftp_write.c | 2 +- example/sftp_write_nonblock.c | 2 +- example/sftp_write_sliding.c | 2 +- example/sftpdir.c | 2 +- example/sftpdir_nonblock.c | 2 +- example/ssh2_echo.c | 2 +- example/ssh2_exec.c | 2 +- example/tcpip-forward.c | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/example/direct_tcpip.c b/example/direct_tcpip.c index e530199..513219f 100644 --- a/example/direct_tcpip.c +++ b/example/direct_tcpip.c @@ -210,7 +210,7 @@ int main(int argc, char *argv[]) } /* Must use non-blocking IO hereafter due to the current libssh2 API */ - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); while (1) { FD_ZERO(&fds); diff --git a/example/scp_nonblock.c b/example/scp_nonblock.c index 5d636c0..eddaa9e 100644 --- a/example/scp_nonblock.c +++ b/example/scp_nonblock.c @@ -142,7 +142,7 @@ int main(int argc, char *argv[]) return -1; /* Since we have set non-blocking, tell libssh2 we are non-blocking */ - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); gettimeofday(&start, NULL); diff --git a/example/scp_write_nonblock.c b/example/scp_write_nonblock.c index 0ac0f69..5e5b76c 100644 --- a/example/scp_write_nonblock.c +++ b/example/scp_write_nonblock.c @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) return -1; /* Since we have set non-blocking, tell libssh2 we are non-blocking */ - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); /* ... start it up. This will trade welcome banners, exchange keys, * and setup crypto, compression, and MAC layers diff --git a/example/sftp.c b/example/sftp.c index 88ceba2..e963cdd 100644 --- a/example/sftp.c +++ b/example/sftp.c @@ -154,7 +154,7 @@ int main(int argc, char *argv[]) return -1; /* Since we have set non-blocking, tell libssh2 we are blocking */ - libssh2_session_set_blocking(session, 1); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 1); /* ... start it up. This will trade welcome banners, exchange keys, * and setup crypto, compression, and MAC layers diff --git a/example/sftp_RW_nonblock.c b/example/sftp_RW_nonblock.c index 77c2027..450f5e3 100644 --- a/example/sftp_RW_nonblock.c +++ b/example/sftp_RW_nonblock.c @@ -133,7 +133,7 @@ int main(int argc, char *argv[]) return -1; } - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); /* At this point we havn't yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app diff --git a/example/sftp_append.c b/example/sftp_append.c index 7585d38..e6a01bf 100644 --- a/example/sftp_append.c +++ b/example/sftp_append.c @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) return -1; /* Since we have set non-blocking, tell libssh2 we are blocking */ - libssh2_session_set_blocking(session, 1); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 1); /* ... start it up. This will trade welcome banners, exchange keys, * and setup crypto, compression, and MAC layers diff --git a/example/sftp_mkdir.c b/example/sftp_mkdir.c index 8747084..aae5790 100644 --- a/example/sftp_mkdir.c +++ b/example/sftp_mkdir.c @@ -141,7 +141,7 @@ int main(int argc, char *argv[]) } /* Since we have not set non-blocking, tell libssh2 we are blocking */ - libssh2_session_set_blocking(session, 1); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 1); /* Make a directory via SFTP */ rc = libssh2_sftp_mkdir(sftp_session, sftppath, diff --git a/example/sftp_mkdir_nonblock.c b/example/sftp_mkdir_nonblock.c index 22a8f59..e9cd3fe 100644 --- a/example/sftp_mkdir_nonblock.c +++ b/example/sftp_mkdir_nonblock.c @@ -142,7 +142,7 @@ int main(int argc, char *argv[]) } /* Since we have set non-blocking, tell libssh2 we are non-blocking */ - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); fprintf(stderr, "libssh2_sftp_mkdirnb()!\n"); /* Make a directory via SFTP */ diff --git a/example/sftp_nonblock.c b/example/sftp_nonblock.c index 29cec8a..d1de94b 100644 --- a/example/sftp_nonblock.c +++ b/example/sftp_nonblock.c @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) return -1; /* Since we have set non-blocking, tell libssh2 we are non-blocking */ - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); gettimeofday(&start, NULL); diff --git a/example/sftp_write.c b/example/sftp_write.c index 483f80a..da41a35 100644 --- a/example/sftp_write.c +++ b/example/sftp_write.c @@ -111,7 +111,7 @@ int main(int argc, char *argv[]) return -1; /* Since we have set non-blocking, tell libssh2 we are blocking */ - libssh2_session_set_blocking(session, 1); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 1); /* ... start it up. This will trade welcome banners, exchange keys, * and setup crypto, compression, and MAC layers diff --git a/example/sftp_write_nonblock.c b/example/sftp_write_nonblock.c index 0d66c40..ed90bf8 100644 --- a/example/sftp_write_nonblock.c +++ b/example/sftp_write_nonblock.c @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) return -1; /* Since we have set non-blocking, tell libssh2 we are non-blocking */ - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); /* ... start it up. This will trade welcome banners, exchange keys, * and setup crypto, compression, and MAC layers diff --git a/example/sftp_write_sliding.c b/example/sftp_write_sliding.c index c2ba39d..6a6731c 100644 --- a/example/sftp_write_sliding.c +++ b/example/sftp_write_sliding.c @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) return -1; /* Since we have set non-blocking, tell libssh2 we are non-blocking */ - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); /* ... start it up. This will trade welcome banners, exchange keys, * and setup crypto, compression, and MAC layers diff --git a/example/sftpdir.c b/example/sftpdir.c index cb9fb88..5c60459 100644 --- a/example/sftpdir.c +++ b/example/sftpdir.c @@ -162,7 +162,7 @@ int main(int argc, char *argv[]) } /* Since we have not set non-blocking, tell libssh2 we are blocking */ - libssh2_session_set_blocking(session, 1); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 1); fprintf(stderr, "libssh2_sftp_opendir()!\n"); /* Request a dir listing via SFTP */ diff --git a/example/sftpdir_nonblock.c b/example/sftpdir_nonblock.c index c8ad9f5..24cd4de 100644 --- a/example/sftpdir_nonblock.c +++ b/example/sftpdir_nonblock.c @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) return -1; /* Since we have set non-blocking, tell libssh2 we are non-blocking */ - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); /* ... start it up. This will trade welcome banners, exchange keys, * and setup crypto, compression, and MAC layers diff --git a/example/ssh2_echo.c b/example/ssh2_echo.c index 2430e33..7c6c663 100644 --- a/example/ssh2_echo.c +++ b/example/ssh2_echo.c @@ -133,7 +133,7 @@ int main(int argc, char *argv[]) return -1; /* tell libssh2 we want it all done non-blocking */ - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); /* ... start it up. This will trade welcome banners, exchange keys, * and setup crypto, compression, and MAC layers diff --git a/example/ssh2_exec.c b/example/ssh2_exec.c index d47761c..3a93a95 100644 --- a/example/ssh2_exec.c +++ b/example/ssh2_exec.c @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) return -1; /* tell libssh2 we want it all done non-blocking */ - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); /* ... start it up. This will trade welcome banners, exchange keys, * and setup crypto, compression, and MAC layers diff --git a/example/tcpip-forward.c b/example/tcpip-forward.c index 94d3cc8..dc90a30 100644 --- a/example/tcpip-forward.c +++ b/example/tcpip-forward.c @@ -211,7 +211,7 @@ int main(int argc, char *argv[]) remote_listenhost, remote_listenport, local_destip, local_destport); /* Must use non-blocking IO hereafter due to the current libssh2 API */ - libssh2_session_set_blocking(session, 0); + libssh2_session_config_set(session, LIBSSH2_SESSION_CONFIG_BLOCKING, 0); while (1) { FD_ZERO(&fds); -- 1.8.3.2 --------------050900060102030203010506 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 --------------050900060102030203010506-- From libssh2-devel-bounces@cool.haxx.se Mon Oct 21 19:32:08 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9LHVpHK005659; Mon, 21 Oct 2013 19:32:05 +0200 Received: from mail-vc0-x244.google.com (mail-vc0-x244.google.com [IPv6:2607:f8b0:400c:c03::244]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9LHVnGH005552 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Mon, 21 Oct 2013 19:31:50 +0200 Received: by mail-vc0-f196.google.com with SMTP id ht10so180695vcb.11 for ; Mon, 21 Oct 2013 10:31:44 -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=2aVJCQDTKrhu93mR2IhyjVjPmk/sg3sdaS+hLNBSlEE=; b=pJlsx56wy9MpS51boMPK2eMzbbRTqj2KwCB8RljEaxiZUxk0Qi1JK1TiRXZdteH0fy 1ih5pD+H4euJlrKpdg2wJcz69kQVld5G18UHXPwxcrB08ZCbPkSDNjWxRzjKx4wUec+L lVv0equ4X8Hz7MAEQjXk9/iNisckD5MIcsnY/LJsB0gtZEc8wY/IRG/1bvPogxMB5mhD 554nL52bD+7Au3eJ0XJLddD6empiI9q8ItybxZGUk7PpWv2tdS1gLDIjRNNcZ5B8Giy7 Sh9s6HcxWi6ym7Oq3QRwP4I/GTpNgHp7M72lgo3uBOHj6E6M2gNe4Z8O1LwEVilQTIIT qO2A== MIME-Version: 1.0 X-Received: by 10.220.184.70 with SMTP id cj6mr1861406vcb.23.1382376702896; Mon, 21 Oct 2013 10:31:42 -0700 (PDT) Received: by 10.58.213.74 with HTTP; Mon, 21 Oct 2013 10:31:42 -0700 (PDT) Date: Mon, 21 Oct 2013 18:31:42 +0100 Message-ID: Subject: Help with the user authentication banner. From: paul parker To: libssh2-devel@cool.haxx.se X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============0360538627==" Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" --===============0360538627== Content-Type: multipart/alternative; boundary=089e0141a44052707c04e943a8e8 --089e0141a44052707c04e943a8e8 Content-Type: text/plain; charset=ISO-8859-1 Hello, I'm new to libssh2 and was hoping I could get some help regarding receiving the user authentication banner. I have an ssh server with a banner enabled and configured in /etc/issue.net- however I am not sure how to retrieve this banner via libssh2? I've read through the API reference, and I cannot find any methods regarding this. I have a fully functional ssh implementation set up other than this, but I cannot seem to find any documentation regarding this banner/welcome message. I'm beginning to think that this is something that should be implemented by my own socket implementation rather than libssh2; hopefully someone can point me in the right direction. Thank you in advance. --089e0141a44052707c04e943a8e8 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hello,
I'm new to libssh2= and was hoping I could get some help regarding receiving the user authenti= cation banner.

I have an ssh server with a banner enabled and= configured in /etc/issue.net - however I = am not sure how to retrieve this banner via libssh2? I've read through = the API reference, and I cannot find any methods regarding this.

I have a fully functional ssh implementation set up other th= an this, but I cannot seem to find any documentation regarding this banner/= welcome message.

I'm beginning to think that th= is is something that should be implemented by my own socket implementation = rather than libssh2; hopefully someone can point me in the right direction.=

Thank you in advance.
--089e0141a44052707c04e943a8e8-- --===============0360538627== 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 --===============0360538627==-- From libssh2-devel-bounces@cool.haxx.se Tue Oct 22 04:39:38 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9M2d6N2001061; Tue, 22 Oct 2013 04:39:30 +0200 Received: from foo.stuge.se (qmailr@foo.stuge.se [212.116.89.98]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9M2d1xJ000900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 22 Oct 2013 04:39:01 +0200 Received: (qmail 4745 invoked by uid 501); 22 Oct 2013 02:38:59 -0000 Message-ID: <20131022023859.4744.qmail@stuge.se> Date: Tue, 22 Oct 2013 04:38:59 +0200 From: Peter Stuge To: libssh2-devel@cool.haxx.se Subject: Re: Using libssh2 1.4.3 is creating corrupt files. Mail-Followup-To: libssh2-devel@cool.haxx.se References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" Aaron, Aaron.Stokes@us.mahle.com wrote: > Buffer size change (we have no idea what the 33 was for, but it was > probably required in the old version) > -#define WRITEBUFFERSIZE (1024*32)-33 > +#define WRITEBUFFERSIZE 1024*128 Isn't this buffer size mandated by the SSH protocol? Did you look into what this define affects, to know if you are actually allowed to change that number at all? //Peter _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Tue Oct 22 12:02:38 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9MA2Ej5014366; Tue, 22 Oct 2013 12:02:32 +0200 Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9MA2CYt014359 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 22 Oct 2013 12:02:13 +0200 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VYYmy-0004Cy-5Y for libssh2-devel@cool.haxx.se; Tue, 22 Oct 2013 12:02:12 +0200 Received: from 92.56.140.52 ([92.56.140.52]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 22 Oct 2013 12:02:12 +0200 Received: from sfandino by 92.56.140.52 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 22 Oct 2013 12:02:12 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: libssh2-devel@cool.haxx.se From: =?ISO-8859-1?Q?Salvador_Fandi=F1o?= Subject: Re: Help with the user authentication banner. Date: Tue, 22 Oct 2013 12:02:01 +0200 Lines: 29 Message-ID: References: Mime-Version: 1.0 X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 92.56.140.52 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On 10/21/2013 07:31 PM, paul parker wrote: > Hello, > I'm new to libssh2 and was hoping I could get some help regarding > receiving the user authentication banner. > > I have an ssh server with a banner enabled and configured in > /etc/issue.net - however I am not sure how to > retrieve this banner via libssh2? I've read through the API reference, > and I cannot find any methods regarding this. > > I have a fully functional ssh implementation set up other than this, but > I cannot seem to find any documentation regarding this banner/welcome > message. grep'ing over libssh2 code for SSH_MSG_USERAUTH_BANNER reveals that authentication banners are not currently handled by the library. > I'm beginning to think that this is something that should be implemented > by my own socket implementation rather than libssh2; hopefully someone > can point me in the right direction. You can't do it that way as the authentication banner is transferred over the encrypted connection. The right way to do that is probably to add code to handle msgs pf type SSH_MSG_USERAUTH_BANNER into the _libssh2_packet_add function, in packet.c. It may store the banner data in some internal variable or invoke some callback, etc. _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Wed Oct 23 11:44:56 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9N9iSb9016267; Wed, 23 Oct 2013 11:44:50 +0200 Received: from mail-ve0-x22b.google.com (mail-ve0-x22b.google.com [IPv6:2607:f8b0:400c:c01::22b]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9N9iQJ2016195 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Wed, 23 Oct 2013 11:44:26 +0200 Received: by mail-ve0-f171.google.com with SMTP id c14so347010vea.30 for ; Wed, 23 Oct 2013 02:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=CW20b1i+KMkC8r/kHAFp7ZYkicXs0QE7i/RHQye+iDA=; b=WPLxYfsF3r/Qgc5BGFhb5AXIvwJB6ZhvzwWGj4Vu4yHdBJbEhm9uq1Y+lDiJ7Xhsat abw+BcJdcfu0YjcJsd7zRTlC6yGYdabiZ01RJA9DuBSjbQZxzLlwhvsz7KLvxaObilhu 7HaI98IddZmRwnvVzgrngJQqSnKD7NejR/phWJ0NQxOAE6LWSiB6WgjnmEI3gd8uZ0Tr CqZNGk/Ay79nbwSgMzvJl4Sdyl4Zdc8WeV/UeznAUMagLodAKyaKPFj8sYTRw/5ctAMV WfvmBrNSaJg4xwm+1nG6VQVjHO/AAtETXthATPpbQC0GQEQJKLJH3cCREm280MY6brKU sHGA== MIME-Version: 1.0 X-Received: by 10.52.119.228 with SMTP id kx4mr324708vdb.12.1382521459922; Wed, 23 Oct 2013 02:44:19 -0700 (PDT) Received: by 10.52.106.133 with HTTP; Wed, 23 Oct 2013 02:44:19 -0700 (PDT) In-Reply-To: <20131022023859.4744.qmail@stuge.se> References: <20131022023859.4744.qmail@stuge.se> Date: Wed, 23 Oct 2013 10:44:19 +0100 X-Google-Sender-Auth: KECXqY55duOFbmVCRylEhzNAmjc Message-ID: Subject: Re: Using libssh2 1.4.3 is creating corrupt files. From: Alexander Lamaison To: libssh2 development X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" On 22 October 2013 03:38, Peter Stuge wrote: > Aaron, > > Aaron.Stokes@us.mahle.com wrote: >> Buffer size change (we have no idea what the 33 was for, but it was >> probably required in the old version) >> -#define WRITEBUFFERSIZE (1024*32)-33 >> +#define WRITEBUFFERSIZE 1024*128 > > Isn't this buffer size mandated by the SSH protocol? > > Did you look into what this define affects, to know if you are > actually allowed to change that number at all? If this just defines the size of the buffer he passes to something like libssh2_sftp_write, he should be able to set the buffer to any size he likes. Nothing is mandated by the protocol here. Or, at least, anything that is is handled by libssh2 internally. Alex -- Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org) _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Wed Oct 23 15:00:33 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9ND09TJ005025; Wed, 23 Oct 2013 15:00:28 +0200 Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9ND08M7004874 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 23 Oct 2013 15:00:08 +0200 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VYy2e-00074K-IX for libssh2-devel@cool.haxx.se; Wed, 23 Oct 2013 15:00:04 +0200 Received: from 92.56.140.52 ([92.56.140.52]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Oct 2013 15:00:04 +0200 Received: from sfandino by 92.56.140.52 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Oct 2013 15:00:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: libssh2-devel@cool.haxx.se From: =?ISO-8859-1?Q?Salvador_Fandi=F1o?= Subject: Re: Using libssh2 1.4.3 is creating corrupt files. Date: Wed, 23 Oct 2013 14:59:52 +0200 Lines: 25 Message-ID: References: <20131022023859.4744.qmail@stuge.se> Mime-Version: 1.0 X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 92.56.140.52 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On 10/23/2013 11:44 AM, Alexander Lamaison wrote: > On 22 October 2013 03:38, Peter Stuge wrote: >> Aaron, >> >> Aaron.Stokes@us.mahle.com wrote: >>> Buffer size change (we have no idea what the 33 was for, but it was >>> probably required in the old version) >>> -#define WRITEBUFFERSIZE (1024*32)-33 >>> +#define WRITEBUFFERSIZE 1024*128 >> >> Isn't this buffer size mandated by the SSH protocol? >> >> Did you look into what this define affects, to know if you are >> actually allowed to change that number at all? > > If this just defines the size of the buffer he passes to something > like libssh2_sftp_write, he should be able to set the buffer to any > size he likes. Nothing is mandated by the protocol here. Or, at > least, anything that is is handled by libssh2 internally. The manual page for libssh2_sftp_write talks about the "write ahead" feature introduced in version 1.2.8 which looks really suspicious for this case. _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Thu Oct 24 21:45:28 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9OJj2ce012023; Thu, 24 Oct 2013 21:45:23 +0200 Received: from earth.stuge.se (earth.stuge.se [212.116.89.126]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9OJj0cX011410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 24 Oct 2013 21:45:00 +0200 Received: (qmail 4676 invoked from network); 24 Oct 2013 19:44:04 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 24 Oct 2013 19:44:04 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: sfandino@yahoo.com, awl03@doc.ic.ac.uk, daniel@haxx.se X-Trac-Project: libssh2 Date: Thu, 24 Oct 2013 19:44:04 -0000 X-URL: https://trac.libssh2.org/ Subject: Re: [libssh2] #276: do not fail when keys of unknown type are read from known_hosts file X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/276#comment:4 Message-ID: <057.e7d4d4605ab1c39a6ce16e65b738f1a1@libssh2.stuge.se> References: <042.310bff264790ea0eb774c869a2913cb7@libssh2.stuge.se> X-Trac-Ticket-ID: 276 In-Reply-To: <042.310bff264790ea0eb774c869a2913cb7@libssh2.stuge.se> X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r9OJj0cX011410 Cc: libssh2-devel@cool.haxx.se X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Reply-To: trac@libssh2.stuge.se, libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #276: do not fail when keys of unknown type are read from known_hosts file ---------------------+------------------- Reporter: salva | Owner: Type: defect | Status: new Priority: normal | Milestone: 1.4.3 Component: misc | Version: 1.4.2 Resolution: | Keywords: Blocked By: | Blocks: ---------------------+------------------- Comment (by salva): I have uploaded a new patch containing all the changes. -- Ticket URL: libssh2 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 Sun Oct 27 10:47:54 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9R9lVNV007074; Sun, 27 Oct 2013 10:47:50 +0100 Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9R9lT4o007029 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 27 Oct 2013 10:47:29 +0100 Received: from localhost (dast@localhost) by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r9R9lTKR007024 for ; Sun, 27 Oct 2013 10:47:29 +0100 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Sun, 27 Oct 2013 10:47:29 +0100 (CET) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: Re: [PATCH] Added Windows Cryptography API: Next Generation backend In-Reply-To: <525A8106.40603@marc-hoersken.de> Message-ID: References: <20130601231229.11420.qmail@stuge.se> <20130602175922.5525.qmail@stuge.se> <523EA678.8010707@marc-hoersken.de> <20130922151824.23037.qmail@stuge.se> <525A8106.40603@marc-hoersken.de> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) X-fromdanielhimself: yes MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="1129329158-5321505-1382867201=:15605" Content-ID: X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1129329158-5321505-1382867201=:15605 Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-15; FORMAT=flowed Content-Transfer-Encoding: 8BIT Content-ID: On Sun, 13 Oct 2013, Marc Hörsken wrote: >>> I wanted to send you a new patch in order to get an idea. > > any update on your changes yet? What is the state of the Windows Cryptography backend right now? I do want to get back to the release track and I'd prefer to do that without getting stabbed in the back by Peter again. -- / daniel.haxx.se --1129329158-5321505-1382867201=:15605 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel --1129329158-5321505-1382867201=:15605-- From libssh2-devel-bounces@cool.haxx.se Sun Oct 27 10:58:13 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9R9w8AY021452; Sun, 27 Oct 2013 10:58:12 +0100 Received: from earth.stuge.se (earth.stuge.se [212.116.89.126]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9R9w5Cq021417 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sun, 27 Oct 2013 10:58:05 +0100 Received: (qmail 23873 invoked from network); 27 Oct 2013 09:57:11 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 27 Oct 2013 09:57:11 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Cc: libssh2-devel@cool.haxx.se Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software X-Trac-Project: libssh2 Date: Sun, 27 Oct 2013 09:57:11 -0000 X-URL: https://trac.libssh2.org/ Subject: Re: [libssh2] #276: do not fail when keys of unknown type are read from known_hosts file X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/276#comment:5 Message-ID: <057.3c8c4905794cb9b849428ce33a3a2419@libssh2.stuge.se> References: <042.310bff264790ea0eb774c869a2913cb7@libssh2.stuge.se> X-Trac-Ticket-ID: 276 In-Reply-To: <042.310bff264790ea0eb774c869a2913cb7@libssh2.stuge.se> X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r9R9w5Cq021417 X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Reply-To: trac@libssh2.stuge.se, libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #276: do not fail when keys of unknown type are read from known_hosts file ---------------------+-------------------- Reporter: salva | Owner: salva Type: defect | Status: closed Priority: normal | Milestone: 1.4.3 Component: misc | Version: 1.4.2 Resolution: fixed | Keywords: Blocked By: | Blocks: ---------------------+-------------------- Changes (by salva): * owner: => salva * status: new => closed * resolution: => fixed Comment: In [changeset:"85c6627c861e970ba0bab10ec8b44b6523d6a5fd/libssh2"]: {{{ #!CommitTicketReference repository="libssh2" revision="85c6627c861e970ba0bab10ec8b44b6523d6a5fd" knownhosts: handle unknown key types Store but don't use keys of unsupported types on the known_hosts file. Currently, when libssh2 parses a known_host file containing keys of some type it doesn't natively support, it stops reading the file and returns an error. That means, that the known_host file can not be safely shared with other software supporting other key types (i.e. OpenSSH). This patch adds support for handling keys of unknown type. It can read and write them, even if they are never going to be matched. At the source level the patch does the following things: - add a new unknown key type LIBSSH2_KNOWNHOST_KEY_UNKNOWN - add a new slot (key_type_name) on the known_host struct that is used to store the key type in ascii form when it is not supported - parse correctly known_hosts entries with unknown key types and populate the key_type_name slot - print correctly known_hosts entries of unknown type - when checking a host key ignore keys that do not match the key Fixes #276 }}} -- Ticket URL: libssh2 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 Sun Oct 27 15:32:42 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9REWFeo031425; Sun, 27 Oct 2013 15:32:35 +0100 Received: from giant.haxx.se (dast@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9REWEKm031376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 27 Oct 2013 15:32:14 +0100 Received: from localhost (dast@localhost) by giant.haxx.se (8.14.4/8.14.4/Submit) with ESMTP id r9REWEpJ031372 for ; Sun, 27 Oct 2013 15:32:14 +0100 X-Authentication-Warning: giant.haxx.se: dast owned process doing -bs Date: Sun, 27 Oct 2013 15:32:14 +0100 (CET) From: Daniel Stenberg X-X-Sender: dast@giant.haxx.se To: libssh2 development Subject: Re: [PATCH] Honour window_size_initial from _libssh2_channel_read In-Reply-To: <52654E93.2080608@yahoo.com> Message-ID: References: <525F21A7.5010209@yahoo.com> <525FFB74.9050807@yahoo.com> <52654E93.2080608@yahoo.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.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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" On Mon, 21 Oct 2013, Salvador Fandino wrote: > The most controversial change is the way those new parameters are set as I > have added a new unified interface for setting/retrieving all the session > parameters "libssh2_session_config_(set|get)" and deprecated > "libssh2_session_flag" and "libssh2_session_(set|get)_(timeout|blocking)". A > more detailed explanation is on the commit message. We did have a discussion before (although I didn't actually bother to try to find any links to it right now), about what the best API for this kind of things is, and we then decided on the libssh2_session_(set|get)_[what] approach. So, I don't think we should deprecate these functions but I'm open for adding new ones for setting/getting other options and values. > The alternative would be to use a pair of functions to set/get every > parameter. I don't have a strong preference for one way or the other. My > only point is that the API should be consistent in the way those accessors > work. I agree that moving everything over to a single consistent way is preferable and makes it easier for newcomers to find out how to do things. > In any case, IMO, patches 1 an 2 can be applied right now as they implement > changes we have already discussed. They've been merged and pushed now. thanks! -- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Mon Oct 28 18:55:38 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9SHtAI8005318; Mon, 28 Oct 2013 18:55:30 +0100 Received: from thor.qindel.com (smtp.qindel.com [89.140.90.34]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9SHt8kH004551 for ; Mon, 28 Oct 2013 18:55:08 +0100 Received: from localhost (localhost [127.0.0.1]) by thor.qindel.com (Postfix) with ESMTP id 7EB0668F4 for ; Mon, 28 Oct 2013 18:54:55 +0100 (CET) Received: from thor.qindel.com ([127.0.0.1]) by localhost (thor.qindel.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id S0WgaWRSEdEF for ; Mon, 28 Oct 2013 18:54:54 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by thor.qindel.com (Postfix) with ESMTP id 4B93968F5 for ; Mon, 28 Oct 2013 18:54:54 +0100 (CET) X-Virus-Scanned: amavisd-new at thor.qindel.com Received: from thor.qindel.com ([127.0.0.1]) by localhost (thor.qindel.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id U51yDfUfwPtQ for ; Mon, 28 Oct 2013 18:54:54 +0100 (CET) Received: from [172.26.8.242] (sfandino.qindel.com [172.26.8.242]) by thor.qindel.com (Postfix) with ESMTPSA id 21E7B68F4 for ; Mon, 28 Oct 2013 18:54:54 +0100 (CET) Message-ID: <526EA4F5.6050702@yahoo.com> Date: Mon, 28 Oct 2013 18:55:01 +0100 From: Salvador Fandino User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: libssh2-devel@cool.haxx.se Subject: Re: [PATCH] Honour window_size_initial from _libssh2_channel_read References: <525F21A7.5010209@yahoo.com> <525FFB74.9050807@yahoo.com> <52654E93.2080608@yahoo.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------010707000400070000020401" X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Precedence: list Reply-To: libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" This is a multi-part message in MIME format. --------------010707000400070000020401 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 10/27/2013 03:32 PM, Daniel Stenberg wrote: > On Mon, 21 Oct 2013, Salvador Fandino wrote: > >> The most controversial change is the way those new parameters are set >> as I have added a new unified interface for setting/retrieving all the >> session parameters "libssh2_session_config_(set|get)" and deprecated >> "libssh2_session_flag" and >> "libssh2_session_(set|get)_(timeout|blocking)". A more detailed >> explanation is on the commit message. > > We did have a discussion before (although I didn't actually bother to > try to find any links to it right now), about what the best API for this > kind of things is, and we then decided on the > libssh2_session_(set|get)_[what] approach. > > So, I don't think we should deprecate these functions but I'm open for > adding new ones for setting/getting other options and values. Here there is a new version of the patches adding the channel_window_size and channel_packet_size slots into the session object and the corresponding accessors as separate functions. --------------010707000400070000020401 Content-Type: text/x-patch; name="0001-Set-channel-window-and-packet-size-from-configurable.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Set-channel-window-and-packet-size-from-configurable.pa"; filename*1="tch" From d4e179748eed7761a9878670a6147502f44a7cd0 Mon Sep 17 00:00:00 2001 From: Salvador Fandino Date: Mon, 21 Oct 2013 12:59:02 +0200 Subject: [PATCH 1/2] Set channel window and packet size from configurable values on the session object Currently, the channel and packet window sizes can only be configured when "libssh2_channel_open_ex" is used to create the channel. Unfortunatelly this is not always an option. For instance, for some channel types (i.e. tcp-ip) a different function must be used; in other cases, the channel is not created explicitly by the user. This patch adds two new slots into the session structure to store the default window and packet sizes. Every channel created in this session will use these values by default (unless a set of different ones are explicitly set). A new pair of constants (LIBSSH2_CHANNEL_WINDOW_CONFIGURED and LIBSSH2_CHANNEL_PACKET_CONFIGURED) are also defined. These can be used on function calls were the packet and/or window size are passed to indicate that the configured values are to be used. Note that this patch does not introduce any way to set or change the values on the session object yet. Signed-off-by: Salvador Fandino --- include/libssh2.h | 6 ++++-- src/channel.c | 10 ++++++++-- src/libssh2_priv.h | 4 ++++ src/packet.c | 14 ++++++++------ src/session.c | 2 ++ 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/include/libssh2.h b/include/libssh2.h index 3cb2be5..08321c4 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -594,7 +594,9 @@ LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, /* Channel API */ #define LIBSSH2_CHANNEL_WINDOW_DEFAULT (2*1024*1024) +#define LIBSSH2_CHANNEL_WINDOW_CONFIGURED (~(unsigned int)0) #define LIBSSH2_CHANNEL_PACKET_DEFAULT 32768 +#define LIBSSH2_CHANNEL_PACKET_CONFIGURED (~(unsigned int)0) #define LIBSSH2_CHANNEL_MINADJUST 1024 /* Extended Data Handling */ @@ -615,8 +617,8 @@ libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *channel_type, #define libssh2_channel_open_session(session) \ libssh2_channel_open_ex((session), "session", sizeof("session") - 1, \ - LIBSSH2_CHANNEL_WINDOW_DEFAULT, \ - LIBSSH2_CHANNEL_PACKET_DEFAULT, NULL, 0) + LIBSSH2_CHANNEL_WINDOW_CONFIGURED, \ + LIBSSH2_CHANNEL_PACKET_CONFIGURED, NULL, 0) LIBSSH2_API LIBSSH2_CHANNEL * libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, const char *host, diff --git a/src/channel.c b/src/channel.c index d6bfb98..b208530 100644 --- a/src/channel.c +++ b/src/channel.c @@ -154,6 +154,12 @@ _libssh2_channel_open(LIBSSH2_SESSION * session, const char *channel_type, memset(&session->open_packet_requirev_state, 0, sizeof(session->open_packet_requirev_state)); + if (window_size == LIBSSH2_CHANNEL_WINDOW_CONFIGURED) + window_size = session->channel_window_size; + + if (packet_size == LIBSSH2_CHANNEL_PACKET_CONFIGURED) + packet_size = session->channel_packet_size; + _libssh2_debug(session, LIBSSH2_TRACE_CONN, "Opening Channel - win %d pack %d", window_size, packet_size); @@ -375,8 +381,8 @@ channel_direct_tcpip(LIBSSH2_SESSION * session, const char *host, channel = _libssh2_channel_open(session, "direct-tcpip", sizeof("direct-tcpip") - 1, - LIBSSH2_CHANNEL_WINDOW_DEFAULT, - LIBSSH2_CHANNEL_PACKET_DEFAULT, + session->channel_window_size, + session->channel_packet_size, session->direct_message, session->direct_message_len); diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index 461d14c..af09df7 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -638,6 +638,10 @@ struct _LIBSSH2_SESSION void* tracehandler_context; /* context for the trace handler */ #endif + /* configurable values */ + uint32_t channel_window_size; + uint32_t channel_packet_size; + /* State variables used in libssh2_banner_send() */ libssh2_nonblocking_states banner_TxRx_state; char banner_TxRx_banner[256]; diff --git a/src/packet.c b/src/packet.c index 47bbf2b..94df7bf 100644 --- a/src/packet.c +++ b/src/packet.c @@ -172,11 +172,11 @@ packet_queue_listener(LIBSSH2_SESSION * session, unsigned char *data, channel->remote.id = listen_state->sender_channel; channel->remote.window_size_initial = - LIBSSH2_CHANNEL_WINDOW_DEFAULT; + session->channel_window_size; channel->remote.window_size = - LIBSSH2_CHANNEL_WINDOW_DEFAULT; + session->channel_window_size; channel->remote.packet_size = - LIBSSH2_CHANNEL_PACKET_DEFAULT; + session->channel_packet_size; channel->local.id = _libssh2_channel_nextid(session); channel->local.window_size_initial = @@ -323,9 +323,11 @@ packet_x11_open(LIBSSH2_SESSION * session, unsigned char *data, channel->remote.id = x11open_state->sender_channel; channel->remote.window_size_initial = - LIBSSH2_CHANNEL_WINDOW_DEFAULT; - channel->remote.window_size = LIBSSH2_CHANNEL_WINDOW_DEFAULT; - channel->remote.packet_size = LIBSSH2_CHANNEL_PACKET_DEFAULT; + session->channel_window_size; + channel->remote.window_size = + session->channel_window_size; + channel->remote.packet_size = + session->channel_packet_size; channel->local.id = _libssh2_channel_nextid(session); channel->local.window_size_initial = diff --git a/src/session.c b/src/session.c index 9838d2b..e00b132 100644 --- a/src/session.c +++ b/src/session.c @@ -493,6 +493,8 @@ libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)), session->send = _libssh2_send; session->recv = _libssh2_recv; session->abstract = abstract; + session->channel_window_size = LIBSSH2_CHANNEL_WINDOW_DEFAULT; + session->channel_packet_size = LIBSSH2_CHANNEL_PACKET_DEFAULT; session->api_timeout = 0; /* timeout-free API by default */ session->api_block_mode = 1; /* blocking API by default */ _libssh2_debug(session, LIBSSH2_TRACE_TRANS, -- 1.8.3.2 --------------010707000400070000020401 Content-Type: text/x-patch; name="0002-Add-libssh2_session_-set-get-_channel_-window-packet.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0002-Add-libssh2_session_-set-get-_channel_-window-packet.pa"; filename*1="tch" From c1960226335967d34518e9c86d53064b28d68522 Mon Sep 17 00:00:00 2001 From: Salvador Fandino Date: Mon, 28 Oct 2013 16:31:30 +0100 Subject: [PATCH 2/2] Add libssh2_session_(set|get)_channel_(window|packet)_size accessors Add accessors for the session "channel_window_size" and "channel_packet_size" slots which are used to initialize new channels. Add also manual pages for them. Signed-off-by: Salvador Fandino --- docs/Makefile.am | 4 +++ docs/libssh2_session_get_channel_packet_size.3 | 24 ++++++++++++++ docs/libssh2_session_get_channel_window_size.3 | 22 ++++++++++++ docs/libssh2_session_set_channel_packet_size.3 | 24 ++++++++++++++ docs/libssh2_session_set_channel_window_size.3 | 39 ++++++++++++++++++++++ include/libssh2.h | 11 ++++++ src/session.c | 46 ++++++++++++++++++++++++++ 7 files changed, 170 insertions(+) create mode 100644 docs/libssh2_session_get_channel_packet_size.3 create mode 100644 docs/libssh2_session_get_channel_window_size.3 create mode 100644 docs/libssh2_session_set_channel_packet_size.3 create mode 100644 docs/libssh2_session_set_channel_window_size.3 diff --git a/docs/Makefile.am b/docs/Makefile.am index e6ab394..7db2ec1 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -101,6 +101,8 @@ dist_man_MANS = \ libssh2_session_flag.3 \ libssh2_session_free.3 \ libssh2_session_get_blocking.3 \ + libssh2_session_get_channel_packet_size.3 \ + libssh2_session_get_channel_window_size.3 \ libssh2_session_get_timeout.3 \ libssh2_session_hostkey.3 \ libssh2_session_init.3 \ @@ -110,6 +112,8 @@ dist_man_MANS = \ libssh2_session_method_pref.3 \ libssh2_session_methods.3 \ libssh2_session_set_blocking.3 \ + libssh2_session_set_channel_packet_size.3 \ + libssh2_session_set_channel_window_size.3 \ libssh2_session_set_timeout.3 \ libssh2_session_startup.3 \ libssh2_session_supported_algs.3 \ diff --git a/docs/libssh2_session_get_channel_packet_size.3 b/docs/libssh2_session_get_channel_packet_size.3 new file mode 100644 index 0000000..ae6f67b --- /dev/null +++ b/docs/libssh2_session_get_channel_packet_size.3 @@ -0,0 +1,24 @@ +.TH libssh2_session_get_channel_packet_size 3 "28 Oct 2013" "libssh2 1.4.4" "libssh2 manual" +.SH NAME +libssh2_session_get_channel_packet_size - get default channel packet size for new channels +.SH SYNOPSIS +#include + +unsigned long +libssh2_session_get_channel_packet_size(LIBSSH2_SESSION *session); + +.SH DESCRIPTION +This function returns the maximum packet size used as the default when +new channels created over the given session are initialized. + +.SH RETURN VALUE +Returns the current default maximum packet size. + +.SH AVAILABILITY +This function has been available since version 1.4.4. + +.SH SEE ALSO + +.BR libssh2_session_set_channel_packet_size(3) + +RFC 4253, chapter 6.1. diff --git a/docs/libssh2_session_get_channel_window_size.3 b/docs/libssh2_session_get_channel_window_size.3 new file mode 100644 index 0000000..4bf5513 --- /dev/null +++ b/docs/libssh2_session_get_channel_window_size.3 @@ -0,0 +1,22 @@ +.TH libssh2_session_get_channel_window_size 3 "28 Oct 2013" "libssh2 1.4.4" "libssh2 manual" +.SH NAME +libssh2_session_get_channel_window_size - get default channel window size for new channels +.SH SYNOPSIS +#include + +unsigned long +libssh2_session_get_channel_window_size(LIBSSH2_SESSION *session); + +.SH DESCRIPTION +This function returns the window size used as the default when new +channels created over the given session are initialized. + +.SH RETURN VALUE +Returns the current default channel window size. + +.SH AVAILABILITY +This function has been available since version 1.4.4. + +.SH SEE ALSO + +.BR libssh2_session_set_channel_window_size(3) diff --git a/docs/libssh2_session_set_channel_packet_size.3 b/docs/libssh2_session_set_channel_packet_size.3 new file mode 100644 index 0000000..dd4d208 --- /dev/null +++ b/docs/libssh2_session_set_channel_packet_size.3 @@ -0,0 +1,24 @@ +.TH libssh2_session_set_channel_packet_size 3 "28 Oct 2013" "libssh2 1.4.4" "libssh2 manual" +.SH NAME +libssh2_session_set_channel_packet_size - set default channel packet size for new channels +.SH SYNOPSIS +#include + +unsigned long +libssh2_session_set_channel_packet_size(LIBSSH2_SESSION *session, unsigned long size); + +.SH DESCRIPTION +This function sets the maximum packet size used as the default when +new channels created over the given session are initialized. + +.SH RETURN VALUE +Returns the new maximum packet size. + +.SH AVAILABILITY +This function has been available since version 1.4.4. + +.SH SEE ALSO + +.BR libssh2_session_get_channel_packet_size(3) + +RFC 4253, chapter 6.1. diff --git a/docs/libssh2_session_set_channel_window_size.3 b/docs/libssh2_session_set_channel_window_size.3 new file mode 100644 index 0000000..7522007 --- /dev/null +++ b/docs/libssh2_session_set_channel_window_size.3 @@ -0,0 +1,39 @@ +.TH libssh2_session_set_channel_window_size 3 "28 Oct 2013" "libssh2 1.4.4" "libssh2 manual" +.SH NAME +libssh2_session_set_channel_window_size - get default channel window size for new channels +.SH SYNOPSIS +#include + +unsigned long +libssh2_session_set_channel_window_size(LIBSSH2_SESSION *session, unsigned long size); + +.SH DESCRIPTION +This function sets the window size used as the default when new +channels created over the given session are initialized. + +The window size determines the maximum amount of data that can be +flying from the server to the client at any moment, without being +acknowledged by the client, before the channel blocks. + +A value too small limits the throughput of the channel. A value too +big will waste the client memory in useless buffers. + +As of version 1.4.4 of libssh2 the default window size value +(LIBSSH2_CHANNEL_WINDOW_DEFAULT) is 2MB which, in our opinion, +represents a good compromise between transfer speed and memory usage +for today real-life networks. + +Note that every channel has its own window/buffers. Also, if +compression is enabled, additional memory would be wasted due to the +impossibility to accurately predict the size of the inflated packets a +priori. + +.SH RETURN VALUE +Returns the new default channel window size. + +.SH AVAILABILITY +This function has been available since version 1.4.4. + +.SH SEE ALSO + +.BR libssh2_session_get_channel_window_size(3) diff --git a/include/libssh2.h b/include/libssh2.h index 08321c4..03c4712 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -748,6 +748,17 @@ LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel, LIBSSH2_API void libssh2_session_set_timeout(LIBSSH2_SESSION* session, long timeout); LIBSSH2_API long libssh2_session_get_timeout(LIBSSH2_SESSION* session); + +LIBSSH2_API unsigned long +libssh2_session_set_channel_window_size(LIBSSH2_SESSION *session, + unsigned long size); +LIBSSH2_API unsigned long +libssh2_session_get_channel_window_size(LIBSSH2_SESSION *session); +LIBSSH2_API unsigned long +libssh2_session_set_channel_packet_size(LIBSSH2_SESSION *session, + unsigned long size); +LIBSSH2_API unsigned long +libssh2_session_get_channel_packet_size(LIBSSH2_SESSION *session); /* libssh2_channel_handle_extended_data is DEPRECATED, do not use! */ LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel, diff --git a/src/session.c b/src/session.c index e00b132..9bc7852 100644 --- a/src/session.c +++ b/src/session.c @@ -1353,6 +1353,52 @@ libssh2_session_get_timeout(LIBSSH2_SESSION * session) return session->api_timeout; } +/* libssh2_session_set_channel_window_size + * + * Sets the default window size for new channels created over the + * given session. + */ +LIBSSH2_API unsigned long +libssh2_session_set_channel_window_size(LIBSSH2_SESSION *session, + unsigned long size) +{ + return session->channel_window_size = size; +} + +/* libssh2_session_set_channel_window_size + * + * Gets the default window size for new channels created over the + * given session. + */ +LIBSSH2_API unsigned long +libssh2_session_get_channel_window_size(LIBSSH2_SESSION *session) +{ + return session->channel_window_size; +} + +/* libssh2_session_set_channel_packet_size + * + * Sets the default maximum packet size for channels created over the + * given session. + */ +LIBSSH2_API unsigned long +libssh2_session_set_channel_packet_size(LIBSSH2_SESSION *session, + unsigned long size) +{ + return session->channel_packet_size = size; +} + +/* libssh2_session_set_channel_packet_size + * + * Gets the default maximum packet size for channels created over the + * given session. + */ +LIBSSH2_API unsigned long +libssh2_session_get_channel_packet_size(LIBSSH2_SESSION *session) +{ + return session->channel_packet_size; +} + /* * libssh2_poll_channel_read * -- 1.8.3.2 --------------010707000400070000020401 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 --------------010707000400070000020401-- From libssh2-devel-bounces@cool.haxx.se Tue Oct 29 02:24:12 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9T1O8G9004243; Tue, 29 Oct 2013 02:24:11 +0100 Received: from earth.stuge.se (earth.stuge.se [212.116.89.126]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9T1O6qv004222 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 29 Oct 2013 02:24:07 +0100 Received: (qmail 1306 invoked from network); 29 Oct 2013 01:23:13 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 29 Oct 2013 01:23:13 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: hello@gregoirenoyelle.com, awl03@doc.ic.ac.uk X-Trac-Project: libssh2 Date: Tue, 29 Oct 2013 01:23:13 -0000 X-URL: https://trac.libssh2.org/ Subject: Re: [libssh2] #278: Make Update with WordPress X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/278#comment:1 Message-ID: <060.144d58733d54d6af84081cb1830ff4ce@libssh2.stuge.se> References: <045.56d8186020b809eda279c9621b8e48db@libssh2.stuge.se> X-Trac-Ticket-ID: 278 In-Reply-To: <045.56d8186020b809eda279c9621b8e48db@libssh2.stuge.se> X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r9T1O6qv004222 Cc: libssh2-devel@cool.haxx.se X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Reply-To: trac@libssh2.stuge.se, libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #278: Make Update with WordPress -----------------------+------------------------------ Reporter: gnoyelle | Owner: Type: defect | Status: closed Priority: normal | Milestone: 1.4.3 Component: misc | Version: 1.4.2 Resolution: invalid | Keywords: WordPress,update Blocked By: | Blocks: -----------------------+------------------------------ Changes (by alamaison): * status: new => closed * resolution: => invalid Comment: This is not the correct place to seek support. Please direct queries to the [http://www.libssh2.org/mail.cgi mailing list] and use this tracker to report bugs and suggest new features. -- Ticket URL: libssh2 C library for writing portable SSH2 clients _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel From libssh2-devel-bounces@cool.haxx.se Tue Oct 29 02:34:26 2013 Return-Path: Received: from www.haxx.se (list@localhost.localdomain [127.0.0.1]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9T1L8L0002651; Tue, 29 Oct 2013 02:21:57 +0100 Received: from earth.stuge.se (earth.stuge.se [212.116.89.126]) by giant.haxx.se (8.14.4/8.14.4/Debian-4.1) with ESMTP id r9T1L4jp002502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Tue, 29 Oct 2013 02:21:04 +0100 Received: (qmail 698 invoked from network); 29 Oct 2013 01:20:10 -0000 Received: from unknown (HELO earth.stuge.se) (127.0.0.1) by localhost with SMTP; 29 Oct 2013 01:20:10 -0000 MIME-Version: 1.0 From: "libssh2 Trac" X-Trac-Version: 1.0dev Precedence: bulk Auto-Submitted: auto-generated X-Mailer: Trac 1.0dev, by Edgewall Software To: hello@gregoirenoyelle.com X-Trac-Project: libssh2 Date: Tue, 29 Oct 2013 01:20:10 -0000 X-URL: https://trac.libssh2.org/ Subject: [libssh2] #278: Make Update with WordPress X-Trac-Ticket-URL: https://trac.libssh2.org/ticket/278 Message-ID: <045.56d8186020b809eda279c9621b8e48db@libssh2.stuge.se> X-Trac-Ticket-ID: 278 X-MIME-Autoconverted: from base64 to 8bit by giant.haxx.se id r9T1L4jp002502 Cc: libssh2-devel@cool.haxx.se X-BeenThere: libssh2-devel@cool.haxx.se X-Mailman-Version: 2.1.16rc2 Reply-To: trac@libssh2.stuge.se, libssh2 development List-Id: libssh2 development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: libssh2-devel-bounces@cool.haxx.se Sender: "libssh2-devel" #278: Make Update with WordPress ------------------------------+-------------------- Reporter: gnoyelle | Owner: Type: defect | Status: new Priority: normal | Milestone: 1.4.3 Component: misc | Version: 1.4.2 Keywords: WordPress,update | Blocked By: Blocks: | ------------------------------+-------------------- Hi I use on Linode VPS, Centos 6.3. The update are made by ssh connexion and I install of course lisssh2 v 1.4.2 I get many warming in debug mode like this {{{ stream_set_timeout(): No support for ssh2 stream timeout. Please recompile with libssh2 >= 1.2.9 }}} Have you an idea? Thanks -- Ticket URL: libssh2 C library for writing portable SSH2 clients _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel