"Fossies" - the Fresh Open Source Software Archive

Member "nmap-7.91/libssh2/NEWS" (25 Sep 2019, 195294 Bytes) of package /linux/misc/nmap-7.91.tgz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "NEWS": 7.80_vs_7.90.

    1    Changelog for the libssh2 project. Generated with git2news.pl
    2 
    3 GitHub (19 Jun 2019)
    4 - [Will Cosgrove brought this change]
    5 
    6   1.9 Formatting
    7 
    8 - [Will Cosgrove brought this change]
    9 
   10   1.9 Release notes
   11 
   12 Will Cosgrove (17 May 2019)
   13 - [Alexander Curtiss brought this change]
   14 
   15   libgcrypt.c : Fixed _libssh2_rsa_sha1_sign memory leak. (#370)
   16   
   17   File: libgcrypt.c
   18   
   19   Notes : Added calls to gcry_sexp_release to free memory allocated by gcry_sexp_find_token
   20   
   21   Credit :
   22   Reporter : beckmi
   23   PR by: Alexander Curtiss
   24 
   25 - [Orivej Desh brought this change]
   26 
   27   libssh2_priv.h : Fix musl build warning on sys/poll.h (#346)
   28   
   29   File : libssh2_priv.h
   30   
   31   Notes :
   32   musl prints `redirecting incorrect #include <sys/poll.h> to <poll.h>`
   33   http://git.musl-libc.org/cgit/musl/commit/include/sys/poll.h?id=54446d730cfb17c5f7bcf57f139458678f5066cc
   34   
   35   poll is defined by POSIX to be in poll.h:
   36   http://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.html
   37   
   38   Credit : Orivej Desh
   39 
   40 GitHub (1 May 2019)
   41 - [Will Cosgrove brought this change]
   42 
   43   kex.c : additional bounds checks in diffie_hellman_sha1/256 (#361)
   44   
   45   Files : kex.c, misc.c, misc.h
   46   
   47   Notes :
   48   Fixed possible out of bounds memory access when reading malformed data in diffie_hellman_sha1() and diffie_hellman_sha256().
   49   
   50   Added _libssh2_copy_string() to misc.c to return an allocated and filled char buffer from a string_buf offset. Removed no longer needed s var in kmdhgGPshakex_state_t.
   51 
   52 Will Cosgrove (26 Apr 2019)
   53 - [Tseng Jun brought this change]
   54 
   55   sftp.c : sftp_bin2attr() Correct attrs->gid assignment (#366)
   56   
   57   Regression with fix for #339
   58   
   59   Credit : Tseng Jun
   60 
   61 - [Tseng Jun brought this change]
   62 
   63   kex.c : Correct type cast in curve25519_sha256() (#365)
   64 
   65 GitHub (24 Apr 2019)
   66 - [Will Cosgrove brought this change]
   67 
   68   transport.c : scope local total_num var (#364)
   69   
   70   file : transport.c
   71   notes : move local `total_num` variable inside of if block to prevent scope access issues which caused #360.
   72 
   73 Will Cosgrove (24 Apr 2019)
   74 - [doublex brought this change]
   75 
   76   transport.c : fixes bounds check if partial packet is read
   77   
   78   Files : transport.c
   79   
   80   Issue : #360
   81   
   82   Notes :
   83    'p->total_num' instead of local value total_num when doing bounds check.
   84   
   85   Credit : Doublex
   86 
   87 GitHub (23 Apr 2019)
   88 - [Will Cosgrove brought this change]
   89 
   90   Editor config file for source files (#322)
   91   
   92   Simple start to an editor config file when editing source files to make sure they are configured correctly.
   93 
   94 - [Will Cosgrove brought this change]
   95 
   96   misc.c : String buffer API improvements (#332)
   97   
   98   Files : misc.c, hostkey.c, kex.c, misc.h, openssl.c, sftp.c
   99   
  100   Notes :
  101   * updated _libssh2_get_bignum_bytes and _libssh2_get_string. Now pass in length as an argument instead of returning it to keep signedness correct. Now returns -1 for failure, 0 for success.
  102   
  103   _libssh2_check_length now returns 0 on success and -1 on failure to match the other string_buf functions. Added comment to _libssh2_check_length.
  104   
  105   Credit : Will Cosgrove
  106 
  107 Will Cosgrove (19 Apr 2019)
  108 - [doublex brought this change]
  109 
  110   mbedtls.c : _libssh2_mbedtls_rsa_new_private_frommemory() allow private-key from memory (#359)
  111   
  112   File : mbedtls.c
  113   
  114   Notes: _libssh2_mbedtls_rsa_new_private_frommemory() fixes private-key from memory reading to by adding NULL terminator before parsing; adds passphrase support.
  115   
  116   Credit: doublex
  117 
  118 - [Ryan Kelley brought this change]
  119 
  120   Session.c : banner_receive() from leaking when accessing non ssh ports (#356)
  121   
  122   File : session.c
  123   
  124   Release previous banner in banner_receive() if the session is reused after a failed connection.
  125   
  126   Credit : Ryan Kelley
  127 
  128 GitHub (11 Apr 2019)
  129 - [Will Cosgrove brought this change]
  130 
  131   Formatting in agent.c
  132   
  133   Removed whitespace.
  134 
  135 - [Will Cosgrove brought this change]
  136 
  137   Fixed formatting in agent.c
  138   
  139   Quiet linter around a couple if blocks and pointer.
  140 
  141 Will Cosgrove (11 Apr 2019)
  142 - [Zhen-Huan HWANG brought this change]
  143 
  144   sftp.c : discard and reset oversized packet in sftp_packet_read() (#269)
  145   
  146   file : sftp.c
  147   
  148   notes : when sftp_packet_read() encounters an sftp packet which exceeds SFTP max packet size it now resets the reading state so it can continue reading.
  149   
  150   credit : Zhen-Huan HWANG
  151 
  152 GitHub (11 Apr 2019)
  153 - [Will Cosgrove brought this change]
  154 
  155   Add agent functions libssh2_agent_get_identity_path() and libssh2_agent_set_identity_path() (#308)
  156   
  157   File : agent.c
  158   
  159   Notes :
  160   Libssh2 uses the SSH_AUTH_SOCK env variable to read the system agent location. However, when using a custom agent path you have to set this value using setenv which is not thread-safe. The new functions allow for a way to set a custom agent socket path in a thread safe manor.
  161 
  162 - [Will Cosgrove brought this change]
  163 
  164   Simplified _libssh2_check_length (#350)
  165   
  166   * Simplified _libssh2_check_length
  167   
  168   misc.c : _libssh2_check_length()
  169   
  170   Removed cast and improved bounds checking and format.
  171   
  172   Credit : Yuriy M. Kaminskiy
  173 
  174 - [Will Cosgrove brought this change]
  175 
  176   _libssh2_check_length() : additional bounds check (#348)
  177   
  178   Misc.c : _libssh2_check_length()
  179   
  180   Ensure the requested length is less than the total length before doing the additional bounds check
  181 
  182 Daniel Stenberg (25 Mar 2019)
  183 - misc: remove 'offset' from string_buf
  184   
  185   It isn't necessary.
  186   
  187   Closes #343
  188 
  189 - sftp: repair mtime from e1ead35e475
  190   
  191   A regression from e1ead35e4759 broke the SFTP mtime logic in
  192   sftp_bin2attr
  193   
  194   Also simplified the _libssh2_get_u32/u64 functions slightly.
  195   
  196   Closes #342
  197 
  198 - session_disconnect: don't zero state, just clear the right bit
  199   
  200   If we clear the entire field, the freeing of data in session_free() is
  201   skipped. Instead just clear the bit that risk making the code get stuck
  202   in the transport functions.
  203   
  204   Regression from 4d66f6762ca3fc45d9.
  205   
  206   Reported-by: dimmaq on github
  207   Fixes #338
  208   Closes #340
  209 
  210 - libssh2_sftp.h: restore broken ABI
  211   
  212   Commit 41fbd44 changed variable sizes/types in a public struct which
  213   broke the ABI, which breaks applications!
  214   
  215   This reverts that change.
  216   
  217   Closes #339
  218 
  219 - style: make includes and examples code style strict
  220   
  221   make travis and the makefile rule verify them too
  222   
  223   Closes #334
  224 
  225 GitHub (21 Mar 2019)
  226 - [Daniel Stenberg brought this change]
  227 
  228   create a github issue template
  229 
  230 Daniel Stenberg (21 Mar 2019)
  231 - stale-bot: activated
  232   
  233   The stale bot will automatically mark stale issues (inactive for 90
  234   days) and if still untouched after 21 more days, close them.
  235   
  236   See https://probot.github.io/apps/stale/
  237 
  238 - libssh2_session_supported_algs.3: fix formatting mistakes
  239   
  240   Reported-by: Max Horn
  241   Fixes #57
  242 
  243 - [Zenju brought this change]
  244 
  245   libssh2.h: Fix Error C2371 'ssize_t': redefinition
  246   
  247   Closes #331
  248 
  249 - travis: add code style check
  250   
  251   Closes #324
  252 
  253 - code style: unify code style
  254   
  255   Indent-level: 4
  256   Max columns: 79
  257   No spaces after if/for/while
  258   Unified brace positions
  259   Unified white spaces
  260 
  261 - src/checksrc.pl: code style checker
  262   
  263   imported as-is from curl
  264 
  265 Will Cosgrove (19 Mar 2019)
  266 - Merge branch 'MichaelBuckley-michaelbuckley-security-fixes'
  267 
  268 - Silence unused var warnings (#329)
  269   
  270   Silence warnings about unused variables in this test
  271 
  272 - Removed unneeded > 0 check
  273   
  274   When checking `userauth_kybd_num_prompts > 100` we don't care if it's also above zero.
  275 
  276 - [Matthew D. Fuller brought this change]
  277 
  278   Spell OpenSS_H_ right when talking about their specific private key (#321)
  279   
  280   Good catch, thanks.
  281 
  282 GitHub (19 Mar 2019)
  283 - [Will Cosgrove brought this change]
  284 
  285   Silence unused var warnings (#329)
  286   
  287   Silence warnings about unused variables in this test
  288 
  289 Michael Buckley (19 Mar 2019)
  290 - Fix more scope and printf warning errors
  291 
  292 - Silence unused variable warning
  293 
  294 GitHub (19 Mar 2019)
  295 - [Will Cosgrove brought this change]
  296 
  297   Removed unneeded > 0 check
  298   
  299   When checking `userauth_kybd_num_prompts > 100` we don't care if it's also above zero.
  300 
  301 Will Cosgrove (19 Mar 2019)
  302 - [Matthew D. Fuller brought this change]
  303 
  304   Spell OpenSS_H_ right when talking about their specific private key (#321)
  305   
  306   Good catch, thanks.
  307 
  308 Michael Buckley (18 Mar 2019)
  309 - Fix errors identified by the build process
  310 
  311 - Fix casting errors after merge
  312 
  313 GitHub (18 Mar 2019)
  314 - [Michael Buckley brought this change]
  315 
  316   Merge branch 'master' into michaelbuckley-security-fixes
  317 
  318 Michael Buckley (18 Mar 2019)
  319 - Move fallback SIZE_MAX and UINT_MAX to libssh2_priv.h
  320 
  321 - Fix type and logic issues with _libssh2_get_u64
  322 
  323 Daniel Stenberg (17 Mar 2019)
  324 - examples: fix various compiler warnings
  325 
  326 - lib: fix various compiler warnings
  327 
  328 - session: ignore pedantic warnings for funcpointer <=> void *
  329 
  330 - travis: add a build using configure
  331   
  332   Closes #320
  333 
  334 - configure: provide --enable-werror
  335 
  336 - appveyor: remove old builds that mostly cause failures
  337   
  338   ... and only run on master branch.
  339   
  340   Closes #323
  341 
  342 - cmake: add two missing man pages to get installed too
  343   
  344   Both libssh2_session_handshake.3 and
  345   libssh2_userauth_publickey_frommemory.3 were installed by the configure
  346   build already.
  347   
  348   Reported-by: Arfrever on github
  349   Fixes #278
  350 
  351 - include/libssh2.h: warning: "_WIN64" is not defined, evaluates to 0
  352   
  353   We don't use #if for defines that might not be defined.
  354 
  355 - pem: //-comments are not allowed
  356 
  357 Will Cosgrove (14 Mar 2019)
  358 - [Daniel Stenberg brought this change]
  359 
  360   userauth: fix "Function call argument is an uninitialized value" (#318)
  361   
  362   Detected by scan-build.
  363 
  364 - fixed unsigned/signed issue
  365 
  366 Daniel Stenberg (15 Mar 2019)
  367 - session_disconnect: clear state
  368   
  369   If authentication is started but not completed before the application
  370   gives up and instead wants to shut down the session, the '->state' field
  371   might still be set and thus effectively dead-lock session_disconnect.
  372   
  373   This happens because both _libssh2_transport_send() and
  374   _libssh2_transport_read() refuse to do anything as long as state is set
  375   without the LIBSSH2_STATE_KEX_ACTIVE bit.
  376   
  377   Reported in curl bug https://github.com/curl/curl/issues/3650
  378   
  379   Closes #310
  380 
  381 Will Cosgrove (14 Mar 2019)
  382 - Release notes from 1.8.1
  383 
  384 Michael Buckley (14 Mar 2019)
  385 - Use string_buf in sftp_init().
  386 
  387 - Guard against out-of-bounds reads in publickey.c
  388 
  389 - Guard against out-of-bounds reads in session.c
  390 
  391 - Guard against out-of-bounds reads in userauth.c
  392 
  393 - Use LIBSSH2_ERROR_BUFFER_TOO_SMALL instead of LIBSSH2_ERROR_OUT_OF_BOUNDARY in sftp.c
  394 
  395 - Additional bounds checking in sftp.c
  396 
  397 - Additional length checks to prevent out-of-bounds reads and writes in _libssh2_packet_add(). https://libssh2.org/CVE-2019-3862.html
  398 
  399 - Add a required_size parameter to sftp_packet_require et. al. to require callers of these functions to handle packets that are too short. https://libssh2.org/CVE-2019-3860.html
  400 
  401 - Check the length of data passed to sftp_packet_add() to prevent out-of-bounds reads.
  402 
  403 - Prevent zero-byte allocation in sftp_packet_read() which could lead to an out-of-bounds read. https://libssh2.org/CVE-2019-3858.html
  404 
  405 - Sanitize padding_length - _libssh2_transport_read(). https://libssh2.org/CVE-2019-3861.html
  406   
  407   This prevents an underflow resulting in a potential out-of-bounds read if a server sends a too-large padding_length, possibly with malicious intent.
  408 
  409 - Defend against writing beyond the end of the payload in _libssh2_transport_read().
  410 
  411 - Defend against possible integer overflows in comp_method_zlib_decomp.
  412 
  413 GitHub (14 Mar 2019)
  414 - [Will Cosgrove brought this change]
  415 
  416   Security fixes (#315)
  417   
  418   * Bounds checks
  419   
  420   Fixes for CVEs
  421   https://www.libssh2.org/CVE-2019-3863.html
  422   https://www.libssh2.org/CVE-2019-3856.html
  423   
  424   * Packet length bounds check
  425   
  426   CVE
  427   https://www.libssh2.org/CVE-2019-3855.html
  428   
  429   * Response length check
  430   
  431   CVE
  432   https://www.libssh2.org/CVE-2019-3859.html
  433   
  434   * Bounds check
  435   
  436   CVE
  437   https://www.libssh2.org/CVE-2019-3857.html
  438   
  439   * Bounds checking
  440   
  441   CVE
  442   https://www.libssh2.org/CVE-2019-3859.html
  443   
  444   and additional data validation
  445   
  446   * Check bounds before reading into buffers
  447   
  448   * Bounds checking
  449   
  450   CVE
  451   https://www.libssh2.org/CVE-2019-3859.html
  452   
  453   * declare SIZE_MAX and UINT_MAX if needed
  454 
  455 - [Will Cosgrove brought this change]
  456 
  457   fixed type warnings (#309)
  458 
  459 - [Will Cosgrove brought this change]
  460 
  461   Bumping version number for pending 1.8.1 release
  462 
  463 Will Cosgrove (4 Mar 2019)
  464 - [Daniel Stenberg brought this change]
  465 
  466   _libssh2_string_buf_free: use correct free (#304)
  467   
  468   Use LIBSSH2_FREE() here, not free(). We allow memory function
  469   replacements so free() is rarely the right choice...
  470 
  471 GitHub (26 Feb 2019)
  472 - [Will Cosgrove brought this change]
  473 
  474   Fix for building against libreSSL #302
  475   
  476   Changed to use the check we use elsewhere.
  477 
  478 - [Will Cosgrove brought this change]
  479 
  480   Fix for when building against LibreSSL #302
  481 
  482 Will Cosgrove (25 Feb 2019)
  483 - [gartens brought this change]
  484 
  485   docs: update libssh2_hostkey_hash.3 [ci skip] (#301)
  486 
  487 GitHub (21 Feb 2019)
  488 - [Will Cosgrove brought this change]
  489 
  490   fix malloc/free mismatches #296 (#297)
  491 
  492 - [Will Cosgrove brought this change]
  493 
  494   Replaced malloc with calloc #295
  495 
  496 - [Will Cosgrove brought this change]
  497 
  498   Abstracted OpenSSL calls out of hostkey.c (#294)
  499 
  500 - [Will Cosgrove brought this change]
  501 
  502   Fix memory dealloc impedance mis-match #292 (#293)
  503   
  504   When using ed25519 host keys and a custom memory allocator.
  505 
  506 - [Will Cosgrove brought this change]
  507 
  508   Added call to OpenSSL_add_all_digests() #288
  509   
  510   For OpenSSL 1.0.x we need to call OpenSSL_add_all_digests().
  511 
  512 Will Cosgrove (12 Feb 2019)
  513 - [Zhen-Huan HWANG brought this change]
  514 
  515   SFTP: increase maximum packet size to 256K (#268)
  516   
  517   to match implementations like OpenSSH.
  518 
  519 - [Zenju brought this change]
  520 
  521   Fix https://github.com/libssh2/libssh2/pull/271 (#284)
  522 
  523 GitHub (16 Jan 2019)
  524 - [Will Cosgrove brought this change]
  525 
  526   Agent NULL check in shutdown #281
  527 
  528 Will Cosgrove (15 Jan 2019)
  529 - [Adrian Moran brought this change]
  530 
  531   mbedtls: Fix leak of 12 bytes by each key exchange. (#280)
  532   
  533   Correctly free ducts by calling _libssh2_mbedtls_bignum_free() in dtor.
  534 
  535 - [alex-weaver brought this change]
  536 
  537   Fix error compiling on Win32 with STDCALL=ON (#275)
  538 
  539 GitHub (8 Nov 2018)
  540 - [Will Cosgrove brought this change]
  541 
  542   Allow default permissions to be used in sftp_mkdir (#271)
  543   
  544   Added constant LIBSSH2_SFTP_DEFAULT_MODE to use the server default permissions when making a new directory
  545 
  546 Will Cosgrove (13 Sep 2018)
  547 - [Giulio Benetti brought this change]
  548 
  549   openssl: fix dereferencing ambiguity potentially causing build failure (#267)
  550   
  551   When dereferencing from *aes_ctr_cipher, being a pointer itself,
  552   ambiguity can occur; fixed possible build errors.
  553 
  554 Viktor Szakats (12 Sep 2018)
  555 - win32/GNUmakefile: define HAVE_WINDOWS_H
  556   
  557   This macro was only used in test/example code before, now it is
  558   also used in library code, but only defined automatically by
  559   automake/cmake, so let's do the same for the standalone win32
  560   make file.
  561   
  562   It'd be probably better to just rely on the built-in _WIN32 macro
  563   to detect the presence of windows.h though. It's already used
  564   in most of libssh2 library code. There is a 3rd, similar macro
  565   named LIBSSH2_WIN32, which might also be replaced with _WIN32.
  566   
  567   Ref: https://github.com/libssh2/libssh2/commit/8b870ad771cbd9cd29edbb3dbb0878e950f868ab
  568   Closes https://github.com/libssh2/libssh2/pull/266
  569 
  570 Marc Hoersken (2 Sep 2018)
  571 - Fix conditional check for HAVE_DECL_SECUREZEROMEMORY
  572   
  573   "Unlike the other `AC_CHECK_*S' macros, when a symbol is not declared,
  574   HAVE_DECL_symbol is defined to `0' instead of leaving HAVE_DECL_symbol
  575   undeclared. When you are sure that the check was performed,
  576   use HAVE_DECL_symbol in #if."
  577   
  578   Source: autoconf documentation for AC_CHECK_DECLS.
  579 
  580 - Fix implicit declaration of function 'SecureZeroMemory'
  581   
  582   Include window.h in order to use SecureZeroMemory on Windows.
  583 
  584 - Fix implicit declaration of function 'free' by including stdlib.h
  585 
  586 GitHub (27 Aug 2018)
  587 - [Will Cosgrove brought this change]
  588 
  589   Use malloc abstraction function in pem parse
  590   
  591   Fix warning on WinCNG build.
  592 
  593 - [Will Cosgrove brought this change]
  594 
  595   Fixed possible junk memory read in sftp_stat #258
  596 
  597 - [Will Cosgrove brought this change]
  598 
  599   removed INT64_C define (#260)
  600   
  601   No longer used.
  602 
  603 - [Will Cosgrove brought this change]
  604 
  605   Added conditional around engine.h include
  606 
  607 Will Cosgrove (6 Aug 2018)
  608 - [Alex Crichton brought this change]
  609 
  610   Fix OpenSSL link error with `no-engine` support (#259)
  611   
  612   This commit fixes linking against an OpenSSL library that was compiled with
  613   `no-engine` support by bypassing the initialization routines as they won't be
  614   available anyway.
  615 
  616 GitHub (2 Aug 2018)
  617 - [Will Cosgrove brought this change]
  618 
  619   ED25519 Key Support #39 (#248)
  620   
  621   OpenSSH Key and ED25519 support #39
  622   Added _libssh2_explicit_zero() to explicitly zero sensitive data in memory #120
  623   
  624   * ED25519 Key file support - Requires OpenSSL 1.1.1 or later
  625   * OpenSSH Key format reading support - Supports RSA/DSA/ECDSA/ED25519 types
  626   * New string buffer reading functions - These add build-in bounds checking and convenance methods. Used for OpenSSL PEM file reading.
  627   * Added new tests for OpenSSH formatted Keys
  628 
  629 - [Will Cosgrove brought this change]
  630 
  631   ECDSA key types are now explicit (#251)
  632   
  633   * ECDSA key types are now explicit
  634   
  635   Issue was brough up in pull request #248
  636 
  637 Will Cosgrove (2 May 2018)
  638 - [Jakob Egger brought this change]
  639 
  640   Add Instructions for building from Master (#249)
  641 
  642 GitHub (27 Apr 2018)
  643 - [Will Cosgrove brought this change]
  644 
  645   Initialize sb_intl #226
  646 
  647 Will Cosgrove (19 Apr 2018)
  648 - [doublex brought this change]
  649 
  650   buffer overflow (valgrind) (#159)
  651 
  652 - [Brendan Shanks brought this change]
  653 
  654   mbedTLS: Remove some C99-style intermingled variable declarations (#196)
  655 
  656 GitHub (18 Apr 2018)
  657 - [Will Cosgrove brought this change]
  658 
  659   fix for #160
  660 
  661 Will Cosgrove (18 Apr 2018)
  662 - [doublex brought this change]
  663 
  664   fix memory leak when using mbedtls backend (#158)
  665   
  666    _libssh2_bn_init_from_bin/_libssh2_bn_free would leak bignum from mbedtls_calloc().
  667 
  668 - [Brendan Shanks brought this change]
  669 
  670   mbedTLS: Avoid multiple definition errors for context handles (#197)
  671 
  672 - [Tseng Jun brought this change]
  673 
  674   Fix the EVP cipher meth memory leakage problem (#244)
  675   
  676   * Fix the EVP cipher meth memory leakage problem
  677   
  678   Looks good, thanks for the fixes.
  679 
  680 Marc Hörsken (31 Mar 2018)
  681 - [Will Cosgrove brought this change]
  682 
  683   Added ECDSA defines for WinCNG (#245)
  684   
  685   Fixed missing defines preventing building using WinCNG
  686 
  687 GitHub (30 Mar 2018)
  688 - [Will Cosgrove brought this change]
  689 
  690   Fix for _libssh2_rsa_new with OpenSSL 1.0.x
  691   
  692   missing d value assignment.
  693 
  694 Will Cosgrove (20 Mar 2018)
  695 - [Etienne Samson brought this change]
  696 
  697   A collection of small fixes (#198)
  698   
  699   * tests: Remove if-pyramids
  700   
  701   * tests: Switch run_command arguments
  702   
  703   * tests: Make run_command a vararg function
  704   
  705   * tests: Xcode doesn't obey CMake's test working directory
  706   
  707   * openssl: move manual AES-CTR cipher into crypto init
  708   
  709   * cmake: Move our include dir before all other include paths
  710 
  711 GitHub (15 Mar 2018)
  712 - [Will Cosgrove brought this change]
  713 
  714   Fixes incorrect indexing of KEX prefs string
  715   
  716   After stripping out an invalid KEX pref entry, it would incorrectly advance again leaving invalid values in the list.
  717 
  718 Viktor Szakats (13 Mar 2018)
  719 - tests: fix checksrc warnings
  720   
  721   Also:
  722   * add 'static' qualifier to file-wide const buffers
  723   * fix a non-ANSI C89 comment
  724   * silence a mismatched fprintf() mask warning by adding a cast
  725 
  726 - cmake: recognize OpenSSL 1.1 .dll names
  727   
  728   Also fix some comment typos and a stray tab.
  729 
  730 - docs: update an URL [ci skip]
  731 
  732 Daniel Stenberg (12 Mar 2018)
  733 - docs/SECURITY: the max embargo is 14 days now
  734 
  735 Viktor Szakats (12 Mar 2018)
  736 - docs: spelling fixes [ci skip]
  737   
  738   Closes https://github.com/libssh2/libssh2/pull/222
  739 
  740 GitHub (12 Mar 2018)
  741 - [Will Cosgrove brought this change]
  742 
  743   Fixed minor tabs/spacing issues
  744 
  745 - [Will Cosgrove brought this change]
  746 
  747   Update kex.c
  748 
  749 - [Will Cosgrove brought this change]
  750 
  751   Added basic bounds checking #206
  752   
  753   Basic bounds checking in ecdh_sha2_nistp()
  754 
  755 - [Will Cosgrove brought this change]
  756 
  757   Fixed Clang warning #206
  758   
  759   Fixed possible garbage value for secret in an error case
  760 
  761 - [Will Cosgrove brought this change]
  762 
  763   Fixed incorrect #if to #ifdef #206
  764   
  765   When checking HAVE_OPAQUE_STRUCTS.
  766 
  767 Viktor Szakats (12 Mar 2018)
  768 - src: suppress two checksrc warnings
  769   
  770   Ref: https://github.com/libssh2/libssh2/pull/235
  771 
  772 - src: address fopen() warnings, add missing copyright headers
  773   
  774   Ref: https://github.com/libssh2/libssh2/pull/235
  775 
  776 - src: replace sprintf() with snprintf()
  777   
  778   Ref: https://github.com/libssh2/libssh2/pull/235
  779 
  780 - src: fix checksrc warnings
  781   
  782   Use checksrc.pl from the curl project, with (for now)
  783   suppressed long line warnings and indentation set to
  784   4 spaces. Fixes are whitespace for the most part.
  785   
  786   Warning count went down from 2704 to 12.
  787   
  788   Also fix codespell typos, two non-ANSI C89 comments
  789   and a stray tab in include/libssh2.h.
  790   
  791   Ref: https://github.com/libssh2/libssh2/pull/235
  792 
  793 - checksrc: add source style checker
  794   
  795   This is a slightly extended version of this original source
  796   from the curl project:
  797   https://github.com/curl/curl/blob/8b754c430b9a4c51aa606c687ee5014faf7c7b06/lib/checksrc.pl
  798   
  799   This version adds the following options to customize it for
  800   libssh2 (plus some whitespace formatting):
  801   
  802   `-i<n>`  to override indentation spaces (2)
  803   `-m<n>`  to override maximum line length (79)
  804   
  805   Command-line used to check libssh2 sources:
  806   
  807   $ ./checksrc.pl -i4 -m500 *.c *.h
  808   
  809   Closes https://github.com/libssh2/libssh2/pull/236
  810 
  811 - src: add static qualifier
  812   
  813   To private, const strings.
  814   
  815   Closes https://github.com/libssh2/libssh2/pull/237
  816 
  817 - [Will Cosgrove brought this change]
  818 
  819   Add support for ECDSA keys and host keys (#41)
  820   
  821   This commit lands full ECDSA key support when using the OpenSSL
  822   backend. Which includes:
  823   
  824   New KEX methods:
  825   ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521
  826   
  827   Can now read OpenSSL formatted ECDSA key files.
  828   
  829   Now supports known host keys of type ecdsa-sha2-nistp256.
  830   
  831   New curve types:
  832   NID_X9_62_prime256v1, NID_secp384r1, NID_secp521r1
  833   
  834   Default host key preferred ordering is now nistp256, nistp384,
  835   nistp521, rsa, dss.
  836   
  837   Ref: https://github.com/libssh2/libssh2/issues/41
  838   
  839   Closes https://github.com/libssh2/libssh2/pull/206
  840 
  841 GitHub (15 Dec 2017)
  842 - [Will Cosgrove brought this change]
  843 
  844   Fixed possible crash when decoding invalid data
  845   
  846   When trying to decode invalid data, it frees the buffer but doesn't nil it so the caller gets a junk memory pointer which they could potentially double free.
  847 
  848 - [Will Cosgrove brought this change]
  849 
  850   Remove call to OpenSSL_add_all_ciphers()
  851   
  852   Now lives in libssh2 init() from PR #189
  853 
  854 - [Will Cosgrove brought this change]
  855 
  856   Fixed incorrect reference to decrypted block
  857   
  858   Fixed incorrectly copied memory from p->buf into init instead of from the decrypted buffer block. The only reason this worked was because the crypt() function decrypts the value in-place and overwrites p->buf.  I'm working on a fork that no longer does this and exposed this bug.
  859 
  860 Will Cosgrove (20 Oct 2017)
  861 - [Pan brought this change]
  862 
  863   Fix typo in crypt.c (#218)
  864 
  865 Kamil Dudka (17 Oct 2017)
  866 - session: avoid printing misleading debug messages
  867   
  868   ... while throwing LIBSSH2_ERROR_EAGAIN out of session_startup()
  869   
  870   If the session runs in blocking mode, LIBSSH2_ERROR_EAGAIN never reaches
  871   the libssh2 API boundary and, in non-blocking mode, these messages are
  872   suppressed by the condition in _libssh2_error_flags() anyway.
  873   
  874   Closes #211
  875 
  876 Viktor Szakats (15 Oct 2017)
  877 - win32/GNUmakefile: allow customizing dll suffixes
  878   
  879   - New `LIBSSH2_DLL_SUFFIX` envvar will add a suffix to the generated
  880     libssh2 dll name. Useful to add `-x64` to 64-bit builds so that
  881     it can live in the same directory as the 32-bit one. By default
  882     this is empty.
  883   
  884   - New `LIBSSH2_DLL_A_SUFFIX` envvar to customize the suffix of the
  885     generated import library (implib) for libssh2 .dll. It defaults
  886     to `dll`, and it's useful to modify that to `.dll` to have the
  887     standard naming scheme for mingw-built .dlls, i.e. `libssh2.dll.a`.
  888   
  889   Ref: https://github.com/curl/curl/commit/aaa16f80256abc1463fd9374815130a165222257
  890   
  891   Closes https://github.com/libssh2/libssh2/pull/215
  892 
  893 - makefile.m32: allow to override gcc, ar and ranlib
  894   
  895   Allow to ovverride certain build tools, making it possible to
  896   use LLVM/Clang to build libssh2. The default behavior is unchanged.
  897   To build with clang (as offered by MSYS2), these settings can
  898   be used:
  899   
  900   LIBSSH2_CC=clang
  901   LIBSSH2_AR=llvm-ar
  902   LIBSSH2_RANLIB=llvm-ranlib
  903   
  904   Also adjust ranlib parameters to be compatible with LLVM/Clang's
  905   ranlib tool.
  906   
  907   Closes https://github.com/libssh2/libssh2/pull/214
  908 
  909 GitHub (27 Sep 2017)
  910 - [Will Cosgrove brought this change]
  911 
  912   Fixes out of bounds memory access (#210)
  913   
  914   If an invalid PEM file is read and the lines are longer than 128 characters it will go out of bounds and crash on line 91.
  915 
  916 Will Cosgrove (11 Sep 2017)
  917 - [Kamil Dudka brought this change]
  918 
  919   scp: do not NUL-terminate the command for remote exec (#208)
  920   
  921   It breaks SCP download/upload from/to certain server implementations.
  922   
  923   The bug does not manifest with OpenSSH, which silently drops the NUL
  924   byte (eventually with any garbage that follows the NUL byte) before
  925   executing it.
  926   
  927   Bug: https://bugzilla.redhat.com/1489736
  928 
  929 GitHub (21 Aug 2017)
  930 - [Viktor Szakats brought this change]
  931 
  932   openssl.c: remove no longer used variable (#204)
  933   
  934   after e378d2e30a40bd9bcee06dc3a4250f269098e200
  935 
  936 - [Will Cosgrove brought this change]
  937 
  938   Fix for #188 (#189)
  939   
  940   * Update openssl.c
  941   
  942   * Create openssl.h
  943 
  944 Will Cosgrove (24 May 2017)
  945 - [Marcel Raad brought this change]
  946 
  947   openssl: fix build with OpenSSL 1.1 API (#176)
  948   
  949   When building with OPENSSL_API_COMPAT=0x10100000L, OpenSSL_add_all_algorithms
  950   and OpenSSL_add_all_ciphers don't exist. The corresponding functionality is
  951   handled automatically with OpenSSL 1.1.
  952 
  953 - [Sune Bredahl brought this change]
  954 
  955   Add support for SHA256 hostkey fingerprints (#180)
  956   
  957   Looks good, thanks!
  958 
  959 GitHub (12 May 2017)
  960 - [Will Cosgrove brought this change]
  961 
  962   Fix memory leak of crypt_ctx->h using openSSL 1.1+ (#177)
  963   
  964   Need to use EVP_CIPHER_CTX_free instead of EVP_CIPHER_CTX_reset.
  965 
  966 Marc Hoersken (2 Mar 2017)
  967 - tests/openssh_server/authorized_keys: add key_rsa_encrypted.pub
  968 
  969 - tests: add simple test for passphrase-protected PEM file support
  970 
  971 - os400qc3: enable passphrase-protected PEM file support using pem.c
  972 
  973 - pem: fix indentation and replace assert after 386e012292
  974 
  975 - [Keno Fischer brought this change]
  976 
  977   pem: add passphrase-protected PEM file support for libgcrypt and wincng
  978   
  979   Since they use our own PEM parser which did not support encrypted
  980   PEM files, trying to use such files on these backends failed.
  981   Fix that by augmenting the PEM parser to support encrypted PEM files.
  982 
  983 - [Thomas brought this change]
  984 
  985   misc: use time constant implementation for AES CTR increment
  986 
  987 - [Thomas brought this change]
  988 
  989   wincng: add AES CTR mode support (aes128-ctr, aes192-ctr, aes256-ctr)
  990 
  991 - [Thomas brought this change]
  992 
  993   openssl: move shared AES-CTR code into misc
  994 
  995 Daniel Stenberg (20 Dec 2016)
  996 - [Alex Crichton brought this change]
  997 
  998   kex: acknowledge error code from libssh2_dh_key_pair()
  999   
 1000   Fixes a segfault using ssh-agent on Windows
 1001   
 1002   This commit fixes a segfault seen dereferencing a null pointer on
 1003   Windows when using ssh-agent. The problem ended up being that errors
 1004   weren't being communicated all the way through, causing null pointers to
 1005   be used when functions should have bailed out sooner.
 1006   
 1007   The `_libssh2_dh_key_pair` function for WinCNG was modified to propagate
 1008   errors, and then the two callsites in kex.c of
 1009   `diffie_hellman_sha{1,256}` were updated to recognize this error and
 1010   bail out.
 1011   
 1012   Fixes #162
 1013   Closes #163
 1014 
 1015 Alexander Lamaison (27 Nov 2016)
 1016 - [monnerat brought this change]
 1017 
 1018   Implement Diffie-Hellman computations in crypto backends. (#149)
 1019   
 1020   Not all backends feature the low level API needed to compute a Diffie-Hellman
 1021   secret, but some of them directly implement Diffie-Hellman support with opaque
 1022   private data. The later approach is now generalized and backends are
 1023   responsible for all Diffie Hellman computations.
 1024   As a side effect, procedures/macros _libssh2_bn_rand and _libssh2_bn_mod_exp
 1025   are no longer needed outside the backends.
 1026 
 1027 Peter Stuge (16 Nov 2016)
 1028 - acinclude.m4: The mbedtls crypto backend actually requires libmbedcrypto
 1029   
 1030   Examples can't be linked with libmbedtls but need libmbedcrypto, and
 1031   any users of libssh2 which use libtool and libssh2.la would encounter
 1032   the same problem.
 1033   
 1034   This changes the mbedtls detection to search for libmbedcrypto, which
 1035   is the actual dependency for the backend.
 1036 
 1037 - acinclude.m4: Add CPPFLAGS=-I$prefix-dir/include in LIBSSH2_LIB_HAVE_LINKFLAGS
 1038   
 1039   This is absolutely neccessary for header files to be found when
 1040   AC_LIB_HAVE_LINKFLAGS searches for libraries.
 1041 
 1042 - acinclude.m4: Make saved variables in LIBSSH2_LIB_HAVE_LINKFLAGS uniform
 1043 
 1044 - docs/HACKING.CRYPTO: Improve documentation for autoconf build system
 1045 
 1046 Alexander Lamaison (16 Nov 2016)
 1047 - [Alex Arslan brought this change]
 1048 
 1049   Check for netinet/in.h in the tests cmake file (#148)
 1050 
 1051 - [Patrick Monnerat brought this change]
 1052 
 1053   Define new Diffie-Hellman context for mbedTLS
 1054 
 1055 - [monnerat brought this change]
 1056 
 1057   Make libssh2 work again on os400. (#118)
 1058   
 1059   * os400: minimum supported OS version is now V6R1.
 1060   Do not log compiler informational messages.
 1061   
 1062   * Implement crypto backend specific Diffie-Hellman computation.
 1063   
 1064   This feature is now needed on os400 because the QC3 library does not
 1065   implement bn_mod_exp() natively. Up to now, this function was emulated using
 1066   an RSA encryption, but commits ca5222ea819cc5ed797860070b4c6c1aeeb28420 and
 1067   7934c9ce2a029c43e3642a492d3b9e494d1542be (CVE-2016-0787) broke the emulation
 1068   because QC3 only supports RSA exponents up to 512 bits.
 1069   
 1070   Happily, QC3 supports a native API for Diffie-Hellman computation, with
 1071   opaque random value: this commit implements the use of this API and, as a
 1072   side effect, enables support of this feature for any other crypto backend that
 1073   would use it.
 1074   
 1075   A "generic" Diffie-Hellman computation internal API supports crypto backends
 1076   not implementing their own: this generic API uses the same functions as before.
 1077   
 1078   * Fix typos in docs/HACKING.CRYPTO.
 1079 
 1080 - [Peter Stuge brought this change]
 1081 
 1082   acinclude.m4: Fixup OpenSSL EVP_aes_128_ctr() detection
 1083 
 1084 - [Peter Stuge brought this change]
 1085 
 1086   configure.ac: Add --with-crypto= instead of many different --with-$backend
 1087   
 1088   The new --with-crypto option replaces the previous backend-specific
 1089   --with-{openssl,libgcrypt,mbedtls,wincng} options and fixes some issues.
 1090   
 1091   * libgcrypt or mbedtls would previously be used whenever found, even
 1092     if configure was passed --without-libgcrypt or --without-mbedtls.
 1093   
 1094   * If --with-$backend was specified then configure would not fail even
 1095     if that library could not be found, and would instead use whichever
 1096     crypto library was found first.
 1097   
 1098   The new option defaults to `auto`, which makes configure check for all
 1099   supported crypto libraries in turn, choosing the first one found, or
 1100   exiting with an error if none can be found.
 1101 
 1102 - [Tony Kelman brought this change]
 1103 
 1104   Build mbedtls from source on Travis (#133)
 1105   
 1106   * Revert "Revert "travis: Test mbedtls too""
 1107   
 1108   This reverts commit c4c60eac5ca756333034b07dd9e0b97741493ed3.
 1109   
 1110   * travis: Build mbedtls from source on Travis
 1111   
 1112   Use TOOLCHAIN_OPTION when calling cmake on mbedtls
 1113   
 1114   * tests: only run DSA tests for non-mbedtls
 1115   
 1116   crypto backends
 1117 
 1118 - [Peter Stuge brought this change]
 1119 
 1120   configure.ac src/Makefile.am: Remove dead AM_CONDITIONAL(OS400QC3)
 1121   
 1122   According to os400/README400 this backend can not be built
 1123   with configure+make, and the conditional is hard coded to false.
 1124 
 1125 - [Peter Stuge brought this change]
 1126 
 1127   configure.ac: Add -DNDEBUG to CPPFLAGS in non-debug builds
 1128   
 1129   There are a few uses of assert() in channel.c, sftp.c and transport.c.
 1130 
 1131 - [Peter Stuge brought this change]
 1132 
 1133   src/global.c: Fix conditional AES-CTR support
 1134   
 1135   Most of libssh2 already has conditional support for AES-CTR according to
 1136   the LIBSSH2_AES_CTR crypto backend #define, but global.c needed fixing.
 1137 
 1138 - [Peter Stuge brought this change]
 1139 
 1140   src/crypto.h src/userauth.c: Fix conditional RSA support
 1141   
 1142   Most of libssh2 already has conditional support for RSA according to
 1143   the LIBSSH2_RSA crypto backend #define, but crypto.h and userauth.c
 1144   needed a few small fixes.
 1145 
 1146 - [Peter Stuge brought this change]
 1147 
 1148   src/kex.c: Cast libssh2_sha{1,256}_update data arguments properly
 1149   
 1150   The update functions take a const unsigned char * but were called
 1151   with (const) char * in some places, causing unneccessary warnings.
 1152 
 1153 - [Peter Stuge brought this change]
 1154 
 1155   docs/HACKING.CRYPTO: Fix two type typos
 1156 
 1157 - [Sergei Trofimovich brought this change]
 1158 
 1159   acinclude.m4: fix ./configure --with-libgcrypt
 1160   
 1161   The change fixes passing of bogus gcrypt prefix.
 1162   Reproducible as:
 1163   
 1164       $ ./configure --with-libgcrypt
 1165       $ make V=1
 1166       ...
 1167       /bin/sh ../libtool  --tag=CC   --mode=link gcc  -g -O2 -Iyes/include -version-info 1:1:0 -no-undefined -export-symbols-regex '^libssh2_.*' -lgcrypt  -lz -Lyes/lib -o libssh2.la -rpath /usr/local/lib channel.lo comp.lo crypt.lo hostkey.lo kex.lo mac.lo misc.lo packet.lo publickey.lo scp.lo session.lo sftp.lo userauth.lo transport.lo version.lo knownhost.lo agent.lo libgcrypt.lo pem.lo keepalive.lo global.lo   -lgcrypt
 1168       ../libtool: line 7475: cd: yes/lib: No such file or directory
 1169       libtool:   error: cannot determine absolute directory name of 'yes/lib'
 1170   
 1171   These
 1172       -Iyes/include
 1173       -Lyes/lib
 1174   come from libgcrypt code autodetection:
 1175     if test -n "$use_libgcrypt" && test "$use_libgcrypt" != "no"; then
 1176        LDFLAGS="$LDFLAGS -L$use_libgcrypt/lib"
 1177        CFLAGS="$CFLAGS -I$use_libgcrypt/include"
 1178   
 1179   I assume it's a typo to use yes/no flag as a prefix and changed
 1180   it to '$with_libgcrypt_prefix'.
 1181   
 1182   Reported-by: Mikhail Pukhlikov <cynede@gentoo.org>
 1183   Signed-off-by: Sergei Trofimovich <siarheit@google.com>
 1184 
 1185 - [Zenju brought this change]
 1186 
 1187   libssh2_sftp_init hang: last error not set
 1188   
 1189   The problem is that the original if statement simply returns NULL, but does not set the session last error code. The consequence is that libssh2_sftp_init() also returns NULL and libssh2_session_last_errno(sshSession) == LIBSSH2_ERROR_NONE.
 1190   
 1191   In my test the LIBSSH2_ERROR_EAGAIN is coming from sftp.c row 337:
 1192               if(4 != sftp->partial_size_len)
 1193                   /* we got a short read for the length part */
 1194                   return LIBSSH2_ERROR_EAGAIN;
 1195   
 1196   with "partial_size_len == 0". Not sure if this is expected.
 1197 
 1198 - [Aidan Hobson Sayers brought this change]
 1199 
 1200   docs: correctly describe channel_wait_eof
 1201   
 1202   channel_wait_eof waits for channel->remote.eof, which is set on
 1203   receiving a `SSH_MSG_CHANNEL_EOF` message. This message is sent
 1204   when a party has no more data to send on a channel.
 1205 
 1206 - [Zenju brought this change]
 1207 
 1208   Fix MSVC 14 compilation warning (#92)
 1209   
 1210   1>  sftp.c
 1211   1>libssh2-files\src\sftp.c(3393): warning C4456: declaration of 'retcode' hides previous local declaration
 1212   1>  libssh2-files\src\sftp.c(3315): note: see declaration of 'retcode'
 1213 
 1214 - [Salvador Fandino brought this change]
 1215 
 1216   LIBSSH2_ERROR_CHANNEL_WINDOW_FULL: add new error code
 1217   
 1218   In order to signal that the requested operation can not succeed
 1219   because the receiving window had been exhausted, the error code
 1220   LIBSSH2_ERROR_BUFFER_TOO_SMALL has been reused but I have found
 1221   that in certain context it may be ambigous.
 1222   
 1223   This patch introduces a new error code,
 1224   LIBSSH2_ERROR_CHANNEL_WINDOW_FULL, exclusive to signal that condition.
 1225 
 1226 - [Salvador Fandino brought this change]
 1227 
 1228   channel_wait_eof: handle receive window exhaustion
 1229   
 1230   Until now, in blocking mode, if the remote receiving window is
 1231   exhausted this function hangs forever as data is not read and the
 1232   remote side just keeps waiting for the window to grow before sending
 1233   more data.
 1234   
 1235   This patch, makes this function check for that condition and abort
 1236   with an error when it happens.
 1237 
 1238 - [Salvador Fandino brought this change]
 1239 
 1240   channel_wait_closed: don't fail when unread data is queued
 1241   
 1242   This function was calling channel_wait_eof to ensure that the EOF
 1243   packet has already been received, but that function also checks that
 1244   the read data queue is empty before reporting the EOF. That caused
 1245   channel_wait_closed to fail with a LIBSSH2_ERROR_INVAL when some data
 1246   was queued even after a successful call to libssh2_channel_wait_eof.
 1247   
 1248   This patch changes libssh2_channel_wait_closed to look directly into
 1249   channel->remote.eof so that both libssh2_channel_wait_eof and
 1250   libssh2_channel_wait_closed bahave consistently.
 1251 
 1252 - [Salvador Fandino brought this change]
 1253 
 1254   channel_wait_eof: fix debug message
 1255 
 1256 Daniel Stenberg (25 Oct 2016)
 1257 - libssh2.h: start working on 1.8.1
 1258 
 1259 Version 1.8.0 (25 Oct 2016)
 1260 
 1261 Daniel Stenberg (25 Oct 2016)
 1262 - RELEASE-NOTES: adjusted for 1.8.0
 1263 
 1264 Kamil Dudka (20 Oct 2016)
 1265 - Revert "aes: the init function fails when OpenSSL has AES support"
 1266   
 1267   This partially reverts commit f4f2298ef3635acd031cc2ee0e71026cdcda5864
 1268   because it caused the compatibility code to call initialization routines
 1269   redundantly, leading to memory leakage with OpenSSL 1.1 and broken curl
 1270   test-suite in Fedora:
 1271   
 1272   88 bytes in 1 blocks are definitely lost in loss record 5 of 8
 1273      at 0x4C2DB8D: malloc (vg_replace_malloc.c:299)
 1274      by 0x72C607D: CRYPTO_zalloc (mem.c:100)
 1275      by 0x72A2480: EVP_CIPHER_meth_new (cmeth_lib.c:18)
 1276      by 0x4E5A550: make_ctr_evp.isra.0 (openssl.c:407)
 1277      by 0x4E5A8E8: _libssh2_init_aes_ctr (openssl.c:471)
 1278      by 0x4E5BB5A: libssh2_init (global.c:49)
 1279 
 1280 Daniel Stenberg (19 Oct 2016)
 1281 - [Charles Collicutt brought this change]
 1282 
 1283   libssh2_wait_socket: Fix comparison with api_timeout to use milliseconds (#134)
 1284   
 1285   Fixes #74
 1286 
 1287 - [Charles Collicutt brought this change]
 1288 
 1289   Set err_msg on _libssh2_wait_socket errors (#135)
 1290 
 1291 - Revert "travis: Test mbedtls too"
 1292   
 1293   This reverts commit 3e6de50a24815e72ec5597947f1831f6083b7da8.
 1294   
 1295   Travis doesn't seem to support the mbedtls-dev package
 1296 
 1297 - maketgz: support "only" to only update version number locally
 1298   
 1299   and fix the date output locale
 1300 
 1301 - configure: make the --with-* options override the OpenSSL default
 1302   
 1303   ... previously it would default to OpenSSL even with the --with-[crypto]
 1304   options used unless you specificly disabled OpenSSL. Now, enabling another
 1305   backend will automatically disable OpenSSL if the other one is found.
 1306 
 1307 - [Keno Fischer brought this change]
 1308 
 1309   docs: Add documentation on new cmake/configure options
 1310 
 1311 - [Keno Fischer brought this change]
 1312 
 1313   configure: Add support for building with mbedtls
 1314 
 1315 - [wildart brought this change]
 1316 
 1317   travis: Test mbedtls too
 1318 
 1319 - [wildart brought this change]
 1320 
 1321   crypto: add support for the mbedTLS backend
 1322   
 1323   Closes #132
 1324 
 1325 - [wildart brought this change]
 1326 
 1327   cmake: Add CLEAR_MEMORY option, analogously to that for autoconf
 1328 
 1329 - README.md: fix link typo
 1330 
 1331 - README: markdown version to look nicer on github
 1332 
 1333 Viktor Szakats (5 Sep 2016)
 1334 - [Taylor Holberton brought this change]
 1335 
 1336   openssl: add OpenSSL 1.1.0 compatibility
 1337 
 1338 Daniel Stenberg (4 Sep 2016)
 1339 - [Antenore Gatta brought this change]
 1340 
 1341   tests: HAVE_NETINET_IN_H was not defined correctly (#127)
 1342   
 1343   Fixes #125
 1344 
 1345 - SECURITY: fix web site typo
 1346 
 1347 - SECURITY: security process
 1348 
 1349 GitHub (14 Aug 2016)
 1350 - [Alexander Lamaison brought this change]
 1351 
 1352   Basic dockerised test suite.
 1353   
 1354   This introduces a test suite for libssh2. It runs OpenSSH in a Docker
 1355   container because that works well on Windows (via docker-machine) as
 1356   well as Linux. Presumably it works on Mac too with docker-machine, but
 1357   I've not tested that.
 1358   
 1359   Because the test suite is docker-machine aware, you can also run it
 1360   against a cloud provider, for more realistic network testing, by setting
 1361   your cloud provider as your active docker machine. The Appveyor CI setup
 1362   in this commit does that because Appveyor doesn't support docker
 1363   locally.
 1364 
 1365 Kamil Dudka (3 Aug 2016)
 1366 - [Viktor Szakats brought this change]
 1367 
 1368   misc.c: Delete unused static variables
 1369   
 1370   Closes #114
 1371 
 1372 Daniel Stenberg (9 Apr 2016)
 1373 - [Will Cosgrove brought this change]
 1374 
 1375   Merge pull request #103 from willco007/patch-2
 1376   
 1377   Fix for security issue CVE-2016-0787
 1378 
 1379 Alexander Lamaison (2 Apr 2016)
 1380 - [Zenju brought this change]
 1381 
 1382   Fix MSVC 14 compilation errors
 1383   
 1384   For _MSC_VER == 1900 these macros are not needed and create problems:
 1385   
 1386   
 1387   
 1388   1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1925): warning C4005: 'snprintf': macro redefinition (compiling source file libssh2-files\src\mac.c)
 1389   
 1390   1> \win32\libssh2_config.h(27): note: see previous definition of 'snprintf' (compiling source file libssh2-files\src\mac.c)
 1391   
 1392   1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\stdio.h(1927): fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration (compiling source file libssh2-files\src\mac.c)
 1393 
 1394 Daniel Stenberg (26 Mar 2016)
 1395 - [Brad Harder brought this change]
 1396 
 1397   _libssh2_channel_open: speeling error fixed in channel error message
 1398 
 1399 Alexander Lamaison (15 Mar 2016)
 1400 - Link with crypt32.lib on Windows.
 1401   
 1402   Makes linking with static OpenSSL work again.  Although it's not
 1403   required for dynamic OpenSSL, it does no harm.
 1404   
 1405   Fixes #98.
 1406 
 1407 - [Craig A. Berry brought this change]
 1408 
 1409   Tweak VMS help file building.
 1410   
 1411   Primarily this is handling cases where top-level files moved into
 1412   the docs/ directory.  I also corrected a typo and removed the
 1413   claim that libssh2 is public domain.
 1414 
 1415 - [Craig A. Berry brought this change]
 1416 
 1417   Build with standard stat structure on VMS.
 1418   
 1419   This gets us large file support, is available on any VMS release
 1420   in the last decade and more, and gives stat other modern features
 1421   such as 64-bit ino_t.
 1422 
 1423 - [Craig A. Berry brought this change]
 1424 
 1425   Update vms/libssh2_config.h.
 1426   
 1427   VMS does have stdlib.h, gettimeofday(), and OpenSSL.  The latter
 1428   is appropriate to hard-wire in the configuration because it's
 1429   installed by default as part of the base operating system and
 1430   there is currently no libgcrypt port.
 1431 
 1432 - [Craig A. Berry brought this change]
 1433 
 1434   VMS can't use %zd for off_t format.
 1435   
 1436   %z is a C99-ism that VMS doesn't currently have; even though the
 1437   compiler is C99-compliant, the library isn't quite.  The off_t used
 1438   for the st_size element of the stat can be 32-bit or 64-bit, so
 1439   detect what we've got and pick a format accordingly.
 1440 
 1441 - [Craig A. Berry brought this change]
 1442 
 1443   Normalize line endings in libssh2_sftp_get_channel.3.
 1444   
 1445   Somehow it got Windows-style CRLF endings so convert to just LF,
 1446   for consistency as well as not to confuse tools that will regard
 1447   the \r as content (e.g. the OpenVMS help librarian).
 1448 
 1449 Dan Fandrich (29 Feb 2016)
 1450 - libgcrypt: Fixed a NULL pointer dereference on OOM
 1451 
 1452 Daniel Stenberg (24 Feb 2016)
 1453 - [Viktor Szakats brought this change]
 1454 
 1455   url updates, HTTP => HTTPS
 1456   
 1457   Closes #87
 1458 
 1459 Dan Fandrich (23 Feb 2016)
 1460 - RELEASE-NOTES: removed some duplicated names
 1461 
 1462 Version 1.7.0 (23 Feb 2016)
 1463 
 1464 Daniel Stenberg (23 Feb 2016)
 1465 - web: the site is now HTTPS
 1466 
 1467 - RELEASE-NOTES: 1.7.0 release
 1468 
 1469 - diffie_hellman_sha256: convert bytes to bits
 1470   
 1471   As otherwise we get far too small numbers.
 1472   
 1473   Reported-by: Andreas Schneider
 1474   
 1475   CVE-2016-0787
 1476 
 1477 Alexander Lamaison (18 Feb 2016)
 1478 - Allow CI failures with VS 2008 x64.
 1479   
 1480   Appveyor doesn't support this combination.
 1481 
 1482 Daniel Stenberg (16 Feb 2016)
 1483 - [Viktor Szakats brought this change]
 1484 
 1485   GNUmakefile: list system libs after user libs
 1486   
 1487   Otherwise some referenced WinSock functions will fail to
 1488   resolve when linking against LibreSSL 2.3.x static libraries
 1489   with mingw.
 1490   
 1491   Closes #80
 1492 
 1493 - [Viktor Szakats brought this change]
 1494 
 1495   openssl: apply new HAVE_OPAQUE_STRUCTS macro
 1496   
 1497   Closes #81
 1498 
 1499 - [Viktor Szakats brought this change]
 1500 
 1501   openssl: fix LibreSSL support after OpenSSL 1.1.0-pre1/2 support
 1502 
 1503 Alexander Lamaison (14 Feb 2016)
 1504 - sftp.h: Fix non-C90 type.
 1505   
 1506   uint64_t does not exist in C90.  Use libssh2_uint64_t instead.
 1507 
 1508 - Exclude sshd tests from AppVeyor.
 1509   
 1510   They fail complaining that sshd wasn't invoked with an absolute path.
 1511 
 1512 - Test on more versions of Visual Studio.
 1513 
 1514 - Fix Appveyor builds.
 1515 
 1516 Daniel Stenberg (14 Feb 2016)
 1517 - [Viktor Szakats brought this change]
 1518 
 1519   openssl: add OpenSSL 1.1.0-pre3-dev compatibility
 1520   
 1521   by using API instead of accessing an internal structure.
 1522   
 1523   Closes #83
 1524 
 1525 - RELEASE-NOTES: synced with 996b04ececdf
 1526 
 1527 - include/libssh2.h: next version is 1.7.0
 1528 
 1529 - configure: build "silent" if possible
 1530 
 1531 - sftp: re-indented some minor stuff
 1532 
 1533 - [Jakob Egger brought this change]
 1534 
 1535   sftp.c: ensure minimum read packet size
 1536   
 1537   For optimum performance we need to ensure we don't request tiny packets.
 1538 
 1539 - [Jakob Egger brought this change]
 1540 
 1541   sftp.c: Explicit return values & sanity checks
 1542 
 1543 - [Jakob Egger brought this change]
 1544 
 1545   sftp.c: Check Read Packet File Offset
 1546   
 1547   This commit adds a simple check to see if the offset of the read
 1548   request matches the expected file offset.
 1549   
 1550   We could try to recover, from this condition at some point in the future.
 1551   Right now it is better to return an error instead of corrupted data.
 1552 
 1553 - [Jakob Egger brought this change]
 1554 
 1555   sftp.c: Don't return EAGAIN if data was written to buffer
 1556 
 1557 - [Jakob Egger brought this change]
 1558 
 1559   sftp.c: Send at least one read request before reading
 1560   
 1561   This commit ensures that we have sent at least one read request before
 1562   we try to read data in sftp_read().
 1563   
 1564   Otherwise sftp_read() would return 0 bytes (indicating EOF) if the
 1565   socket is not ready for writing.
 1566 
 1567 - [Jakob Egger brought this change]
 1568 
 1569   sftp.c: stop reading when buffer is full
 1570   
 1571   Since we can only store data from a single chunk in filep,
 1572   we have to stop receiving data as soon as the buffer is full.
 1573   
 1574   This adresses the following bug report:
 1575   https://github.com/libssh2/libssh2/issues/50
 1576 
 1577 Salvador Fandiño (21 Jan 2016)
 1578 - agent_disconnect_unix: unset the agent fd after closing it
 1579   
 1580   "agent_disconnect_unix", called by "libssh2_agent_disconnect", was
 1581   leaving the file descriptor in the agent structure unchanged. Later,
 1582   "libssh2_agent_free" would call again "libssh2_agent_disconnect" under
 1583   the hood and it would try to close again the same file descriptor. In
 1584   most cases that resulted in just a harmless error, but it is also
 1585   possible that the file descriptor had been reused between the two
 1586   calls resulting in the closing of an unrelated file descriptor.
 1587   
 1588   This patch sets agent->fd to LIBSSH2_INVALID_SOCKET avoiding that
 1589   issue.
 1590   
 1591   Signed-off-by: Salvador Fandiño <sfandino@yahoo.com>
 1592 
 1593 Daniel Stenberg (18 Jan 2016)
 1594 - [Patrick Monnerat brought this change]
 1595 
 1596   os400qc3: support encrypted private keys
 1597   
 1598   PKCS#8 EncryptedPrivateKeyinfo structures are recognized and decoded to get
 1599   values accepted by the Qc3 crypto library.
 1600 
 1601 - [Patrick Monnerat brought this change]
 1602 
 1603   os400qc3: New PKCS#5 decoder
 1604   
 1605   The Qc3 library is not able to handle PKCS#8 EncryptedPrivateKeyInfo structures
 1606   by itself. It is only capable of decrypting the (encrypted) PrivateKeyInfo
 1607   part, providing a key encryption key and an encryption algorithm are given.
 1608   Since the encryption key and algorithm description part in a PKCS#8
 1609   EncryptedPrivateKeyInfo is a PKCS#5 structure, such a decoder is needed to
 1610   get the derived key method and hash, as well as encryption algorith and
 1611   initialisation vector.
 1612 
 1613 - [Patrick Monnerat brought this change]
 1614 
 1615   os400qc3: force continuous update on non-final hash/hmac computation
 1616 
 1617 - [Patrick Monnerat brought this change]
 1618 
 1619   os400qc3: Be sure hmac keys have a minimum length
 1620   
 1621   The Qc3 library requires a minimum key length depending on the target
 1622   hash algorithm. Append binary zeroes to the given key if not long enough.
 1623   This matches RFC 2104 specifications.
 1624 
 1625 - [Patrick Monnerat brought this change]
 1626 
 1627   os400qc3: Slave descriptor for key encryption key
 1628   
 1629   The Qc3 library requires the key encryption key to exist as long as
 1630   the encrypted key is used. Its descriptor token is then kept as an
 1631   "encrypted key slave" for recursive release.
 1632 
 1633 - [Patrick Monnerat brought this change]
 1634 
 1635   os400qc3.c: comment PEM/DER decoding
 1636 
 1637 - [Patrick Monnerat brought this change]
 1638 
 1639   os400qc3.c: improve ASN.1 header byte checks
 1640 
 1641 - [Patrick Monnerat brought this change]
 1642 
 1643   os400qc3.c: improve OID matching
 1644 
 1645 - [Patrick Monnerat brought this change]
 1646 
 1647   os400: os400qc3.c: replace malloc by LIBSSH2_ALLOC or alloca where possible
 1648 
 1649 - [Patrick Monnerat brought this change]
 1650 
 1651   os400: asn1_new_from_bytes(): use data from a single element only
 1652 
 1653 - [Patrick Monnerat brought this change]
 1654 
 1655   os400: fix an ILE/RPG prototype
 1656 
 1657 - [Patrick Monnerat brought this change]
 1658 
 1659   os400: implement character encoding conversion support
 1660 
 1661 - [Patrick Monnerat brought this change]
 1662 
 1663   os400: do not miss some external prototypes
 1664   
 1665   Build procedure extproto() did not strip braces from header files, thus
 1666   possibly prepended them to true prototypes. This prevented the prototype to
 1667   be recognized as such.
 1668   The solution implemented here is to map braces to semicolons, effectively
 1669   considering them as potential prototype delimiters.
 1670 
 1671 - [Patrick Monnerat brought this change]
 1672 
 1673   os400: Really add specific README
 1674 
 1675 - [Patrick Monnerat brought this change]
 1676 
 1677   os400: Add specific README and include new files in dist tarball
 1678 
 1679 - [Patrick Monnerat brought this change]
 1680 
 1681   os400: add compilation scripts
 1682 
 1683 - [Patrick Monnerat brought this change]
 1684 
 1685   os400: include files for ILE/RPG
 1686   
 1687   In addition, file os400/macros.h declares all procedures originally
 1688   defined as macros. It must not be used for real inclusion and is only
 1689   intended to be used as a `database' for macro wrapping procedures generation.
 1690 
 1691 - [Patrick Monnerat brought this change]
 1692 
 1693   os400: add supplementary header files/wrappers. Define configuration.
 1694 
 1695 - [Patrick Monnerat brought this change]
 1696 
 1697   Protect callback function calls from macro substitution
 1698   
 1699   Some structure fields holding callback addresses have the same name as the
 1700   underlying system function (connect, send, recv). Set parentheses around
 1701   their reference to suppress a possible macro substitution.
 1702   
 1703   Use a macro for connect() on OS/400 to resolve a const/nonconst parameter
 1704   problem.
 1705 
 1706 - [Patrick Monnerat brought this change]
 1707 
 1708   Add interface for OS/400 crypto library QC3
 1709 
 1710 - [Patrick Monnerat brought this change]
 1711 
 1712   misc: include stdarg.h for debug code
 1713 
 1714 - [Patrick Monnerat brought this change]
 1715 
 1716   Document crypto library interface
 1717 
 1718 - [Patrick Monnerat brought this change]
 1719 
 1720   Feature an optional crypto-specific macro to rsa sign a data fragment vector
 1721   
 1722   OS/400 crypto library is unable to sign a precomputed SHA1 hash: however
 1723   it does support a procedure that hashes data fragments and rsa signs.
 1724   If defined, the new macro _libssh2_rsa_sha1_signv() implements this function
 1725   and disables use of _libssh2_rsa_sha1_sign().
 1726   
 1727   The function described above requires that the struct iovec unused slacks are
 1728   cleared: for this reason, macro libssh2_prepare_iovec() has been introduced.
 1729   It should be defined as empty for crypto backends that are not sensitive
 1730   to struct iovec unused slack values.
 1731 
 1732 - [Patrick Monnerat brought this change]
 1733 
 1734   Fold long lines in include files
 1735 
 1736 - [Viktor Szakats brought this change]
 1737 
 1738   kex.c: fix indentation
 1739   
 1740   Closes #71
 1741 
 1742 - [Viktor Szakats brought this change]
 1743 
 1744   add OpenSSL-1.1.0-pre2 compatibility
 1745   
 1746   Closes #70
 1747 
 1748 - [Viktor Szakats brought this change]
 1749 
 1750   add OpenSSL 1.1.0-pre1 compatibility
 1751   
 1752   * close https://github.com/libssh2/libssh2/issues/69
 1753   * sync a declaration with the rest of similar ones
 1754   * handle EVP_MD_CTX_new() returning NULL with OpenSSL 1.1.0
 1755   * fix potential memory leak with OpenSSL 1.1.0 in
 1756     _libssh2_*_init() functions, when EVP_MD_CTX_new() succeeds,
 1757     but EVP_DigestInit() fails.
 1758 
 1759 Marc Hoersken (22 Dec 2015)
 1760 - wincng.c: fixed _libssh2_wincng_hash_final return value
 1761   
 1762   _libssh2_wincng_hash_final was returning the internal BCRYPT
 1763   status code instead of a valid libssh2 return value (0 or -1).
 1764   
 1765   This also means that _libssh2_wincng_hash never returned 0.
 1766 
 1767 - wincng.c: fixed possible memory leak in _libssh2_wincng_hash
 1768   
 1769   If _libssh2_wincng_hash_update failed _libssh2_wincng_hash_final
 1770   would never have been called before.
 1771   
 1772   Reported by Zenju.
 1773 
 1774 Kamil Dudka (15 Dec 2015)
 1775 - [Paul Howarth brought this change]
 1776 
 1777   libssh2.pc.in: fix the output of pkg-config --libs
 1778   
 1779   ... such that it does not include LDFLAGS used to build libssh2 itself.
 1780   There was a similar fix in the curl project long time ago:
 1781   
 1782   https://github.com/bagder/curl/commit/curl-7_19_7-56-g4c8adc8
 1783   
 1784   Bug: https://bugzilla.redhat.com/1279966
 1785   Signed-off-by: Kamil Dudka <kdudka@redhat.com>
 1786 
 1787 Marc Hoersken (6 Dec 2015)
 1788 - hostkey.c: align code path of ssh_rsa_init to ssh_dss_init
 1789 
 1790 - hostkey.c: fix invalid memory access if libssh2_dsa_new fails
 1791   
 1792   Reported by dimmaq, fixes #66
 1793 
 1794 Daniel Stenberg (3 Nov 2015)
 1795 - [Will Cosgrove brought this change]
 1796 
 1797   gcrypt: define libssh2_sha256_ctx
 1798   
 1799   Looks like it didn't make it into the latest commit for whatever reason.
 1800   
 1801   Closes #58
 1802 
 1803 - [Salvador Fandino brought this change]
 1804 
 1805   libssh2_session_set_last_error: Add function
 1806   
 1807   Net::SSH2, the Perl wrapping module for libssh2 implements several features*
 1808   on top of libssh2 that can fail and so need some mechanism to report the error
 1809   condition to the user.
 1810   
 1811   Until now, besides the error state maintained internally by libssh2, another
 1812   error state was maintained at the Perl level for every session object and then
 1813   additional logic was used to merge both error states. That is a maintenance
 1814   nighmare, and actually there is no way to do it correctly and consistently.
 1815   
 1816   In order to allow the high level language to add new features to the library
 1817   but still rely in its error reporting features the new function
 1818   libssh2_session_set_last_error (that just exposses _libssh2_error_flags) is
 1819   introduced.
 1820   
 1821   *) For instance, connecting to a remote SSH service giving the hostname and
 1822   port.
 1823   
 1824   Signed-off-by: Salvador Fandino <sfandino@yahoo.com>
 1825   Signed-off-by: Salvador Fandiño <sfandino@yahoo.com>
 1826 
 1827 - [Salvador Fandino brought this change]
 1828 
 1829   _libssh2_error: Support allocating the error message
 1830   
 1831   Before this patch "_libssh2_error" required the error message to be a
 1832   static string.
 1833   
 1834   This patch adds a new function "_libssh2_error_flags" accepting an
 1835   additional "flags" argument and specifically the flag
 1836   "LIBSSH2_ERR_FLAG_DUP" indicating that the passed string must be
 1837   duplicated into the heap.
 1838   
 1839   Then, the method "_libssh2_error" has been rewritten to use that new
 1840   function under the hood.
 1841   
 1842   Signed-off-by: Salvador Fandino <sfandino@yahoo.com>
 1843   Signed-off-by: Salvador Fandiño <sfandino@yahoo.com>
 1844 
 1845 - [Will Cosgrove brought this change]
 1846 
 1847   added engine.h include to fix warning
 1848 
 1849 - [sune brought this change]
 1850 
 1851   kex.c: removed dupe entry from libssh2_kex_methods[]
 1852   
 1853   Closes #51
 1854 
 1855 - [Salvador Fandiño brought this change]
 1856 
 1857   userauth: Fix off by one error when reading public key file
 1858   
 1859   After reading the public key from file the size was incorrectly
 1860   decremented by one.
 1861   
 1862   This was usually a harmless error as the last character on the public
 1863   key file is an unimportant EOL. But if due to some error the public key
 1864   file is empty, the public key size becomes (uint)(0 - 1), resulting in
 1865   an unrecoverable out of memory error later.
 1866   
 1867   Signed-off-by: Salvador Fandi??o <sfandino-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>
 1868 
 1869 - [Salvador Fandino brought this change]
 1870 
 1871   channel: Detect bad usage of libssh2_channel_process_startup
 1872   
 1873   A common novice programmer error (at least among those using the
 1874   wrapping Perl module Net::SSH2), is to try to reuse channels.
 1875   
 1876   This patchs detects that incorrect usage and fails with a
 1877   LIBSSH2_ERROR_BAD_USE error instead of hanging.
 1878   
 1879   Signed-off-by: Salvador Fandino <sfandino-/E1597aS9LQAvxtiuMwx3w@public.gmane.org>
 1880 
 1881 - [Will Cosgrove brought this change]
 1882 
 1883   kex: Added diffie-hellman-group-exchange-sha256 support
 1884   
 1885   ... and fixed HMAC_Init depricated usage
 1886   
 1887   Closes #48
 1888 
 1889 Alexander Lamaison (21 Sep 2015)
 1890 - Prefixed new #defines to prevent collisions.
 1891   
 1892   Other libraries might have their own USE_WIN32_*FILES.
 1893 
 1894 - [keith-daigle brought this change]
 1895 
 1896   Update examples/scp.c to fix bug where large files on win32 would cause got to wrap and go negative
 1897 
 1898 - [David Byron brought this change]
 1899 
 1900   add libssh2_scp_recv2 to support large (> 2GB) files on windows
 1901 
 1902 Daniel Stenberg (17 Sep 2015)
 1903 - [sune brought this change]
 1904 
 1905   WinCNG: support for SHA256/512 HMAC
 1906   
 1907   Closes #47
 1908 
 1909 - [brian m. carlson brought this change]
 1910 
 1911   Add support for HMAC-SHA-256 and HMAC-SHA-512.
 1912   
 1913   Implement support for these algorithms and wire them up to the libgcrypt
 1914   and OpenSSL backends.  Increase the maximum MAC buffer size to 64 bytes
 1915   to prevent buffer overflows.  Prefer HMAC-SHA-256 over HMAC-SHA-512, and
 1916   that over HMAC-SHA-1, as OpenSSH does.
 1917   
 1918   Closes #40
 1919 
 1920 - [Zenju brought this change]
 1921 
 1922   kex: free server host key before allocating it (again)
 1923   
 1924   Fixes a memory leak when Synology server requests key exchange
 1925   
 1926   Closes #43
 1927 
 1928 - [Viktor Szakats brought this change]
 1929 
 1930   GNUmakefile: up OpenSSL version
 1931   
 1932   closes #23
 1933 
 1934 - [Viktor Szakats brought this change]
 1935 
 1936   GNUmakefile: add -m64 CFLAGS when targeting mingw64, add -m32/-m64 to LDFLAGS
 1937   
 1938   libssh2 equivalent of curl patch https://github.com/bagder/curl/commit/d21b66835f2af781a3c2a685abc92ef9f0cd86be
 1939   
 1940   This allows to build for the non-default target when using a multi-target mingw distro.
 1941   Also bump default OpenSSL dependency path to 1.0.2c.
 1942 
 1943 - [Viktor Szakats brought this change]
 1944 
 1945   GNUmakefile: add support for LIBSSH2_LDFLAG_EXTRAS
 1946   
 1947   It is similar to existing LIBSSH2_CFLAG_EXTRAS, but for
 1948   extra linker options.
 1949   
 1950   Also delete some line/file ending whitespace.
 1951   
 1952   closes #27
 1953 
 1954 - [nasacj brought this change]
 1955 
 1956   hostkey.c: Fix compiling error when OPENSSL_NO_MD5 is defined
 1957   
 1958   Closes #32
 1959 
 1960 - [Mizunashi Mana brought this change]
 1961 
 1962   openssl.h: adjust the rsa/dsa includes
 1963   
 1964   ... to work when built without DSA support.
 1965   
 1966   Closes #36
 1967 
 1968 Alexander Lamaison (26 Jul 2015)
 1969 - Let CMake build work as a subproject.
 1970   
 1971   Patch contributed by JasonHaslam.
 1972 
 1973 - Fix builds with Visual Studio 2015.
 1974   
 1975   VS2015 moved stdio functions to the header files as inline function.  That means check_function_exists can't detect them because it doesn't use header files - just does a link check.  Instead we need to use check_symbol_exists with the correct headers.
 1976 
 1977 Kamil Dudka (2 Jul 2015)
 1978 - cmake: include CMake files in the release tarballs
 1979   
 1980   Despite we announced the CMake support in libssh2-1.6.0 release notes,
 1981   the files required by the CMake build system were not included in the
 1982   release tarballs.  Hence, the only way to use CMake for build was the
 1983   upstream git repository.
 1984   
 1985   This commit makes CMake actually supported in the release tarballs.
 1986 
 1987 - tests/mansyntax.sh: fix 'make distcheck' with recent autotools
 1988   
 1989   Do not create symbolic links off the build directory.  Recent autotools
 1990   verify that out-of-source build works even if the source directory tree
 1991   is not writable.
 1992 
 1993 - openssl: fix memleak in _libssh2_dsa_sha1_verify()
 1994 
 1995 Daniel Stenberg (12 Jun 2015)
 1996 - openssl: make libssh2_sha1 return error code
 1997   
 1998   - use the internal prefix _libssh2_ for non-exported functions
 1999   
 2000   - removed libssh2_md5() since it wasn't used
 2001   
 2002   Reported-by: Kamil Dudka
 2003 
 2004 - [LarsNordin-LNdata brought this change]
 2005 
 2006   SFTP: Increase speed and datasize in SFTP read
 2007   
 2008   The function sftp_read never return more then 2000 bytes (as it should
 2009   when I asked Daniel). I increased the MAX_SFTP_READ_SIZE to 30000 but
 2010   didn't get the same speed as a sftp read in SecureSSH. I analyzed the
 2011   code and found that a return always was dona when a chunk has been read.
 2012   I changed it to a sliding buffer and worked on all available chunks. I
 2013   got an increase in speed and non of the test I have done has failed
 2014   (both local net and over Internet). Please review and test. I think
 2015   30000 is still not the optimal MAX_SFTP_READ_SIZE, my next goal is to
 2016   make an API to enable changing this value (The SecureSSH sftp_read has
 2017   more complete filled packages when comparing the network traffic)
 2018 
 2019 - bump: start working on 1.6.1
 2020 
 2021 Version 1.6.0 (5 Jun 2015)
 2022 
 2023 Daniel Stenberg (5 Jun 2015)
 2024 - RELEASE-NOTES: synced with 858930cae5c6a
 2025 
 2026 Marc Hoersken (19 May 2015)
 2027 - wincng.c: fixed indentation
 2028 
 2029 - [sbredahl brought this change]
 2030 
 2031   wincng.c: fixed memleak in (block) cipher destructor
 2032 
 2033 Alexander Lamaison (6 May 2015)
 2034 - [Jakob Egger brought this change]
 2035 
 2036   libssh2_channel_open: more detailed error message
 2037   
 2038   The error message returned by libssh2_channel_open in case of a server side channel open failure is now more detailed and includes the four standard error conditions in RFC 4254.
 2039 
 2040 - [Hannes Domani brought this change]
 2041 
 2042   kex: fix libgcrypt memory leaks of bignum
 2043   
 2044   Fixes #168.
 2045 
 2046 Marc Hoersken (3 Apr 2015)
 2047 - configure.ac: check for SecureZeroMemory for clear memory feature
 2048 
 2049 - Revert "wincng.c: fix clear memory feature compilation with mingw"
 2050   
 2051   This reverts commit 2d2744efdd0497b72b3e1ff6e732aa4c0037fc43.
 2052   
 2053   Autobuilds show that this did not solve the issue.
 2054   And it seems like RtlFillMemory is defined to memset,
 2055   which would be optimized out by some compilers.
 2056 
 2057 - wincng.c: fix clear memory feature compilation with mingw
 2058 
 2059 Alexander Lamaison (1 Apr 2015)
 2060 - [LarsNordin-LNdata brought this change]
 2061 
 2062   Enable use of OpenSSL that doesn't have DSA.
 2063   
 2064   Added #if LIBSSH2_DSA for all DSA functions.
 2065 
 2066 - [LarsNordin-LNdata brought this change]
 2067 
 2068   Use correct no-blowfish #define with OpenSSL.
 2069   
 2070   The OpenSSL define is OPENSSL_NO_BF, not OPENSSL_NO_BLOWFISH.
 2071 
 2072 Marc Hoersken (25 Mar 2015)
 2073 - configure: error if explicitly enabled clear-memory is not supported
 2074   
 2075   This takes 22bd8d81d8fab956085e2079bf8c29872455ce59 and
 2076   b8289b625e291bbb785ed4add31f4759241067f3 into account,
 2077   but still makes it enabled by default if it is supported
 2078   and error out in case it is unsupported and was requested.
 2079 
 2080 Daniel Stenberg (25 Mar 2015)
 2081 - configure: make clear-memory default but only WARN if backend unsupported
 2082   
 2083   ... instead of previous ERROR.
 2084 
 2085 Marc Hoersken (24 Mar 2015)
 2086 - wincng.h: fix warning about computed return value not being used
 2087 
 2088 - nonblocking examples: fix warning about unused tvdiff on Mac OS X
 2089 
 2090 Daniel Stenberg (24 Mar 2015)
 2091 - openssl: fix compiler warnings
 2092 
 2093 - cofigure: fix --disable-clear-memory check
 2094 
 2095 Marc Hoersken (23 Mar 2015)
 2096 - scp.c: improved command length calculation
 2097   
 2098   Reduced number of calls to strlen, because shell_quotearg already
 2099   returns the length of the resulting string (e.q. quoted path)
 2100   which we can add to the existing and known cmd_len.
 2101   Removed obsolete call to memset again, because we can put a final
 2102   NULL-byte at the end of the string using the calculated length.
 2103 
 2104 - scp.c: improved and streamlined formatting
 2105 
 2106 - scp.c: fix that scp_recv may transmit not initialised memory
 2107 
 2108 - scp.c: fix that scp_send may transmit not initialised memory
 2109   
 2110   Fixes ticket 244. Thanks Torsten.
 2111 
 2112 - kex: do not ignore failure of libssh2_sha1_init()
 2113   
 2114   Based upon 43b730ce56f010e9d33573fcb020df49798c1ed8.
 2115   Fixes ticket 290. Thanks for the suggestion, mstrsn.
 2116 
 2117 - wincng.h: fix return code of libssh2_md5_init()
 2118 
 2119 - openssl.c: fix possible segfault in case EVP_DigestInit fails
 2120 
 2121 - wincng.c: fix possible use of uninitialized variables
 2122 
 2123 - wincng.c: fix unused argument warning if clear memory is not enabled
 2124 
 2125 - wincng: Added explicit clear memory feature to WinCNG backend
 2126   
 2127   This re-introduces the original feature proposed during
 2128   the development of the WinCNG crypto backend. It still needs
 2129   to be added to libssh2 itself and probably other backends.
 2130   
 2131   Memory is cleared using the function SecureZeroMemory which is
 2132   available on Windows systems, just like the WinCNG backend.
 2133 
 2134 - wincng.c: fixed mixed line-endings
 2135 
 2136 - wincng.c: fixed use of invalid parameter types in a8d14c5dcf
 2137 
 2138 - wincng.c: only try to load keys corresponding to the algorithm
 2139 
 2140 - wincng.c: moved PEM headers into definitions
 2141 
 2142 - wincng.h: fixed invalid parameter name
 2143 
 2144 - wincng: fixed mismatch with declarations in crypto.h
 2145 
 2146 - userauth.c: fixed warning C6001: using uninitialized sig and sig_len
 2147 
 2148 - pem.c: fixed warning C6269: possible incorrect order of operations
 2149 
 2150 - wincng: add support for authentication keys to be passed in memory
 2151   
 2152   Based upon 18cfec8336e and daa2dfa2db.
 2153 
 2154 - pem.c: add _libssh2_pem_parse_memory to parse PEM from memory
 2155   
 2156   Requirement to implement 18cfec8336e for Libgcrypt and WinCNG.
 2157 
 2158 - pem.c: fix copy and paste mistake from 55d030089b8
 2159 
 2160 - userauth.c: fix another possible dereference of a null pointer
 2161 
 2162 - userauth.c: fix possible dereference of a null pointer
 2163 
 2164 - pem.c: reduce number of calls to strlen in readline
 2165 
 2166 Alexander Lamaison (17 Mar 2015)
 2167 - [Will Cosgrove brought this change]
 2168 
 2169   Initialise HMAC_CTX in more places.
 2170   
 2171   Missed a couple more places we init ctx to avoid openssl threading crash.
 2172 
 2173 - Build build breakage in WinCNG backend caused when adding libssh2_userauth_publickey_frommemory.
 2174   
 2175   The new feature isn't implemented for the WinCNG backend currently, but the WinCNG backend didn't contain any implementation of the required backend functions - even ones that returns an error.  That caused link errors.
 2176   
 2177   This change fixes the problem by providing an implementation of the backend functions that returns an error.
 2178 
 2179 - Fix breakage in WinCNG backend caused by introducing libssh2_hmac_ctx_init.
 2180   
 2181   The macro was defined to nothing for the libgcrypt backend, but not for WinCNG.  This brings the latter into line with the former.
 2182 
 2183 Daniel Stenberg (15 Mar 2015)
 2184 - userauth_publickey_frommemory.3: add AVAILABILITY
 2185   
 2186   ... it will be added in 1.6.0
 2187 
 2188 - libssh2: next version will be called 1.6.0
 2189   
 2190   ... since we just added a new function.
 2191 
 2192 - docs: add libssh2_userauth_publickey_frommemory.3 to dist
 2193   
 2194   The function and man page were added in commit 18cfec8336e
 2195 
 2196 - [Jakob Egger brought this change]
 2197 
 2198   direct_tcpip: Fixed channel write
 2199   
 2200   There were 3 bugs in this loop:
 2201   1) Started from beginning after partial writes
 2202   2) Aborted when 0 bytes were sent
 2203   3) Ignored LIBSSH2_ERROR_EAGAIN
 2204   
 2205   See also:
 2206   https://trac.libssh2.org/ticket/281
 2207   https://trac.libssh2.org/ticket/293
 2208 
 2209 Alexander Lamaison (15 Mar 2015)
 2210 - [Will Cosgrove brought this change]
 2211 
 2212   Must init HMAC_CTX before using it.
 2213   
 2214   Must init ctx before using it or openssl will reuse the hmac which is not thread safe and causes a crash.
 2215   Added libssh2_hmac_ctx_init macro.
 2216 
 2217 - Add continuous integration configurations.
 2218   
 2219   Linux-based CI is done by Travis CI.  Windows-based CI is done by Appveyor.
 2220 
 2221 - [David Calavera brought this change]
 2222 
 2223   Allow authentication keys to be passed in memory.
 2224   
 2225   All credits go to Joe Turpin, I'm just reaplying and cleaning his patch:
 2226   http://www.libssh2.org/mail/libssh2-devel-archive-2012-01/0015.shtml
 2227   
 2228   * Use an unimplemented error for extracting keys from memory with libgcrypt.
 2229 
 2230 Daniel Stenberg (14 Mar 2015)
 2231 - docs: include the renamed INSTALL* files in dist
 2232 
 2233 Alexander Lamaison (13 Mar 2015)
 2234 - Prevent collisions between CMake and Autotools in examples/ and tests/.
 2235 
 2236 - Avoid clash between CMake build and Autotools.
 2237   
 2238   Autotools expects a configuration template file at src/libssh2_config.h.in, which buildconf generates.  But the CMake build system has its CMake-specific version of the file at this path.  This means that, if you don't run buildconf, the Autotools build will fail because it configured the wrong header template.
 2239   
 2240   See https://github.com/libssh2/libssh2/pull/8.
 2241 
 2242 - Merge pull request #8 from alamaison/cmake
 2243   
 2244   CMake build system.
 2245 
 2246 - CMake build system.
 2247   
 2248   Tested:
 2249    - Windows:
 2250       - Visual C++ 2005/2008/2010/2012/2013/MinGW-w64
 2251       - static/shared
 2252       - 32/64-bit
 2253       - OpenSSL/WinCNG
 2254       - Without zlib
 2255    - Linux:
 2256       - GCC 4.6.3/Clang 3.4
 2257       - static/shared
 2258       - 32/64-bit
 2259       - OpenSSL/Libgcrypt
 2260       - With/Without zlib
 2261    - MacOS X
 2262       - AppleClang 6.0.0
 2263       - static
 2264       - 64-bit
 2265       - OpenSSL
 2266       - Without zlib
 2267   
 2268   Conflicts:
 2269           README
 2270 
 2271 - Man man syntax tests fail gracefully if man version is not suitable.
 2272 
 2273 - Return valid code from test fixture on failure.
 2274   
 2275   The sshd test fixture was returning -1 if an error occurred, but negative error codes aren't technically valid (google it).  Bash on Windows converted them to 0 which made setup failure look as though all tests were passing.
 2276 
 2277 - Let mansyntax.sh work regardless of where it is called from.
 2278 
 2279 Daniel Stenberg (12 Mar 2015)
 2280 - [Viktor Szakáts brought this change]
 2281 
 2282   mingw build: allow to pass custom CFLAGS
 2283   
 2284   Allow to pass custom `CFLAGS` options via environment variable
 2285   `LIBSSH2_CFLAG_EXTRAS`. Default and automatically added options of
 2286   `GNUmakefile` have preference over custom ones. This addition is useful
 2287   for passing f.e. custom CPU tuning or LTO optimization (`-flto
 2288   -ffat-lto-objects`) options. The only current way to do this is to edit
 2289   `GNUmakefile`. This patch makes it unnecessary.
 2290   
 2291   This is a mirror of similar libcurl patch:
 2292   https://github.com/bagder/curl/pull/136
 2293 
 2294 - [Will Cosgrove brought this change]
 2295 
 2296   userauth: Fixed prompt text no longer being copied to the prompts struct
 2297   
 2298   Regression from 031566f9c
 2299 
 2300 - README: update the git repo locations
 2301 
 2302 - wait_socket: wrong use of difftime()
 2303   
 2304   With reversed arguments it would always return a negative value...
 2305   
 2306   Bug: https://github.com/bagder/libssh2/issues/1
 2307 
 2308 - bump: start working toward 1.5.1 now
 2309 
 2310 Version 1.5.0 (11 Mar 2015)
 2311 
 2312 Daniel Stenberg (11 Mar 2015)
 2313 - RELEASE-NOTES: 1.5.0 release
 2314 
 2315 - [Mariusz Ziulek brought this change]
 2316 
 2317   kex: bail out on rubbish in the incoming packet
 2318   
 2319   CVE-2015-1782
 2320   
 2321   Bug: http://www.libssh2.org/adv_20150311.html
 2322 
 2323 - docs: move INSTALL, AUTHORS, HACKING and TODO to docs/
 2324   
 2325   And with this, cleanup README to be shorter and mention the new source
 2326   code home.
 2327 
 2328 - .gitignore: don't ignore INSTALL
 2329 
 2330 Dan Fandrich (4 Mar 2015)
 2331 - examples/x11.c: include sys/select.h for improved portability
 2332 
 2333 Daniel Stenberg (4 Mar 2015)
 2334 - RELEASE-NOTES: synced with a8473c819bc068
 2335   
 2336   In preparation for the upcoming 1.5.0 release.
 2337 
 2338 Guenter Knauf (8 Jan 2015)
 2339 - NetWare build: added some missing exports.
 2340 
 2341 Marc Hoersken (29 Dec 2014)
 2342 - knownhost.c: fix use of uninitialized argument variable wrote
 2343   
 2344   Detected by clang scan in       line 1195, column 18.
 2345 
 2346 - examples/x11.c: fix result of operation is garbage or undefined
 2347   
 2348   Fix use of uninitialized structure w_size_bck.
 2349   Detected by clang scan in       line 386, column 28.
 2350 
 2351 - examples/x11.c: remove dead assigments of some return values
 2352   
 2353   Detected by clang scan in line 212, column 9.
 2354   Detected by clang scan in line 222, column 13.
 2355   Detected by clang scan in       line 410, column 13.
 2356 
 2357 - examples/x11.c: fix possible memory leak if read fails
 2358   
 2359   Detected by clang scan in line 224, column 21.
 2360 
 2361 - examples/x11.c: fix invalid removal of first list element
 2362   
 2363   Fix use of memory after it was being freed.
 2364   Detected by clang scan in line 56, column 12.
 2365 
 2366 - userauth.c: make sure that sp_len is positive and avoid overflows
 2367   
 2368   ... if the pointer subtraction of sp1 - pubkey - 1 resulted in a
 2369   negative or larger value than pubkey_len, memchr would fail.
 2370   
 2371   Reported by Coverity CID 89846.
 2372 
 2373 - channel.c: remove logically dead code, host cannot be NULL here
 2374   
 2375   ... host cannot be NULL in line 525, because it is always
 2376   valid (e.g. at least set to "0.0.0.0") after lines 430 and 431.
 2377   
 2378   Reported by Coverity CID 89807.
 2379 
 2380 - session.c: check return value of session_nonblock during startup
 2381   
 2382   Reported by Coverity CID 89803.
 2383 
 2384 - session.c: check return value of session_nonblock in debug mode
 2385   
 2386   Reported by Coverity CID 89805.
 2387 
 2388 - pem.c: fix mixed line-endings introduced with 8670f5da24
 2389 
 2390 - pem.c: make sure there's a trailing zero and b64data is not NULL
 2391   
 2392   ... if there is no base64 data between PEM header and footer.
 2393   Reported by Coverity CID 89823.
 2394 
 2395 - kex.c: make sure mlist is not set to NULL
 2396   
 2397   ... if the currently unsupported LANG methods are called.
 2398   Reported by Coverity CID 89834.
 2399 
 2400 - packet.c: i < 256 was always true and i would overflow to 0
 2401   
 2402   Visualize that the 0-termination is intentional, because the array
 2403   is later passed to strlen within _libssh2_packet_askv.
 2404 
 2405 - silence multiple data conversion warnings
 2406 
 2407 Daniel Stenberg (23 Dec 2014)
 2408 - agent_connect_unix: make sure there's a trailing zero
 2409   
 2410   ... if the path name was too long. Reported by Coverity CID 89801.
 2411 
 2412 Marc Hoersken (22 Dec 2014)
 2413 - examples on Windows: use native SOCKET-type instead of int
 2414   
 2415   And check return values accordingly.
 2416 
 2417 - userauth.c: improve readability and clarity of for-loops
 2418 
 2419 Daniel Stenberg (22 Dec 2014)
 2420 - calloc: introduce LIBSSH2_CALLOC()
 2421   
 2422   A simple function using LIBSSH2_ALLOC + memset, since this pattern was
 2423   used in multiple places and this simplies code in general.
 2424 
 2425 Marc Hoersken (15 Dec 2014)
 2426 - libssh2_priv.h: Ignore session, context and format parameters
 2427 
 2428 - x11 example: check return value of socket function
 2429 
 2430 - examples: fixed mixed line-endings introduced with aedfba25b8
 2431 
 2432 - wincng.c: explicitly ignore BCrypt*AlgorithmProvider return codes
 2433   
 2434   Fixes VS2012 code analysis warning C6031:
 2435   return value ignored: <function> could return unexpected value
 2436 
 2437 - wincng.c: fix possible invalid memory write access
 2438   
 2439   Fixes VS2012 code analysis warning C6386:
 2440   buffer overrun: accessing 'pbOutput', the writable size is
 2441   'cbOutput' bytes, but '3' bytes may be written: libssh2 wincng.c 610
 2442 
 2443 - tests on Windows: check for WSAStartup return code
 2444   
 2445   Fixes VS2012 code analysis warning C6031:
 2446   return value ignored: <function> could return unexpected value
 2447 
 2448 - wincng.c: fix possible NULL pointer de-reference of bignum
 2449   
 2450   Fixes VS2012 code analysis warning C6011:
 2451   dereferencing NULL pointer 'bignum'. libssh2 wincng.c 1567
 2452 
 2453 - wincng.c: fix possible use of uninitialized memory
 2454   
 2455   Fixes VS2012 code analysis warning C6001:
 2456   using uninitialized memory 'cbDecoded'. libssh2 wincng.c 553
 2457 
 2458 - packet.c: fix possible NULL pointer de-reference within listen_state
 2459   
 2460   Fixes VS2012 code analysis warning C6011:
 2461   dereferencing NULL pointer 'listen_state->channel'. libssh2 packet.c 221
 2462 
 2463 - kex.c: fix possible NULL pointer de-reference with session->kex
 2464   
 2465   Fixes VS2012 code analysis warning C6011:
 2466   dereferencing NULL pointer 'session->kex'. libssh2 kex.c 1761
 2467 
 2468 - agent.c: check return code of MapViewOfFile
 2469   
 2470   Fixes VS2012 code analysis warning C6387: 'p+4' may be '0':
 2471   this does not adhere to the specification for the function
 2472   'memcpy': libssh2 agent.c 330
 2473   
 2474   Fixes VS2012 code analysis warning C6387: 'p' may be '0':
 2475   this does not adhere to the specification for the function
 2476   'UnmapViewOfFile': libssh2 agent.c 333
 2477 
 2478 - examples on Windows: check for socket return code
 2479   
 2480   Fixes VS2012 code analysis warning C28193:
 2481   The variable holds a value that must be examined
 2482 
 2483 - examples on Windows: check for WSAStartup return code
 2484   
 2485   Fixes VS2012 code analysis warning C6031:
 2486   return value ignored: <function> could return unexpected value
 2487 
 2488 Guenter Knauf (11 Dec 2014)
 2489 - wincng.c: silent some more gcc compiler warnings.
 2490 
 2491 - wincng.c: silent gcc compiler warnings.
 2492 
 2493 - Watcom build: added support for WinCNG build.
 2494 
 2495 - build: updated dependencies in makefiles.
 2496 
 2497 Daniel Stenberg (4 Dec 2014)
 2498 - configure: change LIBS not LDFLAGS when checking for libs
 2499   
 2500   Closes #289
 2501   
 2502   Patch-by: maurerpe
 2503 
 2504 Guenter Knauf (3 Dec 2014)
 2505 - MinGW build: some more GNUMakefile tweaks.
 2506   
 2507   test/GNUmakefile: added architecture autodetection; added switches to
 2508   CFLAGS and RCFLAGS to make sure that the right architecture is used.
 2509   Added support to build with WinCNG.
 2510 
 2511 - sftpdir.c: added authentication method detection.
 2512   
 2513   Stuff copied over from ssh2.c to make testing a bit easier.
 2514 
 2515 - NMake build: fixed LIBS settings.
 2516 
 2517 - NMake build: added support for WinCNG build.
 2518 
 2519 - MinGW build: some GNUMakefile tweaks.
 2520   
 2521   Added architecture autodetection; added switches to CFLAGS and
 2522   RCFLAGS to make sure that the right architecture is used.
 2523   Added support to build with WinCNG.
 2524 
 2525 - MinGW build: Fixed redefine warnings.
 2526 
 2527 - Updated copyright year.
 2528 
 2529 Daniel Stenberg (31 Aug 2014)
 2530 - COPYING: bump the copyright year
 2531 
 2532 Dan Fandrich (28 Jul 2014)
 2533 - docs: fixed a bunch of typos
 2534 
 2535 - docs: added missing libssh2_session_handshake.3 file
 2536 
 2537 Marc Hoersken (19 May 2014)
 2538 - wincng.c: specify the required libraries for dependencies using MSVC
 2539   
 2540   Initially reported by Bob Kast as "for MS VS builds, specify the
 2541   libraries that are required so they don't need to go into all
 2542   project files that may use this library". Thanks a lot.
 2543 
 2544 - [Bob Kast brought this change]
 2545 
 2546   windows build: do not export externals from static library
 2547   
 2548   If you are building a DLL, then you need to explicitly export each
 2549   entry point. When building a static library, you should not.
 2550   
 2551   libssh2 was exporting the entry points whether it was building a DLL or a
 2552   static library. To elaborate further, if libssh2 was used as a static
 2553   library, which was being linked into a DLL, the libssh2 API would be
 2554   exported from that separate DLL.
 2555 
 2556 Daniel Stenberg (19 May 2014)
 2557 - [Mikhail Gusarov brought this change]
 2558 
 2559   Fix typos in manpages
 2560 
 2561 Marc Hoersken (18 May 2014)
 2562 - wincng.c: Fixed memory leak in case of an error during ASN.1 decoding
 2563 
 2564 - configure: Display individual crypto backends on separate lines
 2565   
 2566   This avoids line-wrapping in between parameters and makes the
 2567   error message look like the following:
 2568   
 2569   configure: error: No crypto library found!
 2570   Try --with-libssl-prefix=PATH
 2571    or --with-libgcrypt-prefix=PATH
 2572    or --with-wincng on Windows
 2573 
 2574 - [Bob Kast brought this change]
 2575 
 2576   libssh2_priv.h: a 1 bit bit-field should be unsigned
 2577   
 2578   some compilers may not like this
 2579 
 2580 - knownhost.c: Fixed warning that pointer targets differ in signedness
 2581 
 2582 - wincng.c: Fixed warning about pointer targets differing in signedness
 2583 
 2584 - tcpip-forward.c: Fixed warning that pointer targets differ in signedness
 2585   
 2586   libssh2_channel_forward_listen_ex uses ints instead of unsigned ints.
 2587 
 2588 - misc.c: Fixed warning about mixed declarations and code
 2589 
 2590 - libgcrypt.h: Fixed warning about pointer targets differing in signedness
 2591 
 2592 - wincng.h: Fixed warning about pointer targets differing in signedness
 2593 
 2594 - misc.c: Fixed warning about unused parameter abstract
 2595 
 2596 - tcpip-forward.c: Removed unused variables shost, sport and sockopt
 2597 
 2598 - wincng.h: Added forward declarations for all WinCNG functions
 2599   
 2600   Initially reported by Bob Kast as "Wincng - define function
 2601   prototypes for wincng routines". Thanks a lot.
 2602   
 2603   Also replaced structure definitions with type definitions.
 2604 
 2605 - [Bob Kast brought this change]
 2606 
 2607   libssh2.h: on Windows, a socket is of type SOCKET, not int
 2608 
 2609 - win32: Added WinCNG targets to generated Visual Studio project
 2610   
 2611   Inspired by Bob Kast's reports, this commit enables the compilation
 2612   of libssh2 with WinCNG using the generated Visual Studio project files.
 2613   This commit adds WinCNG support to parts of the existing Win32 build
 2614   infrastructure, until new build systems, like pre-defined VS project
 2615   files or CMake files may be added.
 2616   
 2617   This commit and b20bfeb3e519119a48509a1099c06d65aa7da1d7 raise one
 2618   question: How to handle build systems, like VS project files, that
 2619   need to include all source files regardless of the desired target,
 2620   including all supported crypto backends? For now the mentioned commit
 2621   added a check for LIBSSH2_OPENSSL to openssl.c and with this commit
 2622   the supported crypto backends are hardcoded within Makefile.am.
 2623 
 2624 - libssh2_priv msvc: Removed redundant definition of inline keyword
 2625   
 2626   Initially reported by Bob Kast as "Remove redundant 'inline' define".
 2627   Thanks a lot.
 2628 
 2629 - wincng: Made data parameter to hash update function constant
 2630   
 2631   Initially reported by Bob Kast as "formal parameter must be const
 2632   since it is used in contexts where the actual parameter may be const".
 2633   Thanks a lot.
 2634 
 2635 - wincng: fix cross-compilation against the w64 mingw-runtime package
 2636 
 2637 - openssl: Check for LIBSSH2_OPENSSL in order to compile with openssl
 2638 
 2639 - wincng: Fixed use of possible uninitialized variable pPaddingInfo
 2640   
 2641   Reported by Bob Kast, thanks a lot.
 2642 
 2643 - wincng: Added cast for double to unsigned long conversion
 2644 
 2645 - wincng: Cleaned up includes and check NTSTATUS using macro
 2646   
 2647   Removed header file combination that is not supported on a real
 2648   Windows platform and can only be compiled using MinGW. Replaced
 2649   custom NTSTATUS return code checks with BCRYPT_SUCCESS macro.
 2650 
 2651 Daniel Stenberg (16 Mar 2014)
 2652 - userauth_hostbased_fromfile: zero assign to avoid uninitialized use
 2653   
 2654   Detected by clang-analyze
 2655 
 2656 - channel_receive_window_adjust: store windows size always
 2657   
 2658   Avoid it sometimes returning without storing it, leaving calling
 2659   functions with unknown content!
 2660   
 2661   Detected by clang-analyzer
 2662 
 2663 - publickey_packet_receive: avoid junk in returned pointers
 2664   
 2665   clang-analyzer found this risk it would return a non-initialized pointer
 2666   in a success case
 2667 
 2668 Peter Stuge (16 Mar 2014)
 2669 - [Marc Hoersken brought this change]
 2670 
 2671   Added Windows Cryptography API: Next Generation based backend
 2672 
 2673 - [Marc Hoersken brought this change]
 2674 
 2675   knownhost.c: fixed that 'key_type_len' may be used uninitialized
 2676   
 2677   ../src/knownhost.c: In function 'libssh2_knownhost_readline':
 2678   ../src/knownhost.c:651:16: warning: 'key_type_len' may be used
 2679   uninitialized in this function [-Wmaybe-uninitialized]
 2680                rc = knownhost_add(hosts, hostbuf, NULL,
 2681                   ^
 2682   ../src/knownhost.c:745:12: note: 'key_type_len' was declared here
 2683        size_t key_type_len;
 2684               ^
 2685 
 2686 - [Marc Hoersken brought this change]
 2687 
 2688   pem.c: always compile pem.c independently of crypto backend
 2689 
 2690 - Fix non-autotools builds: Always define the LIBSSH2_OPENSSL CPP macro
 2691   
 2692   Commit d512b25f69a1b6778881f6b4b5ff9cfc6023be42 introduced a crypto
 2693   library abstraction in the autotools build system, to allow us to more
 2694   easily support new crypto libraries. In that process it was found that
 2695   all other build system which we support are hard-coded to build with
 2696   OpenSSL. Commit f5c1a0d98bd51aeb24aca3d49c7c81dcf8bd858d fixes automake
 2697   introduced into non-autotools build systems but still overlooked the
 2698   CPP macro saying that we are using OpenSSL.
 2699   
 2700   Thanks to Marc Hörsken for identifying this issue and proposing a fix
 2701   for win32/{GNUmakefile,config.mk}. This commit uses a slightly different
 2702   approach but the end result is the same.
 2703 
 2704 Dan Fandrich (15 Mar 2014)
 2705 - channel_close: Close the channel even in the case of errors
 2706 
 2707 - sftp_close_handle: ensure the handle is always closed
 2708   
 2709   Errors are reported on return, but otherwise the close path is
 2710   completed as much as possible and the handle is freed on exit.
 2711 
 2712 Alexander Lamaison (6 Mar 2014)
 2713 - knownhost: Restore behaviour of `libssh2_knownhost_writeline` with short buffer.
 2714   
 2715   Commit 85c6627c changed the behaviour of `libssh2_knownhost_writeline` so that it stopped returning the number of bytes needed when the given buffer was too small.  Also, the function changed such that is might write to part of the buffer before realising it is too small.
 2716   
 2717   This commit restores the original behaviour, whilst keeping the unknown-key-type functionality that 85c6627c.  Instead of writing to the buffer piecemeal, the length of the various parts is calculated up front and the buffer written only if there is enough space.  The calculated necessary size is output in `outlen` regardless of whether the buffer was written to.
 2718   
 2719   The main use-case for the original behaviour that this commit restores is to allow passing in a NULL buffer to get the actual buffer size needed, before calling the function again with the buffer allocated to the exact size required.
 2720 
 2721 - knownhost: Fix DSS keys being detected as unknown.
 2722   
 2723   I missing `else` meant ssh-dss format keys were being re-detected as unknown format.
 2724 
 2725 Dan Fandrich (6 Mar 2014)
 2726 - knownhosts: Abort if the hosts buffer is too small
 2727   
 2728   This could otherwise cause a match on the wrong host
 2729 
 2730 - agent_list_identities: Fixed memory leak on OOM
 2731 
 2732 - Fixed a few typos
 2733 
 2734 - userauth: Fixed an attempt to free from stack on error
 2735 
 2736 - Fixed a few memory leaks in error paths
 2737 
 2738 - Fixed two potential use-after-frees of the payload buffer
 2739   
 2740   The first might occur if _libssh2_packet_add returns an error, as
 2741   fullpacket_state wasn't reset to idle so if it were possible for
 2742   fullpacket to be called again, it would return to the same state
 2743   handler and re-use the freed p->packet buffer.
 2744   
 2745   The second could occur if decrypt returned an error, as it freed the
 2746   packet buffer but did not clear total_num, meaning that freed buffer
 2747   could be written into again later.
 2748 
 2749 Alexander Lamaison (28 Nov 2013)
 2750 - Fix missing `_libssh2_error` in `_libssh2_channel_write`.
 2751   
 2752   In one case, the error code from `_libssh2_transport_read` was being returned from `_libssh2_channel_write` without setting it as the last error by calling `_libssh2_error`.  This commit fixes that.
 2753   
 2754   Found when using a session whose socket had been inadvertently destroyed.  The calling code got confused because via `libssh2_session_last_error` it appeared no error had occurred, despite one being returned from the previous function.
 2755 
 2756 Kamil Dudka (21 Nov 2013)
 2757 - [Mark McPherson brought this change]
 2758 
 2759   openssl: initialise the digest context before calling EVP_DigestInit()
 2760   
 2761   When using the OpenSSL libraries in FIPS mode, the function call
 2762   EVP_DigestInit() is actually #defined to FIPS_digestinit().
 2763   Unfortunately wheres EVP_DigestInit() initialises the context and then
 2764   calls EVP_DigestInit_ex(), this function assumes that the context has
 2765   been pre-initialised and crashes when it isn't.
 2766   
 2767   Bug: https://trac.libssh2.org/ticket/279
 2768   
 2769   Fixes #279
 2770 
 2771 - [Marc Hörsken brought this change]
 2772 
 2773   .gitignore: Ignore files like src/libssh2_config.h.in~
 2774 
 2775 Peter Stuge (13 Nov 2013)
 2776 - Move automake conditionals added by commit d512b25f out of Makefile.inc
 2777   
 2778   Commit d512b25f69a1b6778881f6b4b5ff9cfc6023be42 added automake
 2779   conditionals to Makefile.inc but since Makefile.inc is included
 2780   from Makefile for all other build systems that does not work.
 2781   
 2782   This commit instead adds Makefile.OpenSSL.inc and Makefile.libgcrypt.inc
 2783   and moves the automake conditional to its proper place, src/Makefile.am.
 2784   
 2785   The automake conditional includes the correct Makefile.$name.inc per
 2786   the crypto library selection/detection done by configure.
 2787   
 2788   All non-autotools build system files in libssh2 are hardcoded to use
 2789   OpenSSL and do not get a conditional but at least there is some reuse
 2790   because they can all include the new Makefile.OpenSSL.inc.
 2791 
 2792 Daniel Stenberg (27 Oct 2013)
 2793 - [Salvador Fandino brought this change]
 2794 
 2795   Set default window size to 2MB
 2796   
 2797   The default channel window size used until now was 256KB. This value is
 2798   too small and results on a bottleneck on real-life networks where
 2799   round-trip delays can easily reach 300ms.
 2800   
 2801   The issue was not visible because the configured channel window size
 2802   was being ignored and a hard-coded value of ~22MB being used instead,
 2803   but that was fixed on a previous commit.
 2804   
 2805   This patch just changes the default window size
 2806   (LIBSSH2_CHANNEL_WINDOW_DEFAULT) to 2MB. It is the same value used by
 2807   OpenSSH and in our opinion represents a good compromise between memory
 2808   used and transfer speed.
 2809   
 2810   Performance tests were run to determine the optimum value. The details
 2811   and related discussion are available from the following thread on the
 2812   libssh2 mailing-list:
 2813   
 2814   http://www.libssh2.org/mail/libssh2-devel-archive-2013-10/0018.shtml
 2815   http://article.gmane.org/gmane.network.ssh.libssh2.devel/6543
 2816   
 2817   An excerpt follows:
 2818   
 2819   "I have been running some transfer test and measuring their speed.
 2820   
 2821   My setup was composed of a quad-core Linux machine running Ubuntu 13.10
 2822   x86_64 with a LXC container inside. The data transfers were performed
 2823   from the container to the host (never crossing through a physical
 2824   network device).
 2825   
 2826   Network delays were simulated using the tc tool. And ping was used to
 2827   verify that they worked as intended during the tests.
 2828   
 2829   The operation performed was the equivalent to the following ssh command:
 2830   
 2831     $ ssh container "dd bs=16K count=8K if=/dev/zero" >/dev/null
 2832   
 2833   Though, establishment and closing of the SSH connection was excluded
 2834   from the timings.
 2835   
 2836   I run the tests several times transferring files of sizes up to 128MB
 2837   and the results were consistent between runs.
 2838   
 2839   The results corresponding to the 128MB transfer are available here:
 2840   
 2841   https://docs.google.com/spreadsheet/ccc?key=0Ao1yRmX6PQQzdG5wSFlrZl9HRWNET3ZyN0hnaGo5ZFE&usp=sharing
 2842   
 2843   It clearly shows that 256KB is too small as the default window size.
 2844   Moving to a 512MB generates a great improvement and after the 1MB mark
 2845   the returns rapidly diminish. Other factors (TCP window size, probably)
 2846   become more limiting than the channel window size
 2847   
 2848   For comparison I also performed the same transfers using OpenSSH. Its
 2849   speed is usually on par with that of libssh2 using a window size of 1MB
 2850   (even if it uses a 2MB window, maybe it is less aggressive sending the
 2851   window adjust msgs)."
 2852   
 2853   Signed-off-by: Salvador Fandino <sfandino@yahoo.com>
 2854 
 2855 - [Salvador brought this change]
 2856 
 2857   _libssh2_channel_read: Honour window_size_initial
 2858   
 2859   _libssh2_channel_read was using an arbitrary hard-coded limit to trigger
 2860   the window adjusting code. The adjustment used was also hard-coded and
 2861   arbitrary, 15MB actually, which would limit the usability of libssh2 on
 2862   systems with little RAM.
 2863   
 2864   This patch, uses the window_size parameter passed to
 2865   libssh2_channel_open_ex (stored as remote.window_size_initial) plus the
 2866   buflen as the base for the trigger and the adjustment calculation.
 2867   
 2868   The memory usage when using the default window size is reduced from 22MB
 2869   to 256KB per channel (actually, if compression is used, these numbers
 2870   should be incremented by ~50% to account for the errors between the
 2871   decompressed packet sizes and the predicted sizes).
 2872   
 2873   My tests indicate that this change does not impact the performance of
 2874   transfers across localhost or a LAN, being it on par with that of
 2875   OpenSSH. On the other hand, it will probably slow down transfers on
 2876   networks with high bandwidth*delay when the default window size
 2877   (LIBSSH2_CHANNEL_WINDOW_DEFAULT=256KB) is used.
 2878   
 2879   Signed-off-by: Salvador Fandino <sfandino@yahoo.com>
 2880 
 2881 - [Salvador Fandino brought this change]
 2882 
 2883   knownhosts: handle unknown key types
 2884   
 2885   Store but don't use keys of unsupported types on the known_hosts file.
 2886   
 2887   Currently, when libssh2 parses a known_host file containing keys of some
 2888   type it doesn't natively support, it stops reading the file and returns
 2889   an error.
 2890   
 2891   That means, that the known_host file can not be safely shared with other
 2892   software supporting other key types (i.e. OpenSSH).
 2893   
 2894   This patch adds support for handling keys of unknown type. It can read
 2895   and write them, even if they are never going to be matched.
 2896   
 2897   At the source level the patch does the following things:
 2898   
 2899   - add a new unknown key type LIBSSH2_KNOWNHOST_KEY_UNKNOWN
 2900   
 2901   - add a new slot (key_type_name) on the known_host struct that is
 2902   used to store the key type in ascii form when it is not supported
 2903   
 2904   - parse correctly known_hosts entries with unknown key types and
 2905   populate the key_type_name slot
 2906   
 2907   - print correctly known_hosts entries of unknown type
 2908   
 2909   - when checking a host key ignore keys that do not match the key
 2910   
 2911   Fixes #276
 2912 
 2913 - windows build: fix build errors
 2914   
 2915   Fixes various link errors with VS2010
 2916   
 2917   Reported-by: "kdekker"
 2918   Fixes #272
 2919 
 2920 - man page: add missing function argument
 2921   
 2922   for libssh2_userauth_publickey_fromfile_ex()
 2923   
 2924   Reported-by: "pastey"
 2925   
 2926   Fixes #262
 2927 
 2928 - [Salvador brought this change]
 2929 
 2930   Fix zlib deflate usage
 2931   
 2932   Deflate may return Z_OK even when not all data has been compressed
 2933   if the output buffer becomes full.
 2934   
 2935   In practice this is very unlikely to happen because the output buffer
 2936   size is always some KBs larger than the size of the data passed for
 2937   compression from the upper layers and I think that zlib never expands
 2938   the data so much, even on the worst cases.
 2939   
 2940   Anyway, this patch plays on the safe side checking that the output
 2941   buffer is not exhausted.
 2942   
 2943   Signed-off-by: Salvador <sfandino@yahoo.com>
 2944 
 2945 - [Salvador brought this change]
 2946 
 2947   comp_method_zlib_decomp: Improve buffer growing algorithm
 2948   
 2949   The old algorithm was O(N^2), causing lots and lots of reallocations
 2950   when highly compressed data was transferred.
 2951   
 2952   This patch implements a simpler one that just doubles the buffer size
 2953   everytime it is exhausted. It results in O(N) complexity.
 2954   
 2955   Also a smaller inflate ratio is used to calculate the initial size (x4).
 2956   
 2957   Signed-off-by: Salvador <sfandino@yahoo.com>
 2958 
 2959 - [Salvador brought this change]
 2960 
 2961   Fix zlib usage
 2962   
 2963   Data may remain in zlib internal buffers when inflate() returns Z_OK
 2964   and avail_out == 0. In that case, inflate has to be called again.
 2965   
 2966   Also, once all the data has been inflated, it returns Z_BUF_ERROR to
 2967   signal that the input buffer has been exhausted.
 2968   
 2969   Until now, the way to detect that a packet payload had been completely
 2970   decompressed was to check that no data remained on the input buffer
 2971   but that didn't account for the case where data remained on the internal
 2972   zlib buffers.
 2973   
 2974   That resulted in packets not being completely decompressed and the
 2975   missing data reappearing on the next packet, though the bug was masked
 2976   by the buffer allocation algorithm most of the time and only manifested
 2977   when transferring highly compressible data.
 2978   
 2979   This patch fixes the zlib usage.
 2980   
 2981   Signed-off-by: Salvador <sfandino@yahoo.com>
 2982 
 2983 - [Salvador brought this change]
 2984 
 2985   _libssh2_channel_read: fix data drop when out of window
 2986   
 2987   After filling the read buffer with data from the read queue, when the
 2988   window size was too small, "libssh2_channel_receive_window_adjust" was
 2989   called to increase it. In non-blocking mode that function could return
 2990   EAGAIN and, in that case, the EAGAIN was propagated upwards and the data
 2991   already read on the buffer lost.
 2992   
 2993   The function was also moving between the two read states
 2994   "libssh2_NB_state_idle" and "libssh2_NB_state_created" both of which
 2995   behave in the same way (excepting a debug statment).
 2996   
 2997   This commit modifies "_libssh2_channel_read" so that the
 2998   "libssh2_channel_receive_window_adjust" call is performed first (when
 2999   required) and if everything goes well, then it reads the data from the
 3000   queued packets into the read buffer.
 3001   
 3002   It also removes the useless "libssh2_NB_state_created" read state.
 3003   
 3004   Some rotted comments have also been updated.
 3005   
 3006   Signed-off-by: Salvador <sfandino@yahoo.com>
 3007 
 3008 - [Salvador Fandino brought this change]
 3009 
 3010   window_size: redid window handling for flow control reasons
 3011   
 3012   Until now, the window size (channel->remote.window_size) was being
 3013   updated just after receiving the packet from the transport layer.
 3014   
 3015   That behaviour is wrong because the channel queue may grow uncontrolled
 3016   when data arrives from the network faster that the upper layer consumes
 3017   it.
 3018   
 3019   This patch adds a new counter, read_avail, which keeps a count of the
 3020   bytes available from the packet queue for reading. Also, now the window
 3021   size is adjusted when the data is actually read by an upper layer.
 3022   
 3023   That way, if the upper layer stops reading data, the window will
 3024   eventually fill and the remote host will stop sending data. When the
 3025   upper layers reads enough data, a window adjust packet is delivered and
 3026   the transfer resumes.
 3027   
 3028   The read_avail counter is used to detect the situation when the remote
 3029   server tries to send data surpassing the window size. In that case, the
 3030   extra data is discarded.
 3031   
 3032   Signed-off-by: Salvador <sfandino@yahoo.com>
 3033 
 3034 Peter Stuge (15 Sep 2013)
 3035 - configure.ac: Call zlib zlib and not libz in text but keep option names
 3036 
 3037 - configure.ac: Reorder --with-* options in --help output
 3038 
 3039 - configure.ac: Rework crypto library detection
 3040   
 3041   This further simplifies adding new crypto libraries.
 3042 
 3043 - Clean up crypto library abstraction in build system and source code
 3044   
 3045   libssh2 used to explicitly check for libgcrypt and default to OpenSSL.
 3046   
 3047   Now all possible crypto libraries are checked for explicitly, making
 3048   the addition of further crypto libraries both simpler and cleaner.
 3049 
 3050 - configure.ac: Add zlib to Requires.private in libssh2.pc if using zlib
 3051 
 3052 - Revert "Added Windows Cryptography API: Next Generation based backend"
 3053   
 3054   This reverts commit d385230e15715e67796f16f3e65fd899f21a638b.
 3055 
 3056 Daniel Stenberg (7 Sep 2013)
 3057 - [Leif Salomonsson brought this change]
 3058 
 3059   sftp_statvfs: fix for servers not supporting statfvs extension
 3060   
 3061   Fixes issue arising when server does not support statfvs and or fstatvfs
 3062   extensions. sftp_statvfs() and sftp_fstatvfs() after this patch will
 3063   handle the case when SSH_FXP_STATUS is returned from server.
 3064 
 3065 - [Marc Hoersken brought this change]
 3066 
 3067   Added Windows Cryptography API: Next Generation based backend
 3068 
 3069 - [Kamil Dudka brought this change]
 3070 
 3071   partially revert "window_size: explicit adjustments only"
 3072   
 3073   This partially reverts commit 03ca9020756a4e16f0294e5b35e9826ee6af2364
 3074   in order to fix extreme slowdown when uploading to localhost via SFTP.
 3075   
 3076   I was able to repeat the issue on RHEL-7 on localhost only.  It did not
 3077   occur when uploading via network and it did not occur on a RHEL-6 box
 3078   with the same version of libssh2.
 3079   
 3080   The problem was that sftp_read() used a read-ahead logic to figure out
 3081   the window_size, but sftp_packet_read() called indirectly from
 3082   sftp_write() did not use any read-ahead logic.
 3083 
 3084 - _libssh2_channel_write: client spins on write when window full
 3085   
 3086   When there's no window to "write to", there's no point in waiting for
 3087   the socket to become writable since it most likely just will continue to
 3088   be.
 3089   
 3090   Patch-by: ncm
 3091   Fixes #258
 3092 
 3093 - _libssh2_channel_forward_cancel: avoid memory leaks on error
 3094   
 3095   Fixes #257
 3096 
 3097 - _libssh2_packet_add: avoid using uninitialized memory
 3098   
 3099   In _libssh2_packet_add, called by _libssh2_packet_read, a call to
 3100   _libssh2_packet_send that is supposed to send a one-byte message
 3101   SSH_MSG_REQUEST_FAILURE would send an uninitialized byte upon re-entry
 3102   if its call to _send returns _EAGAIN.
 3103   
 3104   Fixes #259
 3105 
 3106 - _libssh2_channel_forward_cancel: accessed struct after free
 3107   
 3108   ... and the assignment was pointless anyway since the struct was about
 3109   to be freed. Bug introduced in dde2b094.
 3110   
 3111   Fixes #268
 3112 
 3113 Peter Stuge (2 Jun 2013)
 3114 - [Marc Hoersken brought this change]
 3115 
 3116   Fixed compilation using mingw-w64
 3117 
 3118 - [Marc Hoersken brought this change]
 3119 
 3120   knownhost.c: use LIBSSH2_FREE macro instead of free
 3121   
 3122   Use LIBSSH2_FREE instead of free since
 3123   _libssh2_base64_encode uses LIBSSH2_ALLOC
 3124 
 3125 Daniel Stenberg (18 May 2013)
 3126 - [Matthias Kerestesch brought this change]
 3127 
 3128   libssh2_agent_init: init ->fd to LIBSSH2_INVALID_SOCKET
 3129   
 3130   ... previously it was left at 0 which is a valid file descriptor!
 3131   
 3132   Bug: https://trac.libssh2.org/ticket/265
 3133   
 3134   Fixes #265
 3135 
 3136 - userauth_password: pass on the underlying error code
 3137   
 3138   _libssh2_packet_requirev() may return different errors and we pass that
 3139   to the parent instead of rewriting it.
 3140   
 3141   Bug: http://libssh2.org/mail/libssh2-devel-archive-2013-04/0029.shtml
 3142   Reported by: Cosmin
 3143 
 3144 Peter Stuge (9 May 2013)
 3145 - [Marc Hoersken brought this change]
 3146 
 3147   libcrypt.c: Fix typo in _libssh2_rsa_sha1_sign() parameter type
 3148 
 3149 Kamil Dudka (4 May 2013)
 3150 - configure.ac: replace AM_CONFIG_HEADER with AC_CONFIG_HEADERS
 3151   
 3152   Reported by: Quintus
 3153   Bug: https://trac.libssh2.org/ticket/261
 3154 
 3155 Guenter Knauf (12 Apr 2013)
 3156 - Fixed copyright string for NetWare build.
 3157 
 3158 Daniel Stenberg (9 Apr 2013)
 3159 - [Richard W.M. Jones brought this change]
 3160 
 3161   sftp: Add support for fsync (OpenSSH extension).
 3162   
 3163   The new libssh2_sftp_fsync API causes data and metadata in the
 3164   currently open file to be committed to disk at the server.
 3165   
 3166   This is an OpenSSH extension to the SFTP protocol.  See:
 3167   
 3168   https://bugzilla.mindrot.org/show_bug.cgi?id=1798
 3169 
 3170 - [Richard W.M. Jones brought this change]
 3171 
 3172   sftp: statvfs: Along error path, reset the correct 'state' variable.
 3173 
 3174 - [Richard W.M. Jones brought this change]
 3175 
 3176   sftp: seek: Don't flush buffers on same offset
 3177   
 3178   Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
 3179 
 3180 Guenter Knauf (9 Feb 2013)
 3181 - Updated dependency libs.
 3182 
 3183 - Fixed tool macro names.
 3184 
 3185 Daniel Stenberg (29 Nov 2012)
 3186 - [Seth Willits brought this change]
 3187 
 3188   compiler warnings: typecast strlen in macros
 3189   
 3190   ... in macro parameters to avoid compiler warnings about lost precision.
 3191   
 3192   Several macros in libssh2.h call strlen and pass the result directly to
 3193   unsigned int parameters of other functions, which warns about precision
 3194   loss because strlen returns size_t which is unsigned long on at least
 3195   some platforms (such as OS X). The fix is to simply typecast the
 3196   strlen() result to unsigned int.
 3197 
 3198 - libssh2.h: bump version to 1.4.4-DEV
 3199 
 3200 Version 1.4.3 (27 Nov 2012)
 3201 
 3202 Daniel Stenberg (27 Nov 2012)
 3203 - RELEASE-NOTES: fixed for 1.4.3
 3204 
 3205 - sftp_read: return error if a too large package arrives
 3206 
 3207 Peter Stuge (13 Nov 2012)
 3208 - Only define _libssh2_dsa_*() functions when building with DSA support
 3209 
 3210 Guenter Knauf (8 Nov 2012)
 3211 - Added .def file to output.
 3212 
 3213 Kamil Dudka (1 Nov 2012)
 3214 - libssh2_hostkey_hash.3: update the description of return value
 3215   
 3216   The function returns NULL also if the hash algorithm is not available.
 3217 
 3218 Guenter Knauf (24 Oct 2012)
 3219 - Fixed mode acciedently committed.
 3220 
 3221 - Ignore generated file.
 3222 
 3223 - Added hack to make use of Makefile.inc.
 3224   
 3225   This should avoid further maintainance of the objects list.
 3226 
 3227 - Fixed MSVC NMakefile.
 3228   
 3229   Added missing source files; added resource for DLL.
 3230 
 3231 Kamil Dudka (22 Oct 2012)
 3232 - examples: use stderr for messages, stdout for data
 3233   
 3234   Reported by: Karel Srot
 3235   Bug: https://bugzilla.redhat.com/867462
 3236 
 3237 - openssl: do not leak memory when handling errors
 3238   
 3239   ,.. in aes_ctr_init().  Detected by Coverity.
 3240 
 3241 - channel: fix possible NULL dereference
 3242   
 3243   ... in libssh2_channel_get_exit_signal().  Detected by Coverity.
 3244 
 3245 - Revert "aes: the init function fails when OpenSSL has AES support"
 3246   
 3247   This partially reverts commit f4f2298ef3635acd031cc2ee0e71026cdcda5864.
 3248   
 3249   We need to use the EVP_aes_???_ctr() functions in FIPS mode.
 3250 
 3251 - crypt: use hard-wired cipher block sizes consistently
 3252 
 3253 - openssl: do not ignore failure of EVP_CipherInit()
 3254 
 3255 - kex: do not ignore failure of libssh2_md5_init()
 3256   
 3257   The MD5 algorithm is disabled when running in FIPS mode.
 3258 
 3259 Daniel Stenberg (21 Aug 2012)
 3260 - [Peter Krempa brought this change]
 3261 
 3262   known_hosts: Fail when parsing unknown keys in known_hosts file.
 3263   
 3264   libssh2_knownhost_readfile() silently ignored problems when reading keys
 3265   in unsupported formats from the known hosts file. When the file is
 3266   written again from the internal structures of libssh2 it gets truntcated
 3267   to the point where the first unknown key was located.
 3268   
 3269    * src/knownhost.c:libssh2_knownhost_readfile() - return error if key
 3270                                                     parsing fails
 3271 
 3272 - AUTHORS: synced with 42fec44c8a4
 3273   
 3274   31 recent authors added
 3275 
 3276 - [Dave Hayden brought this change]
 3277 
 3278   compression: add support for zlib@openssh.com
 3279   
 3280   Add a "use_in_auth" flag to the LIBSSH2_COMP_METHOD struct and a
 3281   separate "zlib@openssh.com" method, along with checking session->state
 3282   for LIBSSH2_STATE_AUTHENTICATED. Appears to work on the OpenSSH servers
 3283   I've tried against, and it should work as before with normal zlib
 3284   compression.
 3285 
 3286 - [Dmitry Smirnov brought this change]
 3287 
 3288   configure: gcrypt doesn't come with pkg-config support
 3289   
 3290   ... so use plain old -lgcrypt to the linker to link with it.
 3291   
 3292   Fixes #225
 3293 
 3294 - sftp_read: Value stored to 'next' is never read
 3295   
 3296   Detected by clang-analyzer
 3297 
 3298 - publickey_init: errors are negative, fix check
 3299   
 3300   Detected by clang-analyzer.
 3301 
 3302 - [Maxime Larocque brought this change]
 3303 
 3304   session_free: wrong variable used for keeping state
 3305   
 3306   If libssh2_session_free is called without the channel being freed
 3307   previously by libssh2_channel_free a memory leak could occur.
 3308   
 3309   A mismatch of states variables in session_free() prevent the call to
 3310   libssh2_channel_free function. session->state member is used instead of
 3311   session->free_state.
 3312   
 3313   It causes a leak of around 600 bytes on every connection on my systems
 3314   (Linux, x64 and PPC).
 3315   
 3316   (Debugging done under contract for Accedian Networks)
 3317   
 3318   Fixes #246
 3319 
 3320 Guenter Knauf (29 Jun 2012)
 3321 - Small NetWare makefile tweak.
 3322 
 3323 - Some small Win32 makefile fixes.
 3324 
 3325 Daniel Stenberg (19 Jun 2012)
 3326 - libssh2_userauth_publickey_fromfile_ex.3: mention publickey == NULL
 3327 
 3328 - comp_method_zlib_decomp: handle Z_BUF_ERROR when inflating
 3329   
 3330   When using libssh2 to perform an SFTP file transfer from the "JSCAPE MFT
 3331   Server" (http://www.jscape.com) the transfer failed. The default JSCAPE
 3332   configuration is to enforce zlib compression on SSH2 sessions so the
 3333   session was compressed. The relevant part of the debug trace contained:
 3334   
 3335    [libssh2] 1.052750 Transport: unhandled zlib error -5
 3336    [libssh2] 1.052750 Failure Event: -29 - decompression failure
 3337   
 3338   The trace comes from comp_method_zlib_decomp() in comp.c. The "unhandled
 3339   zlib error -5" is the status returned from the zlib function
 3340   inflate(). The -5 status corresponds to "Z_BUF_ERROR".
 3341   
 3342   The inflate() function takes a pointer to a z_stream structure and
 3343   "inflates" (decompresses) as much as it can. The relevant fields of the
 3344   z_stream structure are:
 3345   
 3346     next_in - pointer to the input buffer containing compressed data
 3347     avail_in - the number of bytes available at next_in
 3348     next_out - pointer to the output buffer to be filled with uncompressed
 3349                data
 3350     avail_out - how much space available at next_out
 3351   
 3352   To decompress data you set up a z_stream struct with the relevant fields
 3353   filled in and pass it to inflate(). On return the fields will have been
 3354   updated so next_in and avail_in show how much compressed data is yet to
 3355   be processed and next_out and avail_out show how much space is left in
 3356   the output buffer.
 3357   
 3358   If the supplied output buffer is too small then on return there will be
 3359   compressed data yet to be processed (avail_in != 0) and inflate() will
 3360   return Z_OK. In this case the output buffer must be grown, avail_out
 3361   updated and inflate() called again.
 3362   
 3363   If the supplied output buffer was big enough then on return the
 3364   compressed data will have been exhausted (avail_in == 0) and inflate()
 3365   will return Z_OK, so the data has all been uncompressed.
 3366   
 3367   There is a corner case where inflate() makes no progress. That is, there
 3368   may be unprocessed compressed data and space available in the output
 3369   buffer and yet the function does nothing. In this case inflate() will
 3370   return Z_BUF_ERROR. From the zlib documentation and the source code it
 3371   is not clear under what circumstances this happens. It could be that it
 3372   needs to write multiple bytes (all in one go) from its internal state to
 3373   the output buffer before processing the next chunk of input but but
 3374   can't because there is not enough space (though my guesses as to the
 3375   cause are not really relevant). Recovery from Z_BUF_ERROR is pretty
 3376   simple - just grow the output buffer, update avail_out and call
 3377   inflate() again.
 3378   
 3379   The comp_method_zlib_decomp() function does not handle the case when
 3380   inflate() returns Z_BUF_ERROR. It treats it as a non-recoverable error
 3381   and basically aborts the session.
 3382   
 3383   Fixes #240
 3384 
 3385 Guenter Knauf (12 Jun 2012)
 3386 - MinGW makefile tweaks.
 3387   
 3388   Use GNU tools when compiling on Linux.
 3389   Fixed dist and dev targets.
 3390 
 3391 - NetWare makefile tweaks.
 3392   
 3393   Changed to use Windows commandline tools instead of
 3394   GNU tools when compiling on Windows. Fixed dist and
 3395   dev targets. Enabled nlmconv error for unresolved
 3396   symbols.
 3397 
 3398 Daniel Stenberg (11 Jun 2012)
 3399 - Revert "config.rpath: generated file, no need to keep in git"
 3400   
 3401   This reverts commit 1ac7bd09cc685755577fb2c8829adcd081e7ab3c.
 3402   
 3403   This file still used by lib/*m4 functions so we need to keep the file
 3404   around.
 3405 
 3406 - BINDINGS: added PySsh2, a Python-ctypes binding
 3407 
 3408 Guenter Knauf (8 Jun 2012)
 3409 - Fixed MinGW debug build.
 3410 
 3411 Daniel Stenberg (5 Jun 2012)
 3412 - BINDINGS: Added the Cocoa/Objective-C one
 3413   
 3414   ... and sorted the bindings after the languages, alphabetically
 3415   
 3416   Reported by: Mike Abdullah
 3417 
 3418 - BINDINGS: document the bindings we know of
 3419 
 3420 Guenter Knauf (4 Jun 2012)
 3421 - Fixed LIBSSH2_INT64_T_FORMAT macro.
 3422   
 3423   Usually a format macro should hold the whole format, otherwise
 3424   it should be named a prefix. Also fixed usage of this macro in
 3425   scp.c for a signed var where it was used as prefix for unsigned.
 3426 
 3427 - Removed obsolete define from makefiles.
 3428 
 3429 - Renamed NetWare makefiles.
 3430 
 3431 - Renamed NetWare makefiles.
 3432 
 3433 - Synced MinGW makefiles with 56c64a6..39e438f.
 3434   
 3435   Also synced MinGW test makefile with b092696..f8cb874.
 3436 
 3437 Peter Stuge (30 May 2012)
 3438 - Revert "sftp: Don't send attrs.permissions on read-only SSH_FXP_OPEN"
 3439   
 3440   This reverts commit 04e79e0c798674a0796be8a55f63dd92e6877790.
 3441 
 3442 - sftp: Don't send attrs.permissions on read-only SSH_FXP_OPEN
 3443   
 3444   This works around a protocol violation in the ProFTPD 1.3.4 mod_sftp
 3445   server, as reported by Will Cosgrove in:
 3446   
 3447   http://libssh2.org/mail/libssh2-devel-archive-2012-05/0079.shtml
 3448   
 3449   Based on a suggested fix by TJ Saunders in:
 3450   
 3451   http://libssh2.org/mail/libssh2-devel-archive-2012-05/0104.shtml
 3452 
 3453 Guenter Knauf (28 May 2012)
 3454 - Try to detect OpenSSL build type automatically.
 3455   
 3456   Also fixed recently added libgdi32 linkage which is only
 3457   required when OpenSSL libs are linked statically.
 3458 
 3459 Daniel Stenberg (25 May 2012)
 3460 - config.rpath: generated file, no need to keep in git
 3461 
 3462 Guenter Knauf (22 May 2012)
 3463 - Updated dependency libary versions.
 3464 
 3465 Daniel Stenberg (18 May 2012)
 3466 - 1.4.3: towards the future
 3467 
 3468 Version 1.4.2 (18 May 2012)
 3469 
 3470 Daniel Stenberg (18 May 2012)
 3471 - RELEASE-NOTES: synced with 92a9f952794
 3472 
 3473 Alexander Lamaison (15 May 2012)
 3474 - win32/libssh2_config.h: Remove hardcoded #define LIBSSH2_HAVE_ZLIB.
 3475   
 3476   Rationale: Everything else in this file states a fact about the win32
 3477   platform that is unconditional for that platform.  There is nothing
 3478   unconditional about the presence of zlib.  It is neither included with
 3479   Windows nor with the platform SDK.  Therefore, this is not an appropriate
 3480   place to assert its presence.  Especially as, once asserted, it cannot be
 3481   overridden using a compiler flag.
 3482   
 3483   In contrast, if it is omitted, then it can easily be reasserted by adding
 3484   a compiler flag defining LIBSSH2_HAVE_ZLIB.
 3485 
 3486 Daniel Stenberg (14 May 2012)
 3487 - RELEASE-NOTES: synced with 69a3354467c
 3488 
 3489 - _libssh2_packet_add: SSH_MSG_CHANNEL_REQUEST default to want_reply
 3490   
 3491   RFC4254 says the default 'want_reply' is TRUE but the code defaulted to
 3492   FALSE. Now changed.
 3493   
 3494   Fixes #233
 3495 
 3496 - gettimeofday: no need for a replacement under cygwin
 3497   
 3498   Fixes #224
 3499 
 3500 Alexander Lamaison (13 May 2012)
 3501 - Prevent sftp_packet_read accessing freed memory.
 3502   
 3503   sftp_packet_add takes ownership of the packet passed to it and (now that we
 3504   handle zombies) might free the packet.  sftp_packet_read uses the packet type
 3505   byte as its return code but by this point sftp_packet_add might have freed
 3506   it.  This change fixes the problem by caching the packet type before calling
 3507   sftp_packet_add.
 3508   
 3509   I don't understand why sftp_packet_read uses the packet type as its return
 3510   code.  A future change might get rid of this entirely.
 3511 
 3512 Daniel Stenberg (12 May 2012)
 3513 - sftp_packet_flush: flush zombies too
 3514   
 3515   As this function is called when the SFTP session is closed, it needs to
 3516   also kill all zombies left in the SFTP session to avoid leaking memory
 3517   just in case some zombie would still be in there.
 3518 
 3519 - sftp_packetlist_flush: zombies must not have responses already
 3520   
 3521   When flushing the packetlist, we must only add the request as a zombie
 3522   if no response has already been received. Otherwise we could wrongly
 3523   make it a zombie even though the response was already received and then
 3524   we'd get a zombie stuck there "forever"...
 3525 
 3526 - sftp_read: on EOF remove packet before flush
 3527   
 3528   Since the sftp_packetlist_flush() function will move all the existing
 3529   FXP_READ requests in this handle to the zombie list we must first remove
 3530   this just received packet as it is clearly not a zombie.
 3531 
 3532 - sftp_packet_require: sftp_packet_read() returning 0 is not an error
 3533   
 3534   Exactly as the comment in the code said, checking the return code from
 3535   sftp_packet_read() with <= was wrong and it should be < 0. With the new
 3536   filtering on incoming packets that are "zombies" we can now see this
 3537   getting zero returned.
 3538 
 3539 - sftp_packetlist_flush: only make it zombie if it was sent
 3540   
 3541   The list of outgoing packets may also contain packets that never were
 3542   sent off and we better not make them zombies too.
 3543 
 3544 - [Alexander Lamaison brought this change]
 3545 
 3546   Mark outstanding read requests after EOF as zombies.
 3547   
 3548   In order to be fast, sftp_read sends many read requests at once.  With a small
 3549   file, this can mean that when EOF is received back, many of these requests are
 3550   still outstanding.  Responses arriving after we close the file and abandon the
 3551   file handle are queued in the SFTP packet queue and never collected.  This
 3552   causes transfer speed to drop as a progressively longer queue must be searched
 3553   for every packet.
 3554   
 3555   This change introduces a zombie request-ID list in the SFTP session that is
 3556   used to recognise these outstanding requests and prevent them being added to
 3557   the queue.
 3558 
 3559 Peter Stuge (23 Apr 2012)
 3560 - [Rafael Kitover brought this change]
 3561 
 3562   Update win32/GNUmakefile to use OpenSSL 1.0.1a
 3563   
 3564   libcrypto on win32 now depends on gdi32.dll, so move the OpenSSL LDLIBS
 3565   block to before the compiler definitions, so that libcrypto gets added
 3566   first, and then add -lgdi32 into the following common LDLIBS for gcc.
 3567 
 3568 Guenter Knauf (23 Apr 2012)
 3569 - Changed 'Requires' to 'Requires.private'.
 3570   
 3571   Only static builds need to link against the crypto libs.
 3572 
 3573 - Fixed 'Requires:' names.
 3574   
 3575   The 'Requires:' line lists the names of the .pc files.
 3576 
 3577 - Added 'Requires:' line to libssh2.pc.
 3578   
 3579   This is necessary so that other libs which lookup libssh2 info
 3580   via pkg-config can add the right crypto lib dependencies.
 3581 
 3582 - Updated dependency lib versions.
 3583 
 3584 Peter Stuge (18 Apr 2012)
 3585 - configure.ac: Add option to disable build of the example applications
 3586   
 3587   Examples are built by default. Any of the following options on the
 3588   configure command line will skip building them:
 3589   
 3590     --disable-examples-build
 3591     --enable-examples-build=no
 3592     --enable-examples-build=false
 3593 
 3594 - userauth.c: fread() from public key file to correctly detect any errors
 3595   
 3596   If the filename parameter for file_read_publickey() was the name of a
 3597   directory instead of a file then libssh2 would spin trying to fgetc()
 3598   from the FILE * for the opened directory when trying to determine the
 3599   length of the encoded public key, since fgetc() can't report errors.
 3600   
 3601   Use fread() instead to correctly detect this error condition along
 3602   with many others.
 3603   
 3604   This fixes the problem reported in
 3605   http://www.libssh2.org/mail/libssh2-devel-archive-2012-04/0021.shtml
 3606   
 3607   Reported-by: Oleksiy Zagorskyi <zalex_ua@i.ua>
 3608 
 3609 - Return LIBSSH2_ERROR_SOCKET_DISCONNECT on EOF when reading banner
 3610 
 3611 Guenter Knauf (17 Apr 2012)
 3612 - Fixed copyright year.
 3613 
 3614 - Updated dependency lib versions in static makefiles.
 3615 
 3616 Daniel Stenberg (6 Apr 2012)
 3617 - version: bump to 1.4.2
 3618   
 3619   We're on the 1.4.2 track now (at least)
 3620 
 3621 Version 1.4.1 (4 Apr 2012)
 3622 
 3623 Daniel Stenberg (4 Apr 2012)
 3624 - RELEASE-NOTES: updated for 1.4.1 release
 3625 
 3626 - always do "forced" window updates
 3627   
 3628   When calling _libssh2_channel_receive_window_adjust() internally, we now
 3629   always use the 'force' option to prevent libssh2 to avoid sending the
 3630   update if the update isn't big enough.
 3631   
 3632   It isn't fully analyzed but we have seen corner cases which made a
 3633   necessary window update not get send due to this and then the other side
 3634   doesn't send data our side then sits waiting for forever.
 3635 
 3636 - channel_read: force window adjusts!
 3637   
 3638   if there's not enough room to receive the data that's being requested,
 3639   the window adjustment needs to be sent to the remote and thus the force
 3640   option has to be used. _libssh2_channel_receive_window_adjust() would
 3641   otherwise "queue" small window adjustments for a later packet but that
 3642   is really terribly for the small buffer read that for example is the
 3643   final little piece of a very large file as then there is no logical next
 3644   packet!
 3645   
 3646   Reported by: Armen Babakhanian
 3647   Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0130.shtml
 3648 
 3649 - [Paul Howarth brought this change]
 3650 
 3651   aes: the init function fails when OpenSSL has AES support
 3652   
 3653   The internal init function only worked fine when the configure script
 3654   didn't detect the OpenSSL AES_CTR function!
 3655   
 3656   Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0111.shtml
 3657   Reported by: Paul Howarth
 3658 
 3659 - [Matthew Booth brought this change]
 3660 
 3661   transport_send: Finish in-progress key exchange before sending data
 3662   
 3663   _libssh2_channel_write() first reads outstanding packets before writing
 3664   new data. If it reads a key exchange request, it will immediately start
 3665   key re-exchange, which will require sending a response. If the output
 3666   socket is full, this will result in a return from
 3667   _libssh2_transport_read() of LIBSSH2_ERROR_EAGAIN. In order not to block
 3668   a write because there is no data to read, this error is explicitly
 3669   ignored and the code continues marshalling a packet for sending. When it
 3670   is sent, the remote end immediately drops the connection because it was
 3671   expecting a continuation of the key exchange, but got a data packet.
 3672   
 3673   This change adds the same check for key exchange to
 3674   _libssh2_transport_send() that is in _libssh2_transport_read(). This
 3675   ensures that key exchange is completed before any data packet is sent.
 3676 
 3677 - channel_write: acknowledge transport errors
 3678   
 3679   When draining data off the socket with _libssh2_transport_read() (which
 3680   in turn has to be done so that we can be sure to have read any possible
 3681   window-increasing packets), this code previously ignored errors which
 3682   could lead to nasty loops. Now all error codes except EAGAIN will cause
 3683   the error to be returned at once.
 3684   
 3685   Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0068.shtml
 3686   Reported by: Matthew Booth
 3687 
 3688 - [Steven Dake brought this change]
 3689 
 3690   In examples/x11.c, Make sure sizeof passed to read operation is correct
 3691   
 3692   sizeof(buf) expands to 8 or 4 (since its a pointer).  This variable may
 3693   have been static in the past, leading to this error.
 3694   
 3695   Signed-off-by: Steven Dake <sdake@redhat.com>
 3696 
 3697 - [Steven Dake brought this change]
 3698 
 3699   Fix suspicious sizeof usage in examples/x11.c
 3700   
 3701   In the x11 example, sizeof(buf) = 8UL (on x86_64), when this should
 3702   probably represent the buffer size available.  I am not sure how to
 3703   test that this change is actually correct, however.
 3704   
 3705   Signed-off-by: Steven Dake <sdake@redhat.com>
 3706 
 3707 - sftp_packet_read: follow-up fix for EAGAIN/window adjust
 3708   
 3709   The commit in 7194a9bd7ba45 wasn't complete. This change makes sure
 3710   variables are initialized properly before used in the EAGAIN and window
 3711   adjust cases.
 3712 
 3713 - sftp_packet_add: use named error code instead of number
 3714 
 3715 - sftp_packet_add: verify the packet before accepting it
 3716   
 3717   In order to bail out as quickly as possible when things are wrong and
 3718   out of sync, make sure the SFTP message is one we understand.
 3719 
 3720 - SFTP: preserve the original error code more
 3721   
 3722   Lots of places in the code translated the original error into the more
 3723   generic LIBSSH2_ERROR_SOCKET_TIMEOUT but this turns out to distort the
 3724   original error reason a lot and makes tracking down the real origin of a
 3725   problem really hard. This change makes the original error code be
 3726   preserved to a larger extent when return up to the parent function.
 3727 
 3728 - sftp_packet_read: adjust window size as necessary
 3729   
 3730   Commit 03ca9020756 tried to simplify the window sizing logic but broke
 3731   SFTP readdir as there was no window sizing code left there so large
 3732   directory listings no longer worked.
 3733   
 3734   This change introduces window sizing logic to the sftp_packet_read()
 3735   function so that it now tells the remote about the local size having a
 3736   window size that suffice when it is about to ask for directory data.
 3737   
 3738   Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2012-03/0069.shtml
 3739   Reported by: Eric
 3740 
 3741 - [Steven Dake brought this change]
 3742 
 3743   Tell C compiler we don't care about return code of libssh2_init
 3744   
 3745   The call of libssh2_init returns a return code, but nothing could be done
 3746   within the _libssh2_init_if_needed execution path.
 3747   
 3748   Signed-off-by: Steven Dake <sdake@redhat.com>
 3749 
 3750 - [Steven Dake brought this change]
 3751 
 3752   Add comment indicating a resource leak is not really a resource leak
 3753   
 3754   While possibly obvious to those investigating the code, coverity complains
 3755   about this out of scope leak.
 3756   
 3757   Signed-off-by: Steven Dake <sdake@redhat.com>
 3758 
 3759 - [Steven Dake brought this change]
 3760 
 3761   Use safer snprintf rather then sprintf in scp_send()
 3762   
 3763   Signed-off-by: Steven Dake <sdake@redhat.com>
 3764 
 3765 - [Steven Dake brought this change]
 3766 
 3767   Use safer snprintf rather then sprintf in scp_recv()
 3768   
 3769   While the buffer is indeed allocated to a safe length, better safe then sorry.
 3770   
 3771   Signed-off-by: Steven Dake <sdake@redhat.com>
 3772 
 3773 - [Steven Dake brought this change]
 3774 
 3775   use snprintf in knownhost_writeline() rather then sprintf
 3776   
 3777   Although the function checks the length, if the code was in error, there
 3778   could potentially be a buffer overrun with the use of sprintf.  Instead replace
 3779   with snprintf.
 3780   
 3781   Signed-off-by: Steven Dake <sdake@redhat.com>
 3782 
 3783 - [Steven Dake brought this change]
 3784 
 3785   Add tracing to print packets left on session at libssh2_session_free
 3786   
 3787   Signed-off-by: Steven Dake <sdake@redhat.com>
 3788 
 3789 Peter Stuge (2 Mar 2012)
 3790 - Define and use LIBSSH2_INVALID_SOCKET instead of INVALID_SOCKET
 3791   
 3792   INVALID_SOCKET is a special value in Windows representing a
 3793   non-valid socket identifier. We were #defining this to -1 on
 3794   non-Windows platforms, causing unneccessary namespace pollution.
 3795   Let's have our own identifier instead.
 3796   
 3797   Thanks to Matt Lawson for pointing this out.
 3798 
 3799 - nw/Makefile.netware: Fix project name typo to avoid needless confusion
 3800 
 3801 - example/x11: Set raw terminal mode manually instead of with cfmakeraw()
 3802   
 3803   OpenSolaris has no cfmakeraw() so to make the example more portable
 3804   we simply do the equivalent operations on struct termios ourselves.
 3805   
 3806   Thanks to Tom Weber for reporting this problem, and finding a solution.
 3807 
 3808 Daniel Stenberg (17 Feb 2012)
 3809 - sftp_write: cannot return acked data *and* EAGAIN
 3810   
 3811   Whenever we have acked data and is about to call a function that *MAY*
 3812   return EAGAIN we must return the number now and wait to get called
 3813   again. Our API only allows data *or* EAGAIN and we must never try to get
 3814   both.
 3815 
 3816 Peter Stuge (13 Feb 2012)
 3817 - example/x11: Build only when sys/un.h is found by configure
 3818   
 3819   The example can't be built on systems without AF_UNIX sockets.
 3820 
 3821 Daniel Stenberg (10 Feb 2012)
 3822 - [Alexander Lamaison brought this change]
 3823 
 3824   Simplified sftp_read.
 3825   
 3826   Removed the total_read variable that originally must have tracked how
 3827   much data had been written to the buffer.  With non-blocking reads, we
 3828   must return straight away once we have read data into the buffer so this
 3829   variable served not purpose.
 3830   
 3831   I think it was still hanging around in case the initial processing of
 3832   'leftover' data meant we wrote to the buffer but this case, like the
 3833   others, must return immediately.  Now that it does, the last remaining
 3834   need for the variable is gone.
 3835 
 3836 - [Alexander Lamaison brought this change]
 3837 
 3838   Cleaned up sftp_read and added more explanation.
 3839   
 3840   Replaced the gotos which were implementing the state machine with
 3841   a switch statement which makes the states more explicit.
 3842 
 3843 - sftp_read: avoid data *and* EAGAIN
 3844   
 3845   Whenever we have data and is about to call a function that *MAY* return
 3846   EAGAIN we must return the data now and wait to get called again. Our API
 3847   only allows data *or* EAGAIN and we must never try to get both.
 3848 
 3849 Peter Stuge (2 Feb 2012)
 3850 - Add a tcpip-forward example which demonstrates remote port forwarding
 3851 
 3852 - libssh2.h: Add missing prototype for libssh2_session_banner_set()
 3853 
 3854 - example/subsystem_netconf.c: Return error when read buffer is too small
 3855   
 3856   Also remove a little redundancy in the read loop condition.
 3857 
 3858 - example/subsystem_netconf.c: Add a missing newline in an error message
 3859 
 3860 - Fix undefined reference to _libssh_error in libgcrypt backend
 3861   
 3862   Commit 209de22299b4b58e582891dfba70f57e1e0492db introduced a function
 3863   call to a non-existing function, and since then the libgcrypt backend
 3864   has not been buildable.
 3865 
 3866 Version 1.4.0 (31 Jan 2012)
 3867 
 3868 Daniel Stenberg (31 Jan 2012)
 3869 - RELEASE-NOTES: synced with 6bd584d29 for 1.4.0
 3870 
 3871 - s/1.3.1/1.4.0
 3872   
 3873   We're bumping the minor number
 3874 
 3875 - [Jernej Kovacic brought this change]
 3876 
 3877   libssh2_session_supported_algs: fix compiler warning
 3878 
 3879 - [Jernej Kovacic brought this change]
 3880 
 3881   session_supported_algs docs: added an example
 3882 
 3883 - [Gellule Xg brought this change]
 3884 
 3885   sftp-seek: clear EOF flag
 3886   
 3887   Set the EOF flag to False when calling seek64 to be able to get some
 3888   data back on a following read
 3889 
 3890 - [Peter Krempa brought this change]
 3891 
 3892   userauth: Provide more informations if ssh pub key extraction fails
 3893   
 3894   If the function that extracts/computes the public key from a private key
 3895   fails the errors it reports were masked by the function calling it. This
 3896   patch modifies the key extraction function to return errors using
 3897   _libssh_error() function.  The error messages are tweaked to contain
 3898   reference to the failed operaton in addition to the reason.
 3899   
 3900    * AUTHORS: - add my name
 3901    * libgcrypt.c: _libssh2_pub_priv_keyfile(): - return a more verbose
 3902                                                  error using
 3903                                                  _libssh2_error() func.
 3904    * openssl.c: - modify call graph of _libssh2_pub_priv_keyfile() to use
 3905                   _libssh2_error for error reporting();
 3906    * userauth.c: - tweak functions calling _libssh2_pub_priv_keyfile() not
 3907                    to shadow error messages
 3908 
 3909 - TODO: remove issues we (sort of) did already
 3910 
 3911 - ssh2_exec: skip error outputs for EAGAIN
 3912   
 3913   Since the example uses non-blocking mode, it will just flood the output
 3914   with this "nonsense" error.
 3915 
 3916 Guenter Knauf (30 Nov 2011)
 3917 - Some NetWare makefile tweaks.
 3918 
 3919 Daniel Stenberg (18 Nov 2011)
 3920 - LIBSSH2_SFTP_PACKET_MAXLEN: increase to 80000
 3921   
 3922   Some SFTP servers send SFTP packets larger than 40000. Since the limit
 3923   is only present to avoid insane sizes anyway, we can easily bump it.
 3924   
 3925   The define was formerly in the public header libssh2_sftp.h but served
 3926   no external purpose and was moved into the source dir.
 3927   
 3928   Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-11/0004.shtml
 3929   Reported by: Michael Harris
 3930 
 3931 Alexander Lamaison (18 Nov 2011)
 3932 - [Peter Krempa brought this change]
 3933 
 3934   knownhost_check(): Don't dereference ext if NULL is passed
 3935   
 3936   Documentation for libssh2_knownhost_checkp() and related functions
 3937   states that the last argument is filled with data if non-NULL.
 3938   
 3939   "knownhost if set to non-NULL, it must be a pointer to a 'struct
 3940   libssh2_knownhost' pointer that gets filled in to point to info about a
 3941   known host that matches or partially matches."
 3942   
 3943   In this function ext is dereferenced even if set to NULL, causing
 3944   segfault in applications not needing the extra data.
 3945 
 3946 Daniel Stenberg (11 Nov 2011)
 3947 - [Peter Krempa brought this change]
 3948 
 3949   knownhost_add: Avoid dereferencing uninitialized memory on error path.
 3950   
 3951   In function knownhost_add, memory is alocated for a new entry. If normal
 3952   alocation is used, memory is not initialized to 0 right after, but a
 3953   check is done to verify if correct key type is passed. This test is done
 3954   BEFORE setting the memory to null, and on the error path function
 3955   free_host() is called, that tries to dereference unititialized memory,
 3956   resulting into a glibc abort().
 3957   
 3958    * knownhost.c - knownhost_add(): - move typemask check before alloc
 3959 
 3960 - windows build: add define to avoid compiler warning
 3961   
 3962   A recent mingw compiler has started to complain on "#warning Please
 3963   include winsock2.h before windows.h" unless the magic define is set
 3964   first.
 3965   
 3966   Reported by: Vincent Torri
 3967   Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-10/0064.shtml
 3968 
 3969 Henrik Nordstrom (31 Oct 2011)
 3970 - [Vincent Torri brought this change]
 3971 
 3972   Correct Windows include file name case, simplifying cross-compilation
 3973   
 3974   When cross compiling to Windows, libssh2.h include Windows header files
 3975   with upper case filenames : BaseTsd.h and WinSock2.h.
 3976   
 3977   These files have lowercase names with mingw-w64 (iirc, it's the same with
 3978   mingw). And as on Windows, being lowercase or uppercase does not matter.
 3979 
 3980 Daniel Stenberg (25 Oct 2011)
 3981 - [Jernej Kovacic brought this change]
 3982 
 3983   libssh2_session_supported_algs: added
 3984 
 3985 - [Kamil Dudka brought this change]
 3986 
 3987   example/sftp_RW_nonblock: do not ignore LIBSSH2_ERROR_EAGAIN
 3988   
 3989   Bug: https://bugzilla.redhat.com/745420
 3990 
 3991 Peter Stuge (5 Oct 2011)
 3992 - example/ssh2_agent: Print host key fingerprint before authentication
 3993   
 3994   Also moves the comment about not being authenticated to before the
 3995   agent authentication takes place, so that it better matches the code.
 3996 
 3997 Daniel Stenberg (29 Sep 2011)
 3998 - OpenSSL EVP: fix threaded use of structs
 3999   
 4000   Make sure we don't clear or reset static structs after first init so
 4001   that they work fine even when used from multiple threads. Init the
 4002   structs in the global init.
 4003   
 4004   Help and assistance by: John Engstrom
 4005   
 4006   Fixes #229 (again)
 4007 
 4008 - openssl: don't init static structs differently
 4009   
 4010   make_ctr_evp() is changed to take a struct pointer, and then each
 4011   _libssh2_EVP_aes_[keylen]_ctr function is made to pass in their own
 4012   static struct
 4013   
 4014   Reported by: John Engstrom
 4015   Fixes #229
 4016 
 4017 Guenter Knauf (27 Sep 2011)
 4018 - Removed obsolete include path.
 4019 
 4020 Daniel Stenberg (21 Sep 2011)
 4021 - read_state: clear the state variable better
 4022   
 4023   Set read_state back to idle before trying to send anything so that if
 4024   the state somehow is wrongly set.
 4025   
 4026   Also, avoid such a case of confusion by resetting the read_state when an
 4027   sftp handle is closed.
 4028 
 4029 - sftp_read: remove leftover fprintf
 4030   
 4031   Reported by: Alexander Lamaison
 4032 
 4033 - sftp.h: fix the #ifdef to prevent multiple inclusions
 4034 
 4035 - sftp_read: use a state variable to avoid bad writes
 4036   
 4037   When a channel_write call has gotten an EAGAIN back, we try harder to
 4038   continue the same write in the subsequent invoke.
 4039 
 4040 - window_size: explicit adjustments only
 4041   
 4042   Removed the automatic window_size adjustments from
 4043   _libssh2_channel_read() and instead all channel readers must now make
 4044   sure to enlarge the window sizes properly themselves.
 4045   
 4046   libssh2_channel_read_ex() - the public function, now grows the window
 4047   size according to the requested buffer size. Applications can still opt
 4048   to grow the window more on demand. Larger windows tend to give higher
 4049   performance.
 4050   
 4051   sftp_read() now uses the read-ahead logic to figure out a window_size.
 4052 
 4053 - libssh2.h: bump the default window size to 256K
 4054 
 4055 - libssh2_userauth_keyboard_interactive.3: fix man warning
 4056   
 4057   It seemed to occur due to the excessive line length
 4058 
 4059 - [Mikhail Gusarov brought this change]
 4060 
 4061   Add missing .gitignore entries
 4062 
 4063 - [Mikhail Gusarov brought this change]
 4064 
 4065   Add manpage syntax checker to 'check' target
 4066   
 4067   In virtually every libssh2 release Debian's lintian catches syntax errors in
 4068   manpages. Prevent it by checking manpages as a part of testsuite.
 4069 
 4070 - libssh2_banner_set.3: fix nroff syntax mistake
 4071 
 4072 Guenter Knauf (10 Sep 2011)
 4073 - Use predefined resource compiler macro.
 4074 
 4075 - Added casts to silent compiler warnings.
 4076 
 4077 - Fixed uint64_t printf.
 4078 
 4079 - Fixed macro function signatures.
 4080 
 4081 - NetWare makefile tweaks.
 4082 
 4083 - Removed unused var.
 4084 
 4085 - Added 2 samples not mentioned.
 4086 
 4087 - Dont build x11 sample with MinGW.
 4088 
 4089 - Fixed executable file description.
 4090 
 4091 - Removed unused var.
 4092 
 4093 - Kill stupid gcc 3.x uninitialized warning.
 4094 
 4095 - Build all examples.
 4096 
 4097 - More MinGW makefile tweaks.
 4098   
 4099   Renamed *.mingw makefiles to GNUmakefile since GNU make picks these
 4100   up automatically, and therefore win32/Makefile removed.
 4101 
 4102 - Removed forgotten WINSOCK_VERSION defines.
 4103 
 4104 Daniel Stenberg (9 Sep 2011)
 4105 - libssh2_session_startup(3) => libssh2_session_handshake(3)
 4106   
 4107   Propagate for the current function in docs and examples.
 4108   libssh2_session_startup() is deprecated.
 4109 
 4110 - libssh2_banner_set => libssh2_session_banner_get
 4111   
 4112   Marked the old function as deprecated. Added the new name in the correct
 4113   name space with the same arguments and functionality.
 4114 
 4115 - new function: libssh2_session_banner_get
 4116   
 4117   Returns the banner from the server handshake
 4118   
 4119   Fixes #226
 4120 
 4121 - libssh2.h: bump version to 1.4.0 for new function(s)
 4122 
 4123 - remove embedded CVS/svn tags
 4124 
 4125 - [liuzl brought this change]
 4126 
 4127   API add:libssh2_sftp_get_channel
 4128   
 4129   Return the channel of sftp, then caller can
 4130   control the channel's behavior.
 4131   
 4132   Signed-off-by: liuzl <xieepp@gmail.com>
 4133 
 4134 - _libssh2_channel_read: react on errors from receive_window_adjust
 4135   
 4136   Previously the function would ignore all errors except for EAGAIN.
 4137 
 4138 - sftp_read: extend and clarify the documentation
 4139 
 4140 - sftp_read: cap the read ahead maximum amount
 4141   
 4142   Now we only go up to LIBSSH2_CHANNEL_WINDOW_DEFAULT*30 bytes SFTP read
 4143   ahead, which currently equals 64K*30 == 1966080 bytes.
 4144 
 4145 - _libssh2_channel_read: fix non-blocking window adjusting
 4146   
 4147   If EAGAIN is returned when adjusting the receive window, we must not
 4148   read from the transport directly until we've finished the adjusting.
 4149 
 4150 Guenter Knauf (8 Sep 2011)
 4151 - Fix for systems which need sys/select.h.
 4152 
 4153 - The files were not gone but renamed ...
 4154 
 4155 Daniel Stenberg (6 Sep 2011)
 4156 - sftp_read: added documenting comment
 4157   
 4158   Taken from some recent email conversations I added some descriptions of
 4159   the logic in sftp_read() to aid readers.
 4160 
 4161 - 1.3.1: start the work
 4162 
 4163 Version 1.3.0 (6 Sep 2011)
 4164 
 4165 Daniel Stenberg (6 Sep 2011)
 4166 - Makefile.am: the Makefile.win32 files are gone
 4167 
 4168 - RELEASE-NOTES: updated for 1.3.0
 4169 
 4170 - sftp_read: a short read is not end of file
 4171   
 4172   A returned READ packet that is short will now only reduce the
 4173   offset.
 4174   
 4175   This is a temporary fix as it is slightly better than the previous
 4176   approach but still not very good.
 4177 
 4178 - [liuzl brought this change]
 4179 
 4180   _libssh2_packet_add: adjust window size when truncating
 4181   
 4182   When receiving more data than what the window size allows on a
 4183   particular channel, make sure that the window size is adjusted in that
 4184   case too. Previously it would only adjust the window in the non-error
 4185   case.
 4186 
 4187 Guenter Knauf (29 Aug 2011)
 4188 - Silent compiler warning with MinGW64.
 4189 
 4190 - Fixed link to native Win32 awk tool.
 4191 
 4192 - Renamed MinGW makefiles.
 4193 
 4194 - Some MinGW makefile tweaks.
 4195   
 4196   Enable build without GNU tools and with MinGW64 compiler.
 4197 
 4198 - Fixed aes_ctr_do_cipher() signature.
 4199 
 4200 Daniel Stenberg (26 Aug 2011)
 4201 - [liuzl brought this change]
 4202 
 4203   libssh2_sftp_seek64: flush packetlist and buffered data
 4204   
 4205   When seeking to a new position, flush the packetlist and buffered data
 4206   to prevent already received or pending data to wrongly get used when
 4207   sftp-reading from the new offset within the file.
 4208 
 4209 - sftp_read: advance offset correctly for buffered copies
 4210   
 4211   In the case where a read packet has been received from the server, but
 4212   the entire contents couldn't be copied to the user-buffer, the data is
 4213   instead buffered and copied to the user's buffer in the next invocation
 4214   of sftp_read(). When that "extra" copy is made, the 'offset' pointer was
 4215   not advanced accordingly.
 4216   
 4217   The biggest impact of this flaw was that the 'already' variable at the
 4218   top of the function that figures out how much data "ahead" that has
 4219   already been asked for would slowly go more and more out of sync, which
 4220   could lead to the file not being read all the way to the end.
 4221   
 4222   This problem was most noticable in cases where the application would
 4223   only try to read the exact file size amount, like curl does. In the
 4224   examples libssh2 provides the sftp read function is most often called
 4225   with a fixed size large buffer and then the bug would not appear as
 4226   easily.
 4227   
 4228   This bug was introduced in the SFTP rewrite in 1.2.8.
 4229   
 4230   Bug: http://curl.haxx.se/mail/lib-2011-08/0305.html
 4231        http://www.libssh2.org/mail/libssh2-devel-archive-2011-08/0085.shtml
 4232 
 4233 - wrap some long lines < 80 columns
 4234 
 4235 - LIBSSH2_RECV: fix typo, use the RECV_FD macro
 4236 
 4237 - subsystem_netconf.c: fix compiler warnings
 4238 
 4239 - [Henrik Nordstrom brought this change]
 4240 
 4241   Custom callbacks for performing low level socket I/O
 4242 
 4243 - version bump: start working towards 1.3.0
 4244 
 4245 Version 1.2.9 (16 Aug 2011)
 4246 
 4247 Daniel Stenberg (16 Aug 2011)
 4248 - RELEASE-NOTES: synced with 95d69d3a81261
 4249 
 4250 - [Henrik Nordstrom brought this change]
 4251 
 4252   Document prototypes for macro defined functions
 4253 
 4254 - [Henrik Nordstrom brought this change]
 4255 
 4256   Avoid reuse after free when closing X11 channels
 4257 
 4258 - _libssh2_channel_write: handle window_size == 0 better
 4259   
 4260   When about to send data on the channel and the window size is 0, we must
 4261   not just return 0 if the transport_read() function returned EAGAIN as it
 4262   then causes a busy-loop.
 4263   
 4264   Bug: http://libssh2.org/mail/libssh2-devel-archive-2011-08/0011.shtml
 4265 
 4266 - gettimeofday: fix name space pollution
 4267   
 4268   For systems without its own gettimeofday() implementation, we still must
 4269   not provide one outside our namespace.
 4270   
 4271   Reported by: Bill Segall
 4272 
 4273 Dan Fandrich (5 Aug 2011)
 4274 - libssh2.pc.in: Fixed spelling in pkgconfig file
 4275 
 4276 Peter Stuge (17 Jul 2011)
 4277 - example/subsystem_netconf.c: Add missing #include <string.h>
 4278 
 4279 - example/subsystem_netconf.c: Discard ]]>]]> and return only XML response
 4280 
 4281 - example/subsystem_netconf.c: Fix uninitialized variable bug
 4282 
 4283 - example: Add subsystem_netconf.c
 4284   
 4285   This example demonstrates how to use libssh2 to send a request to
 4286   the NETCONF subsystem available e.g. in JunOS.
 4287   
 4288   See also http://tools.ietf.org/html/draft-ietf-netconf-ssh-06
 4289 
 4290 Daniel Stenberg (16 Jul 2011)
 4291 - man page cleanups: non-existing functions need no man pages
 4292 
 4293 - libssh2_new_host_entry.3: removed
 4294   
 4295   This is just junk leftovers.
 4296 
 4297 - userauth_keyboard_interactive: fix buffer overflow
 4298   
 4299   Partly reverse 566894494b4972ae12 which was simplifying the code far too
 4300   much and ended up overflowing a buffer within the LIBSSH2_SESSION
 4301   struct. Back to allocating the buffer properly like it used to do.
 4302   
 4303   Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-06/0032.shtml
 4304   Reported by: Alfred Gebert
 4305 
 4306 - keyboard-interactive man page: cleaned up
 4307 
 4308 - [Alfred Gebert brought this change]
 4309 
 4310   _libssh2_recv(): handle ENOENT error as EAGAIN
 4311   
 4312   A sftp session failed with error "failure establishing ssh session" on
 4313   Solaris and HP-UX. Sometimes the first recv() function call sets errno
 4314   to ENOENT. In the man pages for recv of Solaris and HP-UX the error
 4315   ENOENT is not documented.
 4316   
 4317   I tested Solaris SPARC and x86, HP-UX i64, AIX, Windows and Linux.
 4318 
 4319 - agent_list_identities: fix out of scope access
 4320   
 4321   An auto variable out of scope was being referenced and used.
 4322   
 4323   fixes #220
 4324 
 4325 - _libssh2_wait_socket: fix timeouts for poll() uses
 4326 
 4327 - windows: inclusion fix
 4328   
 4329   include winsock2.h for all windows compilers
 4330 
 4331 - keyb-interactive: add the fixed buffer
 4332   
 4333   Belongs to commit 5668944
 4334 
 4335 - code cleanup: don't use C99/c++ comments
 4336   
 4337   We aim for C89 compliance
 4338 
 4339 - keyb-interactive: allow zero length fields
 4340   
 4341   Allow zero length fields so they don't cause malloc(0) calls
 4342   
 4343   Avoid free()ing NULL pointers
 4344   
 4345   Avoid a malloc of a fixed 5 byte buffer.
 4346 
 4347 - libssh2_channel_process_startup.3: clean up
 4348   
 4349   Remove the references to the macro-fied shortcuts as they have their own
 4350   individual man pages.
 4351   
 4352   Made the prototype different and more readable.
 4353 
 4354 - man page: fix .BR lines
 4355   
 4356   We don't use \fI etc on .BR lines
 4357 
 4358 - userauth_keyboard_interactive: skip code on zero length auth
 4359 
 4360 - libssh2_channel_forward_accept.3: mention how to get error
 4361   
 4362   Since this returns a pointer, libssh2_session_last_errno() must be used
 4363   to get the actual error code and it wasn't that clear before.
 4364 
 4365 - timeout docs: mention they're added in 1.2.9
 4366 
 4367 - sftp_write_sliding.c: indent fix
 4368   
 4369   Use the standard indenting and removed CVS leftover comment
 4370 
 4371 - [zl liu brought this change]
 4372 
 4373   sftp_write_sliding: send the complete file
 4374   
 4375   When reaching the end of file there can still be data left not sent.
 4376 
 4377 - [Douglas Masterson brought this change]
 4378 
 4379   session_startup: init state properly
 4380   
 4381   libssh2_session_startup() didn't set the state correctly so it could get
 4382   confused.
 4383   
 4384   Fixes #218
 4385 
 4386 - timeout: added man pages
 4387 
 4388 - BLOCK_ADJUST_ERRNO: move rc to right level
 4389   
 4390   We can't declare the variable within the block and use it in the final
 4391   do-while() expression to be properly portable C89.
 4392 
 4393 - [Matt Lilley brought this change]
 4394 
 4395   adds a timeout to blocking calls
 4396   
 4397   Fixes bug #160 as per Daniel's suggestion
 4398   
 4399   Adds libssh2_session_set_timeout() and libssh2_session_get_timeout()
 4400 
 4401 - SCP: fix incorrect error code
 4402   
 4403   After an error occurs in libssh2_scp_recv() or libssh2_scp_send(), the
 4404   function libssh2_session_last_error() would return
 4405   LIBSSH2_ERROR_SOCKET_NONE on error.
 4406   
 4407   Bug: http://trac.libssh2.org/ticket/216
 4408   Patch by: "littlesavage"
 4409   
 4410   Fixes #216
 4411 
 4412 Guenter Knauf (19 Apr 2011)
 4413 - Updated default (recommended) dependency versions.
 4414 
 4415 Daniel Stenberg (17 Apr 2011)
 4416 - libssh2_session_block_directions: fix mistake
 4417   
 4418   The last LIBSSH2_SESSION_BLOCK_INBOUND should be
 4419   LIBSSH2_SESSION_BLOCK_OUTBOUND
 4420   
 4421   And I shortened the short description
 4422   
 4423   Reported by: "drswinghead"
 4424 
 4425 - msvcproj: added libs and debug stuff
 4426   
 4427   Added libraries needed to link whether using openssl dynamically or
 4428   statically
 4429   
 4430   Added LIBSSH2DEBUG define to debug versions to enable tracing
 4431   
 4432   URL: http://trac.libssh2.org/ticket/215
 4433   Patch by: Mark Smith
 4434 
 4435 - sftp_write: clean offsets on error
 4436   
 4437   When an error has occurred on FXP_WRITE, we must make sure that the
 4438   offset, sent offset and acked counter are reset properly.
 4439 
 4440 - example/.gitignore: ignore built binaries
 4441 
 4442 - sftp_write: flush the packetlist on error
 4443   
 4444   When an error occurs during write, flush the entire list of pending
 4445   outgoing SFTP packets.
 4446 
 4447 - keepalive: add first basic man pages
 4448   
 4449   Someone on IRC pointed out that we don't have these documented so I
 4450   wrote up a first set based on the information in the wiki:
 4451   http://trac.libssh2.org/wiki/KeepAlive
 4452 
 4453 - scp_write_nonblock.c: remove pointless check
 4454   
 4455   libssh2_channel_write() cannot return a value that is larger than the
 4456   input length value
 4457 
 4458 Mikhail Gusarov (9 Apr 2011)
 4459 - s/\.NF/.nf/ to fix wrong macro name caught by man --warnings
 4460 
 4461 Daniel Stenberg (6 Apr 2011)
 4462 - version: bump to 1.2.9_dev
 4463   
 4464   Also update the copyright year range to include 2011
 4465 
 4466 - configure: fix $VERSION
 4467   
 4468   Stop using the $VERSION variable as it seems to be magically used by
 4469   autoconfig itself and thus gets set to the value set in AC_INIT()
 4470   without us wanting that. $LIBSSH2VER is now the libssh2 version as
 4471   detected.
 4472   
 4473   Reported by: Paul Howarth
 4474   Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2011-04/0008.shtml
 4475 
 4476 - maketgz: use git2news.pl by the correct name
 4477 
 4478 Version 1.2.8 (4 Apr 2011)
 4479 
 4480 Daniel Stenberg (4 Apr 2011)
 4481 - RELEASE-NOTES: synced with fabf1a45ee
 4482 
 4483 - NEWS: auto-generated from git
 4484   
 4485   Starting now, the NEWS file is generated from git using the git2news.pl
 4486   script. This makes it always accurate and up-to-date, even for daily
 4487   snapshots etc.
 4488 
 4489 - sftp_write: handle FXP_WRITE errors
 4490   
 4491   When an sftp server returns an error back on write, make sure the
 4492   function bails out and returns the proper error.
 4493 
 4494 - configure: stop using the deprecated AM_INIT_AUTOMAKE syntax
 4495 
 4496 Alexander Lamaison (13 Mar 2011)
 4497 - Support unlimited number of host names in a single line of the known_hosts file.
 4498   
 4499   Previously the code assumed either a single host name or a hostname,ip-address pair.  However, according to the spec [1], there can be any number of comma separated host names or IP addresses.
 4500   
 4501   [1] http://www.openbsd.org/cgi-bin/man.cgi?query=sshd&sektion=8
 4502 
 4503 Daniel Stenberg (26 Feb 2011)
 4504 - libssh2_knownhost_readfile.3: clarify return value
 4505   
 4506   This function returns the number of parsed hosts on success, not just
 4507   zero as previously documented.
 4508 
 4509 Peter Stuge (26 Feb 2011)
 4510 - Don't save allocated packet size until it has actually been allocated
 4511   
 4512   The allocated packet size is internal state which needs to match reality
 4513   in order to avoid problems. This commit fixes #211.
 4514 
 4515 Daniel Stenberg (21 Feb 2011)
 4516 - [Alfred Gebert brought this change]
 4517 
 4518   session_startup: manage server data before server identification
 4519   
 4520   Fix the bug that libssh2 could not connect if the sftp server
 4521   sends data before sending the version string.
 4522   
 4523   http://tools.ietf.org/html/rfc4253#section-4.2
 4524   
 4525   "The server MAY send other lines of data before sending the version
 4526   string.  Each line SHOULD be terminated by a Carriage Return and Line
 4527   Feed.  Such lines MUST NOT begin with "SSH-", and SHOULD be encoded
 4528   in ISO-10646 UTF-8 [RFC3629] (language is not specified).  Clients
 4529   MUST be able to process such lines."
 4530 
 4531 - [Alfred Gebert brought this change]
 4532 
 4533   fullpacket: decompression only after init
 4534   
 4535   The buffer for the decompression (remote.comp_abstract) is initialised
 4536   in time when it is needed.  With this fix decompression is disabled when
 4537   the buffer (remote.comp_abstract) is not initialised.
 4538   
 4539   Bug: http://trac.libssh2.org/ticket/200
 4540 
 4541 - _libssh2_channel_read: store last error
 4542   
 4543   When the transport layer returns EAGAIN this function didn't call
 4544   _libssh2_error() which made the last_error not get set.
 4545 
 4546 - sftp_write: clarified the comment header
 4547 
 4548 - sftp_read: avoid wrapping counter to insanity
 4549   
 4550   As pointed out in bug #206, if a second invoke of libssh2_sftp_read()
 4551   would shrink the buffer size, libssh2 would go nuts and send out read
 4552   requests like crazy. This was due to an unsigned variable turning
 4553   "negative" by some wrong math, and that value would be the amount of
 4554   data attempt to pre-buffer!
 4555   
 4556   Bug: http://trac.libssh2.org/ticket/206
 4557 
 4558 - sftp_packet_read: use 32bit variables for 32bit data
 4559 
 4560 - libssh2_sftp_stat_ex.3: cleaned up, extended
 4561   
 4562   Removed the macros from it as they have their own man pages.
 4563   
 4564   Added the LIBSSH2_SFTP_ATTRIBUTES struct in here for easier reference.
 4565 
 4566 - sftp_readdir: return error if buffer is too small
 4567   
 4568   If asked to read data into a buffer and the buffer is too small to hold
 4569   the data, this function now returns an error instead of as previously
 4570   just copy as much as fits.
 4571 
 4572 - sftp_symlink: return error if receive buffer too small
 4573   
 4574   and clean up some variable type mismatches
 4575   
 4576   Discussion: http://www.libssh2.org/mail/libssh2-devel-archive-2011-01/0001.shtml
 4577 
 4578 - docs: clarify what happens with a too small buffer
 4579   
 4580   This flaw is subject to change, but I figured it might be valuable to
 4581   users of existing code to know how it works.
 4582 
 4583 - channel_request_pty_size: fix reqPTY_state
 4584   
 4585   The state variable isn't properly set so every other call to the
 4586   function fails!
 4587   
 4588   Bug: http://libssh2.org/mail/libssh2-devel-archive-2010-12/0096.shtml
 4589   Reported by: Steve Legg
 4590 
 4591 - data size: cleanup
 4592   
 4593   Fix 64bit warnings by using (s)size_t and dedicated uint32_t types more.
 4594 
 4595 - [Pierre Joye brought this change]
 4596 
 4597   ssize_t: proper typedef with MSVC compilers
 4598   
 4599   As discussed on the mailing list, it was wrong for win64 and using the
 4600   VC-provided type is the safest approach instead of second- guessing
 4601   which one it should be.
 4602 
 4603 Guenter Knauf (22 Dec 2010)
 4604 - Updated OpenSSL version.
 4605 
 4606 - Expanded tabs to spaces.
 4607 
 4608 Peter Stuge (21 Dec 2010)
 4609 - [Joey Degges brought this change]
 4610 
 4611   _libssh2_ntohu64: fix conversion from network bytes to uint64
 4612   
 4613   Cast individual bytes to uint64 to avoid overflow in arithmetic.
 4614 
 4615 Daniel Stenberg (20 Dec 2010)
 4616 - libssh2_userauth_list: language fix
 4617   
 4618   "faily" is not a good English word, and I also cleaned up some other minor
 4619   mistakes
 4620 
 4621 - crypto: unify the generic functions
 4622   
 4623   Added crypto.h that is the unified header to include when using crypto
 4624   functionality. It should be the only header that needs to adapt to the
 4625   underlying crypto library in use. It provides the set of prototypes that
 4626   are library agnostic.
 4627 
 4628 - [Mark Smith brought this change]
 4629 
 4630   userauth: derive publickey from private
 4631   
 4632   Pass a NULL pointer for the publickey parameter of
 4633   libssh2_userauth_publickey_fromfile and
 4634   libssh2_userauth_hostbased_fromfile functions.  In this case, the
 4635   functions recompute the public key from the private key file data.
 4636   
 4637   This is work done by Jean-Louis CHARTON
 4638   <Jean-Louis.CHARTON@oikialog.com>, then adapted by Mark Smith and
 4639   slightly edited further by me Daniel.
 4640   
 4641   WARNING: this does leave the feature NOT WORKING when libssh2 is built
 4642   to use libgcrypt instead of OpenSSL simply due to lack of
 4643   implementation.
 4644 
 4645 - ssh2_echo: Value stored to 'exitcode' is never read
 4646 
 4647 - _libssh2_packet_add: fix SSH_MSG_DEBUG weirdness
 4648   
 4649   I believe I may have caused this weird typo style error when I cleaned
 4650   up this function a while ago. Corrected now.
 4651 
 4652 - uint32: more longs converted to proper types
 4653   
 4654   I also moved the MAC struct over to the mac.h header file and made sure
 4655   that the users of that struct include that file.
 4656 
 4657 - SFTP: more types to uint32_t
 4658   
 4659   The 'num_names' field in the SSH_FXP_NAME response is an unsigned 32bit
 4660   value so we make sure to treat it like that.
 4661 
 4662 - SFTP: request_ids are uint32_t
 4663   
 4664   I went over the code and made sure we use uint32_t all over for the
 4665   request_id data. It is an unsigned 32bit value on the wire.
 4666 
 4667 - SFTP: store request_id separately in packets
 4668   
 4669   By using a new separate struct for incoming SFTP packets and not sharing
 4670   the generic packet struct, we can get rid of an unused field and add a
 4671   new one dedicated for holding the request_id for the incoming
 4672   package. As sftp_packet_ask() is called fairly often, a "mere" integer
 4673   comparison is MUCH faster than the previous memcmp() of (typically) 5
 4674   bytes.
 4675 
 4676 - libssh2_sftp_open_ex: man page extended and cleaned up
 4677   
 4678   I added the missing documentation for the 'flags' argument.
 4679 
 4680 - SFTP: unify the READ/WRITE chunk structs
 4681 
 4682 - SFTP: fix memory leaks
 4683   
 4684   Make sure that we cleanup remainders when the handle is closed and when
 4685   the subsystem is shutdown.
 4686   
 4687   Existing flaw: if a single handle sends packets that haven't been
 4688   replied to yet at the time when the handle is closed, those packets will
 4689   arrive later and end up in the generic packet brigade queue and they
 4690   will remain in there until flushed. They will use unnecessary memory,
 4691   make things slower and they will ruin the SFTP handling if the
 4692   request_id counter ever wraps (highly unlikely to every happen).
 4693 
 4694 - sftp_close_handle: packet list is generic
 4695   
 4696   Fix comment, simplify the loop logic
 4697 
 4698 - sftp_read: pipeline reads
 4699   
 4700   The SFTP read function now does transfers the same way the SFTP write
 4701   function was made to recently: it creates a list of many outgoing
 4702   FXP_READ packets that each asks for a small data chunk. The code then
 4703   tries to keep sending read request while collecting the acks for the
 4704   previous requests and returns the received data.
 4705 
 4706 - sftp_write: removed unused variable
 4707 
 4708 - _libssh2_channel_close: don't call transport read if disconnected
 4709   
 4710   The loop that waits for remote.close to get set may end up looping
 4711   forever since session->socket_state gets set to
 4712   LIBSSH2_SOCKET_DISCONNECTED by the packet_add() function called from the
 4713   transport_read() function and after having been set to
 4714   LIBSSH2_SOCKET_DISCONNECTED, the transport_read() function will only
 4715   return 0.
 4716   
 4717   Bug: http://trac.libssh2.org/ticket/198
 4718 
 4719 - libssh2_sftp_seek64: new man page
 4720   
 4721   Split off libssh2_sftp_seek64 from the libssh2_sftp_seek man page, and
 4722   mentioned that we consider the latter deprecated. Also added a mention
 4723   about the dangers of doing seek during writing or reading.
 4724 
 4725 - sftp_seek: fix
 4726   
 4727   The new SFTP write code caused a regression as the seek function no
 4728   longer worked as it didn't set the write position properly.
 4729   
 4730   It should be noted that seeking is STRONGLY PROHIBITED during upload, as
 4731   the upload magic uses two different offset positions and the multiple
 4732   outstanding packets etc make them sensitive to change in the midst of
 4733   operations.
 4734   
 4735   This functionality was just verified with the new example code
 4736   sftp_append. This bug was filed as bug #202:
 4737   
 4738   Bug: http://trac.libssh2.org/ticket/202
 4739 
 4740 - sftp_append: new example doing SFTP append
 4741 
 4742 - MAX_SFTP_OUTGOING_SIZE: 30000
 4743   
 4744   I ran SFTP upload tests against localhost. It showed that to make the
 4745   app reach really good speeds, I needed to do a little code tweak and
 4746   change MAX_SFTP_OUTGOING_SIZE from 4000 to 30000. The tests I did before
 4747   with the high latency tests didn't show any real difference whatever I
 4748   had that size set to.
 4749   
 4750   This number is the size in bytes that libssh2 cuts off the large input
 4751   buffer and sends off as an individual sftp packet.
 4752 
 4753 - sftp_write_sliding.c: new example
 4754   
 4755   This is an example that is very similar to sftp_write_nonblock.c, with
 4756   the exception that this uses
 4757   
 4758   1 - a larger upload buffer
 4759   
 4760   2 - a sliding buffer mechnism to allow the app to keep sending lots of
 4761   data to libssh2 without having to first drain the buffer.
 4762   
 4763   These are two key issues to make libssh2 SFTP uploads really perform
 4764   well at this point in time.
 4765 
 4766 - cpp: s/#elsif/#elif
 4767   
 4768   This looks like a typo as #elsif is not really C...
 4769 
 4770 - _libssh2_channel_write: revert channel_write() use
 4771   
 4772   The attempts made to have _libssh2_channel_write() accept larger pieces
 4773   of data and split up the data by itself into 32700 byte chunks and pass
 4774   them on to channel_write() in a loop as a way to do faster operations on
 4775   larger data blocks was a failed attempt.
 4776   
 4777   The reason why it is difficult:
 4778   
 4779   The API only allows EAGAIN or a length to be returned. When looping over
 4780   multiple blocks to get sent, one block can get sent and the next might
 4781   not. And yet: when transport_send() has returned EAGAIN we must not call
 4782   it again with new data until it has returned OK on the existing data it
 4783   is still working on. This makes it a mess and we do get a much easier
 4784   job by simply returning the bytes or EAGAIN at once, as in the EAGAIN
 4785   case we can assume that we will be called with the same arguments again
 4786   and transport_send() will be happy.
 4787   
 4788   Unfortunately, I think we take a small performance hit by not being able
 4789   to do this.
 4790 
 4791 - ssh2_echo: new example
 4792   
 4793   This is a new example snippet. The code is largely based on ssh2_exec,
 4794   and is written by Tommy Lindgren. I edited it into C90 compliance and to
 4795   conform to libssh2 indent style and some more.
 4796 
 4797 - send_existing: return after send_existing
 4798   
 4799   When a piece of data is sent from the send_existing() function we must
 4800   make the parent function return afterwards. Otherwise we risk that the
 4801   parent function tries to send more data and ends up getting an EGAIN for
 4802   that more data and since it can only return one return code it doesn't
 4803   return info for the successfully sent data.
 4804   
 4805   As this change is a regression I now added a larger comment explaining
 4806   why it has to work like this.
 4807 
 4808 - _libssh2_channel_write: count resent data as written
 4809   
 4810   In the logic that resends data that was kept for that purpose due to a
 4811   previous EAGAIN, the data was not counted as sent causing badness.
 4812 
 4813 Peter Stuge (13 Nov 2010)
 4814 - Use fprintf(stderr, ) instead of write(2, ) for debugging
 4815 
 4816 - session/transport: Correctly handle when _libssh2_send() returns -EAGAIN
 4817 
 4818 - src/agent.c: Simplify _libssh2_send() error checking ever so slightly
 4819 
 4820 Daniel Stenberg (12 Nov 2010)
 4821 - send/recv: use _libssh2_recv and _libssh2_send now
 4822   
 4823   Starting now, we unconditionally use the internal replacement functions
 4824   for send() and recv() - creatively named _libssh2_recv() and
 4825   _libssh2_send().
 4826   
 4827   On errors, these functions return the negative 'errno' value instead of
 4828   the traditional -1. This design allows systems that have no "natural"
 4829   errno support to not have to invent it. It also means that no code
 4830   outside of these two transfer functions should use the errno variable.
 4831 
 4832 - channel_write: move some logic to _libssh2_channel_write
 4833   
 4834   Some checks are better done in _libssh2_channel_write just once per
 4835   write instead of in channel_write() since the looping will call the
 4836   latter function multiple times per _libssh2_channel_write() invoke.
 4837 
 4838 - sftp_write: handle "left over" acked data
 4839   
 4840   The SFTP handle struct now buffers number of acked bytes that haven't
 4841   yet been returned. The way this is used is as following:
 4842   
 4843   1. sftp_write() gets called with a buffer of let say size 32000. We
 4844   split 32000 into 8 smaller packets and send them off one by one. One of
 4845   them gets acked before the function returns so 4000 is returned.
 4846   
 4847   2. sftp_write() gets called again a short while after the previous one,
 4848   now with a much smaller size passed in to the function. Lets say 8000.
 4849   In the mean-time, all of the remaining packets from the previous call
 4850   have been acked (7*4000 = 28000). This function then returns 8000 as all
 4851   data passed in are already sent and it can't return any more than what
 4852   it got passed in. But we have 28000 bytes acked. We now store the
 4853   remaining 20000 in the handle->u.file.acked struct field to add up in
 4854   the next call.
 4855   
 4856   3. sftp_write() gets called again, and now there's a backlogged 20000
 4857   bytes to return as fine and that will get skipped from the beginning
 4858   of the buffer that is passed in.
 4859 
 4860 - sftp_write: polished and simplified
 4861   
 4862   Removed unnecessary struct fields and state changes within the function.
 4863   
 4864   Made the loop that checks for ACKs only check chunks that were fully
 4865   sent.
 4866 
 4867 - SCP: on failure, show the numerical error reason
 4868   
 4869   By calling libssh2_session_last_errno()
 4870 
 4871 - SFTP: provide the numerical error reason on failure
 4872 
 4873 - SCP: clean up failure treatment
 4874   
 4875   When SCP send or recv fails, it gets a special message from the server
 4876   with a warning or error message included. We have no current API to
 4877   expose that message but the foundation is there. Removed unnecessary use
 4878   of session struct fields.
 4879 
 4880 - sftp_write: enlarge buffer to perform better
 4881 
 4882 - packets: code cleanup
 4883   
 4884   I added size checks in several places. I fixed the code flow to be easier
 4885   to read in some places.
 4886   
 4887   I removed unnecessary zeroing of structs. I removed unused struct fields.
 4888 
 4889 - LIBSSH2_CALLBACK_MACERROR: clarify return code use
 4890 
 4891 - _libssh2_userauth_publickey: avoid shadowing
 4892 
 4893 - packet: avoid shadowing global symbols
 4894 
 4895 - sftp_readdir: avoid shadowing
 4896 
 4897 - shadowing: don't shadow the global compress
 4898 
 4899 - _libssh2_packet_add: turn ifs into a single switch
 4900 
 4901 - _libssh2_packet_add: check SSH_MSG_GLOBAL_REQUEST packet
 4902 
 4903 - _libssh2_packet_add: SSH_MSG_DEBUG length checks
 4904   
 4905   Verify lengths before using them. Read always_display from the correct
 4906   index. Don't copy stuff around just to provide zero-termination of the
 4907   strings.
 4908 
 4909 - _libssh2_packet_add: SSH_MSG_IGNORE skip memmove
 4910   
 4911   There's no promise of a zero termination of the data in the callback so
 4912   no longer perform ugly operation in order to provide it.
 4913 
 4914 - _libssh2_packet_add: SSH_MSG_DISCONNECT length checks
 4915   
 4916   Verify lengths before trying to read data.
 4917 
 4918 - indent: break lines at 80 columns
 4919 
 4920 - SSH_MSG_CHANNEL_OPEN_FAILURE: used defined values
 4921   
 4922   We don't like magic numbers in the code. Now the acceptable failure
 4923   codes sent in the SSH_MSG_CHANNEL_OPEN_FAILURE message are added as
 4924   defined values in the private header file.
 4925 
 4926 - sftp_write: don't return EAGAIN if no EAGAIN was received
 4927   
 4928   This function now only returns EAGAIN if a lower layer actually returned
 4929   EAGAIN to it. If nothing was acked and no EAGAIN was received, it will
 4930   now instead return 0.
 4931 
 4932 - _libssh2_wait_socket: detect nothing-to-wait-for
 4933   
 4934   If _libssh2_wait_socket() gets called but there's no direction set to
 4935   wait for, this causes a "hang". This code now detects this situation,
 4936   set a 1 second timeout instead and outputs a debug output about it.
 4937 
 4938 - decomp: remove the free_dest argument
 4939   
 4940   Since the decompress function ALWAYS returns allocated memory we get a
 4941   lot simpler code by removing the ability to return data unallocated.
 4942 
 4943 - decomp: cleaned off old compression stuff
 4944   
 4945   I cleared off legacy code from when the compression and decompression
 4946   functions were a single unified function. Makes the code easier to read
 4947   too.
 4948 
 4949 - [TJ Saunders brought this change]
 4950 
 4951   decomp: increase decompression buffer sizes
 4952 
 4953 - [TJ Saunders brought this change]
 4954 
 4955   zlib: Add debug tracing of zlib errors
 4956 
 4957 - sftp_packet_read: handle partial reads of the length field
 4958   
 4959   SFTP packets come as [32 bit length][payload] and the code didn't
 4960   previously handle that the initial 32 bit field was read only partially
 4961   when it was read.
 4962 
 4963 - [Jasmeet Bagga brought this change]
 4964 
 4965   kex_agree_hostkey: fix NULL pointer derefence
 4966   
 4967   While setting up the session, ssh tries to determine the type of
 4968   encryption method it can use for the session. This requires looking at
 4969   the keys offered by the remote host and comparing these with the methods
 4970   supported by libssh2 (rsa & dss). To do this there is an iteration over
 4971   the array containing the methods supported by libssh2.
 4972   
 4973   If there is no agreement on the type of encryption we come to the 3rd
 4974   entry of the hostkeyp array. Here hostkeyp is valid but *hostkep is
 4975   NULL. Thus when we dereference that in (*hostkeyp)->name there is a
 4976   crash
 4977 
 4978 - _libssh2_transport_send: remove dead assignment
 4979   
 4980   'data' isn't accessed beyond this point so there's no need to assign it.
 4981 
 4982 - scp_recv: remove dead assignment
 4983   
 4984   Instead of assigning a variable we won't read, we now use the more
 4985   explicit (void) prefix.
 4986 
 4987 - sftp_write: removed superfluous assignment
 4988 
 4989 - bugfix: avoid use of uninitialized value
 4990 
 4991 - sftp_packet_require: propagate error codes better
 4992   
 4993   There were some chances that they would cause -1 to get returned by
 4994   public functions and as we're hunting down all such occurances and since
 4995   the underlying functions do return valuable information the code now
 4996   passes back proper return codes better.
 4997 
 4998 - [Alfred Gebert brought this change]
 4999 
 5000   fix memory leaks (two times cipher_data) for each sftp session
 5001 
 5002 - libssh2_userauth_authenticated: make it work as documented
 5003   
 5004   The man page clearly says it returns 1 for "already authenticated" but
 5005   the code said non-zero. I changed the code to use 1 now, as that is also
 5006   non-zero but it gets the benefit that it now matches the documentation.
 5007   
 5008   Using 1 instead of non-zero is better for two reasons:
 5009   
 5010   1. We have the opportunity to introduce other return codes in the future for
 5011      things like error and what not.
 5012   2. We don't expose the internal bitmask variable value.
 5013 
 5014 - userauth_keyboard_interactive: fix indent
 5015 
 5016 - [Alfred Gebert brought this change]
 5017 
 5018   fix memory leak in userauth_keyboard_interactive()
 5019   
 5020   First I wanted to free the memory in session_free() but then
 5021   I had still memory leaks because in my test case the function
 5022   userauth_keyboard_interactive() is called twice. It is called
 5023   twice perhaps because the server has this authentication
 5024   methods available: publickey,gssapi-with-mic,keyboard-interactive
 5025   The keyboard-interactive method is successful.
 5026 
 5027 - dist: include sftp.h in dist archives
 5028 
 5029 Simon Josefsson (27 Oct 2010)
 5030 - Update header to match new function prototype, see c48840ba88.
 5031 
 5032 Daniel Stenberg (26 Oct 2010)
 5033 - bugfixes: the transport rearrange left some subtle flaws now gone
 5034 
 5035 - libssh2_userauth_publickey_fromfile_ex.3: cleaned up looks
 5036 
 5037 - libssh2_userauth_publickey: add man page
 5038   
 5039   I found an undocumented public function and we can't have it like
 5040   that. The description here is incomplete, but should serve as a template
 5041   to allow filling in...
 5042 
 5043 - libssh2_sftp_write.3: added blurb about the "write ahead"
 5044   
 5045   Documented the new SFTP write concept
 5046 
 5047 - sftp_close_handle: free any trailing write chunks
 5048 
 5049 - _libssh2_channel_write: fix warnings
 5050 
 5051 - SFTP: bufgix, move more sftp stuff to sftp.h
 5052   
 5053   The sftp_write function shouldn't assume that the buffer pointer will be
 5054   the same in subsequent calls, even if it assumes that the data already
 5055   passed in before haven't changed.
 5056   
 5057   The sftp structs are now moved to sftp.h (which I forgot to add before)
 5058 
 5059 - SFTP: use multiple outgoing packets when writing
 5060   
 5061   sftp_write was rewritten to split up outgoing data into multiple packets
 5062   and deal with the acks in a more asynchronous manner. This is meant to
 5063   help overcome latency and round-trip problems with the SFTP protocol.
 5064 
 5065 - TODO: implemented a lot of the ideas now
 5066 
 5067 - _libssh2_channel_write: removed 32500 size limit
 5068   
 5069   Neither _libssh2_channel_write nor sftp_write now have the 32500 size
 5070   limit anymore and instead the channel writing function now has its own
 5071   logic to send data in multiple calls until everything is sent.
 5072 
 5073 - send_existing: don't tell parent to return when drained
 5074   
 5075   That will just cause unnecessary code execution.
 5076 
 5077 - _libssh2_channel_write: general code cleanup
 5078   
 5079   simplified the function and removed some unused struct fields
 5080 
 5081 - _libssh2_transport_send: replaces _libssh2_transport_write
 5082   
 5083   The new function takes two data areas, combines them and sends them as a
 5084   single SSH packet. This allows several functions to allocate and copy
 5085   less data.
 5086   
 5087   I also found and fixed a mixed up use of the compression function
 5088   arguments that I introduced in my rewrite in a recent commit.
 5089 
 5090 - scp_write_nonblock: use select() instead of busyloop
 5091   
 5092   Make this example nicer by not busylooping.
 5093 
 5094 - send_existing: clear olen when the data is sent off
 5095 
 5096 - _libssh2_transport_write: allow 256 extra bytes around the packet
 5097 
 5098 - _libssh2_transport_write: remade to send without malloc
 5099 
 5100 - compress: compression disabled by default
 5101   
 5102   We now allow libssh2_session_flag() to enable compression with a new
 5103   flag and I added documentation for the previous LIBSSH2_FLAG_SIGPIPE
 5104   flag which I wasn't really aware of!
 5105 
 5106 - comp: split the compress function
 5107   
 5108   It is now made into two separate compress and decompress functions. In
 5109   preparation for upcoming further modficications.
 5110 
 5111 Dan Fandrich (20 Oct 2010)
 5112 - Added header file to allow compiling in older environments
 5113 
 5114 Daniel Stenberg (20 Oct 2010)
 5115 - TODO: add a possible new API for SFTP transfers
 5116 
 5117 - TODO: "New Transport API" added
 5118 
 5119 - TODO: add buffering plans
 5120 
 5121 Simon Josefsson (13 Oct 2010)
 5122 - Mention libssh2_channel_get_exit_signal and give kudos.
 5123 
 5124 - [Tommy Lindgren brought this change]
 5125 
 5126   Add libssh2_channel_get_exit_signal man page.
 5127   
 5128   Signed-off-by: Simon Josefsson <simon@josefsson.org>
 5129 
 5130 - [Tommy Lindgren brought this change]
 5131 
 5132   Add libssh2_channel_get_exit_signal.
 5133   
 5134   Signed-off-by: Simon Josefsson <simon@josefsson.org>
 5135 
 5136 - Add libssh2_free man page and fix typo.
 5137 
 5138 - Add libssh2_free.
 5139 
 5140 Daniel Stenberg (11 Oct 2010)
 5141 - scp_recv: improved treatment of channel_read() returning zero
 5142   
 5143   As a zero return code from channel_read() is not an error we must make
 5144   sure that the SCP functions deal with that properly. channel_read()
 5145   always returns 0 if the channel is EOFed already so we check for EOF
 5146   after 0-reads to be able to return error properly.
 5147 
 5148 - libssh2_session_methods.3: detail what can be asked for
 5149 
 5150 - compression: send zlib before none
 5151   
 5152   As the list of algorithms in a preferred order we should send zlib
 5153   before none to increase the chances that the server will let us do
 5154   compression.
 5155 
 5156 - compress: faster check, better return codes
 5157   
 5158   In the transport functions we avoid a strcmp() now and just check a
 5159   boolean instead.
 5160   
 5161   The compress/decompress function's return code is now acknowledged and
 5162   used as actual return code in case of failures.
 5163 
 5164 - libssh2_session_handshake: replaces libssh2_session_startup()
 5165   
 5166   The function libssh2_session_startup() is now considered deprecated due
 5167   to the portability issue with the socket argument.
 5168   libssh2_session_handshake() is the name of the replacement.
 5169 
 5170 - libssh2_socket_t: now externally visible
 5171   
 5172   In preparation for upcominig changes, the libssh2_socket_t type is now
 5173   typedef'ed in the public header.
 5174 
 5175 - _libssh2_transport_drain: removed
 5176   
 5177   This function proved not to be used nor useful.
 5178 
 5179 - _libssh2_channel_write: don't iterate over transport writes
 5180   
 5181   When a call to _libssh2_transport_write() succeeds, we must return from
 5182   _libssh2_channel_write() to allow the caller to provide the next chunk
 5183   of data.
 5184   
 5185   We cannot move on to send the next piece of data that may already have
 5186   been provided in this same function call, as we risk getting EAGAIN for
 5187   that and we can't return information both about sent data as well as
 5188   EAGAIN. So, by returning short now, the caller will call this function
 5189   again with new data to send.
 5190 
 5191 - _libssh2_transport_write: updated documentation blurb
 5192 
 5193 - _libssh2_transport_write: remove fprintf remainder
 5194   
 5195   Mistake from previous debugging
 5196 
 5197 - session: improved errors
 5198   
 5199   Replaced -1/SOCKET_NONE errors with appropriate error defines instead.
 5200   
 5201   Made the verbose trace output during banner receiving less annoying for
 5202   non-blocking sessions.
 5203 
 5204 - crypt_init: use correct error define
 5205 
 5206 - _libssh2_error: hide EAGAIN for non-blocking sessions
 5207   
 5208   In an attempt to make the trace output less cluttered for non-blocking
 5209   sessions the error function now avoids calling the debug function if the
 5210   error is the EAGAIN and the session is non-blocking.
 5211 
 5212 - agent: use better error defines
 5213 
 5214 - comp_method_zlib_init: use correct error defines
 5215 
 5216 - transport: better error codes
 5217   
 5218   LIBSSH2_SOCKET_NONE (-1) should no longer be used as error code as it is
 5219   (too) generic and we should instead use specific and dedicated error
 5220   codes to better describe the error.
 5221 
 5222 - channel: return code and _libssh2_error cleanup
 5223   
 5224   Made sure that all transport_write() call failures get _libssh2_error
 5225   called.
 5226 
 5227 - _libssh2_channel_write: limit to 32700 bytes
 5228   
 5229   The well known and used ssh server Dropbear has a maximum SSH packet
 5230   length at 32768 by default. Since the libssh2 design current have a
 5231   fixed one-to-one mapping from channel_write() to the packet size created
 5232   by transport_write() the previous limit of 32768 in the channel layer
 5233   caused the transport layer to create larger packets than 32768 at times
 5234   which Dropbear rejected forcibly (by closing the connection).
 5235   
 5236   The long term fix is of course to remove the hard relation between the
 5237   outgoing SSH packet size and what the input length argument is in the
 5238   transport_write() function call.
 5239 
 5240 - libssh.h: add more dedicated error codes
 5241 
 5242 - SCP: allow file names with bytes > 126
 5243   
 5244   When parsing the SCP protocol and verifying that the data looks like a
 5245   valid file name, byte values over 126 must not be consider illegal since
 5246   UTF-8 file names will use such codes.
 5247   
 5248   Reported by: Uli Zappe
 5249   Bug: http://www.libssh2.org/mail/libssh2-devel-archive-2010-08/0112.shtml
 5250 
 5251 Dan Fandrich (25 Aug 2010)
 5252 - Document the three sftp stat constants
 5253 
 5254 Guenter Knauf (18 Aug 2010)
 5255 - Fixed Win32 makefile which was now broken at resource build.
 5256 
 5257 - It is sufficient to pipe stderr to NUL to get rid of the nasty messages.
 5258 
 5259 - [Author: Guenter Knauf brought this change]
 5260 
 5261   Removed Win32 ifdef completely for sys/uio.h.
 5262   
 5263   No idea why we had this ifdef at all but MSVC, MingW32, Watcom
 5264   and Borland all have no sys/uio.h header; so if there's another
 5265   Win32 compiler which needs it then it should be added explicitely
 5266   instead of this negative list.
 5267 
 5268 - New files should also be added to Makefile.am.
 5269   
 5270   Otherwise they will never be included with release and snapshot tarballs ...
 5271 
 5272 Daniel Stenberg (18 Aug 2010)
 5273 - version: bump to 1.2.8_DEV
 5274 
 5275 Version 1.2.7 (17 Aug 2010)
 5276 
 5277 Daniel Stenberg (17 Aug 2010)
 5278 - release: updated to hold 1.2.7 info
 5279 
 5280 Guenter Knauf (17 Aug 2010)
 5281 - Use the new libssh2.rc file.
 5282 
 5283 - Added resource file for libssh2.dll (shamelessly stolen from libcurl).
 5284 
 5285 - Updated Win32 MSVC dependencies versions.
 5286 
 5287 - Added include for sys/select.h to get fd.set on some platforms.
 5288 
 5289 - Added Watcom makefile borrowed from libcurl.
 5290   
 5291   This makefile compiles already all files fine for static lib, but needs
 5292   final touch when I have OpenSSL fully working with shared libs and Watcom.
 5293 
 5294 - Added copyright define to libssh2.h and use it for binary builds.
 5295 
 5296 - Moved version defines up in order to include from .rc file.
 5297   
 5298   Blocked rest of header with ifndef so its possible to let
 5299   the rc compiler only use the version defines.
 5300 
 5301 - Some minor makefile tweaks.
 5302 
 5303 Daniel Stenberg (2 Aug 2010)
 5304 - example: treat the libssh2_channel_read() return code properly
 5305   
 5306   A short read is not an error. Only negative values are errors!
 5307 
 5308 - libssh2_wait_socket: reset error code to "leak" EAGAIN less
 5309   
 5310   Since libssh2 often sets LIBSSH2_ERROR_EAGAIN internally before
 5311   _libssh2_wait_socket is called, we can decrease some amount of
 5312   confusion in user programs by resetting the error code in this function
 5313   to reduce the risk of EAGAIN being stored as error when a blocking
 5314   function returns.
 5315 
 5316 - _libssh2_wait_socket: poll needs milliseconds
 5317   
 5318   As reported on the mailing list, the code path using poll() should
 5319   multiple seconds with 1000 to get milliseconds, not divide!
 5320   
 5321   Reported by: Jan Van Boghout
 5322 
 5323 - typedef: make ssize_t get typedef without LIBSSH2_WIN32
 5324   
 5325   The condition around the ssize_t typedef depended on both LIBSSH2_WIN32
 5326   *and* _MSC_VER being defined when it should be enough to depend on
 5327   _MSC_VER only. It also makes it nicer so libssh2-using code builds fine
 5328   without having custom defines.
 5329 
 5330 - [John Little brought this change]
 5331 
 5332   session_free: free more data to avoid memory leaks
 5333 
 5334 - channel_free: ignore problems with channel_close()
 5335   
 5336   As was pointed out in bug #182, we must not return failure from
 5337   _libssh2_channel_free() when _libssh2_channel_close() returns an error
 5338   that isn't EAGAIN. It can effectively cause the function to never go
 5339   through, like it did now in the case where the socket was actually
 5340   closed but socket_state still said LIBSSH2_SOCKET_CONNECTED.
 5341   
 5342   I consider this fix the right thing as it now also survives other
 5343   errors, even if making sure socket_state isn't lying is also a good
 5344   idea.
 5345 
 5346 - publickey_list_free: no return value from a void function
 5347   
 5348   Fixed a compiler warning I introduced previously when checking input
 5349   arguments more. I also added a check for the other pointer to avoid NULL
 5350   pointer dereferences.
 5351 
 5352 - [Lars Nordin brought this change]
 5353 
 5354   openssl: make use of the EVP interface
 5355   
 5356   Make use of the EVP interface for the AES-funktion. Using this method
 5357   supports the use of different ENGINES in OpenSSL for the AES function
 5358   (and the direct call to the AES_encrypt should not be used according to
 5359   openssl.org)
 5360 
 5361 Peter Stuge (23 Jun 2010)
 5362 - [Tor Arntsen brought this change]
 5363 
 5364   Don't overflow MD5 server hostkey
 5365   
 5366   Use SHA_DIGEST_LENGTH and MD5_DIGEST_LENGTH in memcpy instead of hardcoded
 5367   values. An incorrect value was used for MD5.
 5368 
 5369 - Fix message length bugs in libssh2_debug()
 5370   
 5371   There was a buffer overflow waiting to happen when a debug message was
 5372   longer than 1536 bytes.
 5373   
 5374   Thanks to Daniel who spotted that there was a problem with the message
 5375   length passed to a trace handler also after commit
 5376   0f0652a3093111fc7dac0205fdcf8d02bf16e89f.
 5377 
 5378 - Make libssh2_debug() create a correctly terminated string
 5379   
 5380   Also use FILE *stderr rather than fd 2, which can very well be something
 5381   completely different.
 5382 
 5383 Daniel Stenberg (23 Jun 2010)
 5384 - [TJ Saunders brought this change]
 5385 
 5386   handshake: Compression enabled at the wrong time
 5387   
 5388   In KEXINIT messages, the client and server agree on, among other
 5389   things, whether to use compression. This method agreement occurs
 5390   in src/kex.c's kex_agree_methods() function. However, if
 5391   compression is enabled (either client->server, server->client, or
 5392   both), then the compression layer is initialized in
 5393   kex_agree_methods() -- before NEWKEYS has been received.
 5394   
 5395   Instead, the initialization of the compression layer should
 5396   happen after NEWKEYS has been received. This looks to occur
 5397   insrc/kex.c's diffie_hellman_sha1(), which even has the comment:
 5398   
 5399       /* The first key exchange has been performed,
 5400   
 5401           switch to active crypt/comp/mac mode */
 5402   
 5403   There, after NEWKEYS is received, the cipher and mac algorithms
 5404   are initialized, and that is where the compression should be
 5405   initialized as well.
 5406   
 5407   The current implementation fails if server->client compression is
 5408   enabled because most server implementations follow OpenSSH's
 5409   lead, where compression is initialized after NEWKEYS. Since the
 5410   server initializes compression after NEWKEYS, but libssh2
 5411   initializes compression after KEXINIT (i.e. before NEWKEYS), they
 5412   are out of sync.
 5413   
 5414   Reported in bug report #180
 5415 
 5416 - [TJ Saunders brought this change]
 5417 
 5418   userauth_hostbased_fromfile: packet length too short
 5419   
 5420   The packet length calculated in src/userauth.c's
 5421   userauth_hostbased_fromfile() function is too short by 4 bytes;
 5422   it forgets to add four bytes for the length of the hostname.
 5423   This causes hostbased authentication to fail, since the server
 5424   will read junk data.
 5425   
 5426   verified against proftpd's mod_sftp module
 5427 
 5428 - _libssh2_userauth_publickey: reject method names longer than the data
 5429   
 5430   This functions get the method length by looking at the first 32
 5431   bit of data, and I now made it not accept method lengths that are
 5432   longer than the whole data set is, as given in the dedicated
 5433   function argument.
 5434   
 5435   This was detected when the function was given bogus public key
 5436   data as an ascii string, which caused the first 32bits to create
 5437   a HUGE number.
 5438 
 5439 - NULL resistance: make more public functions survive NULL pointer input
 5440   
 5441   Sending in NULL as the primary pointer is now dealt with by more
 5442   public functions. I also narrowed the userauth.c code somewhat to
 5443   stay within 80 columns better.
 5444 
 5445 - agent: make libssh2_agent_userauth() work blocking properly
 5446   
 5447   previously it would always work in a non-blocking manner
 5448 
 5449 Peter Stuge (17 Jun 2010)
 5450 - Fix underscore typo for 64-bit printf format specifiers on Windows
 5451   
 5452   Commit 49ddf447ff4bd80285f926eac0115f4e595f9425 was missing underscores.
 5453 
 5454 Daniel Stenberg (16 Jun 2010)
 5455 - libssh2_session_callback_set: extended the man page
 5456 
 5457 - [John brought this change]
 5458 
 5459   LIBSSH2_DEBUG: macro uses incorrect function variable
 5460   
 5461   The LIBSSH2_DEBUG macro, defined in libssh2_priv.h, incorrectly uses the
 5462   function variable ssh_msg_disconnect when it should use ssh_msg_debug.
 5463   
 5464   This shows that the LIBSSH2_CALLBACK_DEBUG callback never has worked...
 5465 
 5466 - warning: fix a compiler warning 'pointer differs in signedness'
 5467   
 5468   As reported in bug #177
 5469 
 5470 - portability: introduce LIBSSH2_INT64_T_FORMAT for 64bit printf()s
 5471   
 5472   As pointed out in bug #177, some of the Windows compilers use
 5473   %I64 to output 64 bit variables with the printf family.
 5474 
 5475 - debug: avoid sending NULL to sprintf %s
 5476   
 5477   Via the _libssh2_debug() macro/function. Pointed out by john in bug report
 5478 
 5479 - sftp docs: show macro on macro page, only function on function page
 5480   
 5481   The individual man pages for macros now show the full convenience
 5482   macro as defined, and then the man page for the actual function
 5483   only shows the function.
 5484 
 5485 - code police: make the code use less than 80 columns
 5486 
 5487 - libssh2_channel_write_ex: remove macros, added wording on buffer size
 5488 
 5489 - libssh2_sftp_write: document buffer size and changed some ordering
 5490 
 5491 - libssh2_channel_write_stderr: show how the macro is defined
 5492 
 5493 - libssh2_channel_write: show how the macro is defined
 5494 
 5495 - SFTP: limit write() to not produce overly large packets
 5496   
 5497   sftp_write() now limits how much data it gets at a time even more
 5498   than before. Since this function creates a complete outgoing
 5499   packet based on what gets passed to it, it is crucial that it
 5500   doesn't create too large packets.
 5501   
 5502   With this method, there's also no longer any problem to use very
 5503   large buffers in your application and feed that to libssh2. I've
 5504   done numerous tests now with uploading data over SFTP using 100K
 5505   buffers and I've had no problems with that.
 5506 
 5507 - scp_write_nonblock: add transfer time info
 5508   
 5509   Using the same timing logic and output format as
 5510   sftp_write_nonblock allows us to very easily run benchmarks on
 5511   SCP vs SFTP uploads using libssh2.
 5512 
 5513 - sftp_write_nonblock: select() on socket, use *BIG* buffer, time transfer
 5514   
 5515   The select() is just to make it nicer so that it doesn't
 5516   crazy-loop on EAGAIN. The buffer size thing is mostly to verify
 5517   that this really work as supposed.
 5518   
 5519   Transfer timing is just a minor thing, but it can just as well be
 5520   there and help us time and work on performance easier using out
 5521   of the box examples.
 5522 
 5523 - agent: use _libssh2_error() when returning errors
 5524   
 5525   As pointed out in bug report #173, this module basically never
 5526   used _libssh2_error() which made it work inconstently with other
 5527   parts of the libssh2 code base. This is my first take at making
 5528   this code more in line with the rest.
 5529 
 5530 - inputchecks: make lots of API functions check for NULL pointers
 5531   
 5532   If an application accidentally provides a NULL handle pointer to
 5533   the channel or sftp public functions, they now return an error
 5534   instead of segfaulting.
 5535 
 5536 - libssh2_channel_eof: clarify that it returns negative on errors
 5537 
 5538 - SFTP: keep the sftp error code as 32 bit
 5539   
 5540   'last_errno' holds to the error code from the SFTP protocol and
 5541   since that is 32 bits on the wire there's no point in using a
 5542   long for this internally which is larger on some platforms.
 5543 
 5544 - agent: make the code better deal with unexpected code flows
 5545   
 5546   agent->ops gets initialized by the libssh2_agent_connect() call
 5547   but we need to make sure that we don't segfault even if a bad
 5548   sequence of function calls is used.
 5549 
 5550 Alexander Lamaison (10 Jun 2010)
 5551 - Better handling of invalid key files.
 5552   
 5553   Passing an invalid public key to libssh2_userauth_publickey_fromfile_ex
 5554   triggered an assertion.  Replaced this with a runtime check that rejects
 5555   obviously invalid key data.
 5556 
 5557 Daniel Stenberg (10 Jun 2010)
 5558 - version: we start working on 1.2.7 now
 5559 
 5560 Version 1.2.6 (10 Jun 2010)
 5561 
 5562 Daniel Stenberg (10 Jun 2010)
 5563 - NEWS: add the 1.2.6 release details
 5564 
 5565 - RELEASE-NOTES: 1.2.6 details added
 5566 
 5567 Guenter Knauf (10 Jun 2010)
 5568 - fixed libssh2.dsw to use the generated libssh2.dsp; removed old *.dsp files.
 5569 
 5570 - moved MSVC strdup define to libssh2_config.h which we include already.
 5571 
 5572 - added missing source files to src/NMakefile.
 5573 
 5574 Daniel Stenberg (8 Jun 2010)
 5575 - libssh2_poll: refer to poll(3) and select(3) instead
 5576 
 5577 - example: fix strdup() for MSVC compiles
 5578   
 5579   MSVC has a _strdup() that we better use. This was reported in bug
 5580 
 5581 - SFTP: fail init SFTP if session isn't authenticated
 5582   
 5583   Alexander Lamaison filed bug #172
 5584   (http://trac.libssh2.org/ticket/172), and pointed out that SFTP
 5585   init would do bad if the session isn't yet authenticated at the
 5586   time of the call, so we now check for this situation and returns
 5587   an error if detected. Calling sftp_init() at this point is bad
 5588   usage to start with.
 5589 
 5590 - direct_tcpip: bring back inclusion of libssh2_config.h
 5591   
 5592   In order to increase portability of this example, I'm bringing
 5593   the inclusion of libssh2_config.h back, and I also added an
 5594   require that header for this example to compile.
 5595   
 5596   I also made all code lines fit within 80 columns.
 5597 
 5598 Guenter Knauf (3 Jun 2010)
 5599 - cast away a warning.
 5600 
 5601 - moved CRT_SECURE_NO_DEPRECATE define up so its defined before the winsock headers are included.
 5602 
 5603 - fixed platform detection for MingW32 test makefile.
 5604 
 5605 - MingW32 has gettimeofday() implemented, so proper ifdef this function here.
 5606 
 5607 - removed MSVC ifdef since seems we can use __int64 still with latest headers.
 5608 
 5609 - changed copyright notice for MinW32 and NetWare binaries.
 5610 
 5611 - cleaned up MSVC ifdefs which where spreaded over 3 places.
 5612 
 5613 - added uint8_t typedef for NetWare CLIB platform.
 5614 
 5615 - if the function declaration gets changed the header should be changed too.
 5616 
 5617 - this is MSVC specific and doesnt apply for all Win32 compilers;
 5618   the uint8_t typedef clashes with MingW32 headers.
 5619 
 5620 - updated MingW32 makefiles for latest dependency lib versions.
 5621 
 5622 - updated NetWare makefiles for latest dependency lib versions.
 5623 
 5624 Dan Fandrich (30 May 2010)
 5625 - Fixed compiling with libgcrypt
 5626   
 5627   A change of parameter types from unsigned long to size_t was
 5628   missed in the prototype in libgcrypt.h
 5629 
 5630 Daniel Stenberg (28 May 2010)
 5631 - statvfs: use libssh2_sftp_statvfs only, no "_ex"
 5632   
 5633   As the long-term goal is to get rid of the extensive set of
 5634   macros from the API we can just as well start small by not adding
 5635   new macros when we add new functions. Therefore we let the
 5636   function be libssh2_sftp_statvfs() plainly without using an _ex
 5637   suffix.
 5638   
 5639   I also made it use size_t instead of unsigned int for the string
 5640   length as that too is a long-term goal for the API.
 5641 
 5642 - [Grubsky Grigory brought this change]
 5643 
 5644   DSP: output lib name typo
 5645 
 5646 - [Grubsky Grigory brought this change]
 5647 
 5648   win32: provide a uint8_t typedef for better building on windows
 5649 
 5650 - agent: win32: fix bad _libssh2_store_str call
 5651   
 5652   As pointed out by Grubsky Grigory <g.grubsky@securitycode.ru>, I
 5653   made a mistake when I added the _libssh2_store_str() call before
 5654   and I made a slightly different patch than what he suggested.
 5655   Based purely on taste.
 5656 
 5657 Peter Stuge (24 May 2010)
 5658 - [Joey Degges brought this change]
 5659 
 5660   Add libssh2_sftp_statvfs() and libssh2_sftp_fstatvfs()
 5661   
 5662   These can be used to get file system statistics from servers that
 5663   support the statvfs@openssh.com and fstatvfs@openssh.com extensions.
 5664 
 5665 Alexander Lamaison (22 May 2010)
 5666 - [Jose Baars brought this change]
 5667 
 5668   VMS specific: make sure final release can be installed over daily build
 5669 
 5670 - [Jose Baars brought this change]
 5671 
 5672   VMS: small improvement to the man2help utilities
 5673 
 5674 Peter Stuge (22 May 2010)
 5675 - [Joey Degges brought this change]
 5676 
 5677   libssh2_exit and libssh2_sftp_readdir man page fixes
 5678 
 5679 Daniel Stenberg (21 May 2010)
 5680 - spelling: s/sue/use
 5681 
 5682 Alexander Lamaison (21 May 2010)
 5683 - Change magic port number for generic knownhost check.
 5684   
 5685   libssh2_knownhost_checkp took 0 as a magic port number that indicated
 5686   a 'generic' check should be performed.  However, 0 is a valid port
 5687   number in its own right so this commit changes the magic value to any
 5688   negative int.
 5689 
 5690 Mikhail Gusarov (5 May 2010)
 5691 - Add re-discovered copyright holders to COPYING
 5692 
 5693 - Restoring copyright statements from pre-git era
 5694   
 5695   Eli Fant has contributed fragmenting SFTP requests
 5696 
 5697 - Restoring my copyright statements from pre-git era
 5698   
 5699   keyboard_interactive, 'exit-status' information packet, non-atomic read/write
 5700   under FreeBSD, multi-channel operation bugfixes.
 5701 
 5702 Daniel Stenberg (3 May 2010)
 5703 - pedantic: make the code C90 clean
 5704 
 5705 Peter Stuge (3 May 2010)
 5706 - Do proper keyboard-interactive user dialog in the sftp.c example
 5707 
 5708 Daniel Stenberg (3 May 2010)
 5709 - added to tarball: libssh2_knownhost_checkp.3
 5710 
 5711 - knownhost: support [host]:port in knownhost file
 5712   
 5713   OpenSSH has ways to add hosts to the knownhosts file that include
 5714   a specific port number which makes the key associated with only
 5715   that specific host+port pair. libssh2 previously did not support
 5716   this, and I was forced to add a new function to the API to
 5717   properly expose this ability to applications:
 5718   libssh2_knownhost_checkp()
 5719   
 5720   To *add* such hosts to the knownhosts file, you make sure to pass
 5721   on the host name in that manner to the libssh2_knownhost_addc()
 5722   function.
 5723 
 5724 - init/exit: mention these were added in 1.2.5
 5725 
 5726 - libssh2_knownhost_check docs: correct the prototype
 5727 
 5728 - examples: avoid use of uninitialized variable 'sock'
 5729 
 5730 - KEX: stop pretending we negotiate language
 5731   
 5732   There was some stub-like parts of an implementation for
 5733   implementing kex language negotiation that caused clang-analyzer
 5734   to warn and as it did nothing I've now removed the dead code.
 5735 
 5736 - Uninitialized argument
 5737 
 5738 - sftpdir: removed dead assignment
 5739 
 5740 - Makefile.am: include the VMS-specific config header as well
 5741 
 5742 - [Jose Baars brought this change]
 5743 
 5744   Add VMS specific libssh2_config.h
 5745 
 5746 - fix Value stored to 's' is never read warning
 5747   
 5748   and moved variable declaration of s to be more local
 5749 
 5750 - kexinit: simplify the code and avoid scan-build warning
 5751   
 5752   Previously it would say "Value stored to 's' is never read" due
 5753   fourth increment of 's'.
 5754 
 5755 Alexander Lamaison (28 Apr 2010)
 5756 - Removed unecessary brackets.
 5757 
 5758 - Changed sftp_attrsize macro to a static function.
 5759 
 5760 Daniel Stenberg (28 Apr 2010)
 5761 - release: include the VMS-specific files
 5762 
 5763 - sftp_attrsize: protect the macro argument with proper parentheses
 5764 
 5765 - ssh2_agent: avoid using 'session' uninitialized on failures
 5766 
 5767 - examples: remove assignments of variable rc that's never used
 5768 
 5769 - publickey_init: remove useless variable increment
 5770 
 5771 - hostkey_method_ssh_rsa_init: remove useless variable increment
 5772 
 5773 - packet_x11_open: removed useless variable increment
 5774   
 5775   and made the declaration of a variable more local
 5776 
 5777 - packet_queue_listener: removed useless variable increment
 5778   
 5779   and made the declaration of a variable more local
 5780 
 5781 - sftp_read: move a read_responses array to where its used
 5782   
 5783   I find that this increases readability since the array is used
 5784   only in the function call just immediately below and nowhere
 5785   else.
 5786 
 5787 - sftp_readdir: turn a small array static const and move it
 5788 
 5789 - sftp_attrsize: converted function to a macro
 5790   
 5791   This way, the macro can evaluate a static number at compile time
 5792   for two out of four uses, and it probably runs faster for the
 5793   other two cases too.
 5794 
 5795 - sftp_open: deal with short channel_write calls
 5796   
 5797   This was an old TODO that just wasn't done before. If
 5798   channel_write returns short, that is not an error.
 5799 
 5800 - sftp_open: clean up, better check of input data
 5801   
 5802   The clang-analyzer report made it look into this function and
 5803   I've went through it to remove a potential use of an
 5804   uninitialized variable and I also added some validation of input
 5805   data received from the server.
 5806   
 5807   In general, lots of more code in this file need to validate the
 5808   input before assuming it is correct: there are servers out there
 5809   that have bugs or just have another idea of how to do the SFTP
 5810   protocol.
 5811 
 5812 - bugfix: avoid using the socket if it failed to create one
 5813 
 5814 - bugfix: potential use of NULL pointer
 5815 
 5816 - libssh2_userauth_password_ex: clarify errors somewhat
 5817   
 5818   The errors mentioned in this man page are possible return codes
 5819   but not necessarily the only return codes that this can return.
 5820   
 5821   Also reformatted the typ prototypes somewhat.
 5822 
 5823 - examples: fixed and made them more similar
 5824   
 5825   The channel read/write functions can return 0 in legitimate cases
 5826   without it being an error, and we need to loop properly if they
 5827   return short.
 5828 
 5829 - [Jose Baars brought this change]
 5830 
 5831   VMS port of libssh2; changes in the libssh2 common code
 5832 
 5833 - Makefile: added the two news headers userauth.h and session.h
 5834 
 5835 - cleanup: prefer the internal functions
 5836   
 5837   To get the blocking vs non-blocking to work as smooth as possible
 5838   and behave better internally, we avoid using the external
 5839   interfaces when calling functions internally.
 5840   
 5841   Renamed a few internal functions to use _libssh2 prefix when not
 5842   being private within a file, and removed the libssh2_ for one
 5843   that was private within the file.
 5844 
 5845 - session_free: remove dead code
 5846 
 5847 - libssh2_publickey_init: fixed to work better non-blocking
 5848   
 5849   This was triggered by a clang-analyzer complaint that turned out
 5850   to be valid, and it made me dig deeper and fix some generic non-
 5851   blocking problems I disovered in the code.
 5852   
 5853   While cleaning this up, I moved session-specific stuff over to a
 5854   new session.h header from the libssh2_priv.h header.
 5855 
 5856 - channel: reduce duplicated free and returns
 5857   
 5858   Simplified the code by trying to free data and return on a single
 5859   spot.
 5860 
 5861 - channel: make variables more local
 5862   
 5863   By making 'data' and 'data_len' more local in several places in
 5864   this file it will be easier to spot how they are used and we'll
 5865   get less risks to accidentally do bad things with them.
 5866 
 5867 Mikhail Gusarov (24 Apr 2010)
 5868 - Fix typos in manpages, catched by Lintian
 5869 
 5870 Daniel Stenberg (24 Apr 2010)
 5871 - channel_request_pty: simplify the code
 5872   
 5873   clang-analyzer pointed out how 'data' could be accessed as a NULL
 5874   pointer if the wrong state was set, and while I don't see that
 5875   happen in real-life the code flow is easier to read and follow by
 5876   moving the LIBSSH2_FREE() call into the block that is supposed to
 5877   deal with the data pointer anyway.
 5878 
 5879 - libssh2_channel_process_startup: simplify the code
 5880   
 5881   clang-analyzer pointed out how 'data' could be accessed as a NULL
 5882   pointer if the wrong state was set, and while I don't see that
 5883   happen in real-life the code flow is easier to read and follow by
 5884   moving the LIBSSH2_FREE() call into the block that is supposed to
 5885   deal with the data pointer anyway.
 5886 
 5887 - sftp_close_handle: add precation to not access NULL pointer
 5888   
 5889   clang-analyzer pointed this out as a "Pass-by-value argument in
 5890   function call is undefined" but while I can't see exactly how
 5891   this can ever happen in reality I think a little check for safety
 5892   isn't such a bad thing here.
 5893 
 5894 - scp_write_nonblock: Value stored to 'nread' is never read
 5895 
 5896 - scp_write: Value stored to 'ptr' is never read
 5897 
 5898 - scp_write_nonblock: Value stored to 'ptr' is never read
 5899 
 5900 - sftp_mkdir: less silly output but show failures
 5901 
 5902 - [Jose Baars brought this change]
 5903 
 5904   VMS port of libssh2 including VMS specific build procedures
 5905 
 5906 - two variable types changes, made lines less than 80 columns
 5907   
 5908   The two variable type changes are only to match type variable
 5909   fields actually read from the binary protocol.
 5910 
 5911 - remove check for negative padding_length
 5912   
 5913   It was silly, since it is read as an unsigned char...
 5914 
 5915 - hostkey_method_ssh_dss_init: Value stored to 's' is never read
 5916 
 5917 - libssh2_banner_set: avoid unnecessary increment and explain code
 5918 
 5919 - agent_transact_unix: remove unused variable
 5920 
 5921 - remove two unnecessary increments
 5922 
 5923 - more code converted to use _libssh2_store_*()
 5924 
 5925 - libssh2_publickey_list_fetch: removed unused variables
 5926 
 5927 - libssh2_publickey_init: remove unused variables
 5928 
 5929 - libssh2_scp_send64: added to API to provide large file transfers
 5930   
 5931   The previously existing libssh2_scp_send_ex() function has no way
 5932   to send files that are larger than 'size_t' which on 32bit
 5933   systems mean 4GB. This new API uses a libssh2_int64_t type and
 5934   should thus on most modern systems be able to send enormous
 5935   files.
 5936 
 5937 - sftp_init: remove unused variables and assignments
 5938 
 5939 - libssh2_knownhost_check: Value stored to 'keylen' is never read
 5940 
 5941 - hostkey: fix compiler warning