summaryrefslogtreecommitdiff
path: root/lib/vssh/libssh.c
Commit message (Collapse)AuthorAgeFilesLines
* libssh: tell it to use SFTP non-blockingDaniel Stenberg2023-04-271-1/+1
| | | | | | Reported-by: Andreas Huebner Fixes #11020 Closes #11039
* lib: unify the upload/method handlingDaniel Stenberg2023-04-251-3/+3
| | | | | | | | By making sure we set state.upload based on the set.method value and not independently as set.upload, we reduce confusion and mixup risks, both internally and externally. Closes #11017
* libssh: use dynbuf instead of reallocDaniel Stenberg2023-03-161-37/+17
| | | | | | When building lines to show for SFTP directory listings. Closes #10778
* copyright: update all copyright lines and remove year rangesDaniel Stenberg2023-01-031-1/+1
| | | | | | | | | | | | - they are mostly pointless in all major jurisdictions - many big corporations and projects already don't use them - saves us from pointless churn - git keeps history for us - the year range is kept in COPYING checksrc is updated to allow non-year using copyright statements Closes #10205
* netware: remove leftover tracesDaniel Gustafsson2022-11-231-5/+0
| | | | | | | | | Commit 3b16575ae938dec2a29454631a12aa52b6ab9c67 removed support for building on Novell Netware, but a few leftover traces remained. This removes the last bits. Closes: #9966 Reviewed-by: Daniel Stenberg <daniel@haxx.se>
* vtls: localization of state data in filtersStefan Eissing2022-11-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - almost all backend calls pass the Curl_cfilter intance instead of connectdata+sockindex - ssl_connect_data is remove from struct connectdata and made internal to vtls - ssl_connect_data is allocated in the added filter, kept at cf->ctx - added function to let a ssl filter access its ssl_primary_config and ssl_config_data this selects the propert subfields in conn and data, for filters added as plain or proxy - adjusted all backends to use the changed api - adjusted all backends to access config data via the exposed functions, no longer using conn or data directly cfilter renames for clear purpose: - methods `Curl_conn_*(data, conn, sockindex)` work on the complete filter chain at `sockindex` and connection `conn`. - methods `Curl_cf_*(cf, ...)` work on a specific Curl_cfilter instance. - methods `Curl_conn_cf()` work on/with filter instances at a connection. - rebased and resolved some naming conflicts - hostname validation (und session lookup) on SECONDARY use the same name as on FIRST (again). new debug macros and removing connectdata from function signatures where not needed. adapting schannel for new Curl_read_plain paramter. Closes #9919
* lib: parse numbers with fixed known base 10Daniel Stenberg2022-11-171-2/+2
| | | | | | | ... instead of using 0 argument that allows decimal, hex or octal when the number is documented and assumed to use base 10. Closes #9933
* lib: remove bad set.opt_no_body assignmentsDaniel Stenberg2022-11-111-1/+1
| | | | | | | | | | This struct field MUST remain what the application set it to, so that handle reuse and handle duplication work. Instead, the request state bit 'no_body' is introduced for code flows that need to change this in run-time. Closes #9888
* lib: connection filters (cfilter) addition to curl:Stefan Eissing2022-11-111-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - general construct/destroy in connectdata - default implementations of callback functions - connect: cfilters for connect and accept - socks: cfilter for socks proxying - http_proxy: cfilter for http proxy tunneling - vtls: cfilters for primary and proxy ssl - change in general handling of data/conn - Curl_cfilter_setup() sets up filter chain based on data settings, if none are installed by the protocol handler setup - Curl_cfilter_connect() boot straps filters into `connected` status, used by handlers and multi to reach further stages - Curl_cfilter_is_connected() to check if a conn is connected, e.g. all filters have done their work - Curl_cfilter_get_select_socks() gets the sockets and READ/WRITE indicators for multi select to work - Curl_cfilter_data_pending() asks filters if the have incoming data pending for recv - Curl_cfilter_recv()/Curl_cfilter_send are the general callbacks installed in conn->recv/conn->send for io handling - Curl_cfilter_attach_data()/Curl_cfilter_detach_data() inform filters and addition/removal of a `data` from their connection - adding vtl functions to prevent use of Curl_ssl globals directly in other parts of the code. Reviewed-by: Daniel Stenberg Closes #9855
* libssh: if sftp_init fails, don't get the sftp error codeDaniel Stenberg2022-10-161-2/+1
| | | | | | | | | | This flow extracted the wrong code (sftp code instead of ssh code), and the code is sometimes (erroneously) returned as zero anyway, so skip getting it and set a generic error. Reported-by: David McLaughlin Fixes #9737 Closes #9740
* misc: ISSPACE() => ISBLANK()Daniel Stenberg2022-09-061-1/+1
| | | | | | | | | | | Instances of ISSPACE() use that should rather use ISBLANK(). I think somewhat carelessly used because it sounds as if it checks for space or whitespace, but also includes %0a to %0d. For parsing purposes, we should only accept what we must and not be overly liberal. It leads to surprises and surprises lead to bad things. Closes #9432
* libssh: ignore deprecation warningsDaniel Stenberg2022-08-291-0/+7
| | | | | | | | | | | | libssh 0.10.0 marks all SCP functions as "deprecated" which causes compiler warnings and errors in our CI jobs and elsewhere. Ignore deprecation warnings if 0.10.0 or later is found in the build. If they actually remove the functions at a later point, then someone can deal with that pain and functionality break then. Fixes #9382 Closes #9383
* libssh: make atime/mtime date overflow return errorDaniel Stenberg2022-08-181-28/+15
| | | | Closes #9328
* libssh: setting atime or mtime > 32bit is now just skippedDaniel Stenberg2022-08-161-4/+18
| | | | | | | | | The libssh API used caps the time to an unsigned 32bit variable. Avoid nasty surprises by instead not setting such time. Spotted by Coverity. Closes #9324
* libssh: skip the fake-close when libssh does the right thingDaniel Stenberg2022-06-151-5/+8
| | | | | | | | | | Starting in libssh 0.10.0 ssh_disconnect() will no longer close our socket. Instead it will be kept alive as we want it, and it is our responsibility to close it later. Ref: #8718 Ref: https://gitlab.com/libssh/libssh-mirror/-/merge_requests/240 Closes #9021
* copyright: make repository REUSE compliantmax.mehl2022-06-131-0/+2
| | | | | | | | | | | Add licensing and copyright information for all files in this repository. This either happens in the file itself as a comment header or in the file `.reuse/dep5`. This commit also adds a Github workflow to check pull requests and adapts copyright.pl to the changes. Closes #8869
* libssh: fix double closeJay Dommaschk2022-04-201-0/+4
| | | | | | | | libssh closes the socket in ssh_diconnect() so make sure that libcurl does not also close it. Fixes #8708 Closes #8718
* lib: remove exclamation marksDaniel Stenberg2022-04-161-1/+1
| | | | | | ... from infof() and failf() calls. Make them less attention seeking. Closes #8713
* libssh: unstick SFTP transfers when done event-basedDaniel Stenberg2022-03-211-0/+3
| | | | | | Test 604 and 606 (at least). Closes #8490
* libssh: Improve fix for missing SSH_S_ stat macrosJay Satiro2022-03-141-2/+3
| | | | | | | | | | | | | | | | | - If building libcurl against an old libssh version missing SSH_S_IFMT and SSH_S_IFLNK then use the values from a supported version. Prior to this change if libssh did not define SSH_S_IFMT and SSH_S_IFLNK then S_IFMT and S_IFLNK, respectively, were used instead. The problem with that is the user's S_ stat macros don't have the same values across platforms. For example Windows has values different from Linux. Follow-up to 7b0fd39. Ref: https://github.com/curl/curl/pull/8511#discussion_r815292391 Ref: https://github.com/curl/curl/pull/8574 Closes https://github.com/curl/curl/pull/8588
* libssh: fix build with old libssh versionsDaniel Stenberg2022-03-101-0/+7
| | | | | | | ... that don't have the SSH_S_* defines. Spotted on a machine using libssh 0.7.3 Closes #8574
* libssh: fix include files and defines use for Windows buildsDaniel Stenberg2022-02-261-10/+10
| | | | | | Reported-by: 梦终无痕 Bug: https://curl.se/mail/lib-2022-02/0131.html Closes #8511
* strerror.h: remove the #include from files not using itDaniel Stenberg2021-09-091-1/+0
|
* infof: remove newline from format strings, always append itDaniel Stenberg2021-07-071-30/+30
| | | | | | | | | | | | | | | | - the data needs to be "line-based" anyway since it's also passed to the debug callback/application - it makes infof() work like failf() and consistency is good - there's an assert that triggers on newlines in the format string - Also removes a few instances of "..." - Removes the code that would append "..." to the end of the data *iff* it was truncated in infof() Closes #7357
* version: turn version number functions into returning voidDaniel Stenberg2021-06-301-2/+2
| | | | | | | ... as we never use the return codes from them. Reviewed-by: Daniel Gustafsson Closes #7319
* conn: add 'attach' to protocol handler, make libssh2 use itDaniel Stenberg2021-05-171-0/+2
| | | | | | | | | | | The libssh2 backend has SSH session associated with the connection but the callback context is the easy handle, so when a connection gets attached to a transfer, the protocol handler now allows for a custom function to get used to set things up correctly. Reported-by: Michael O'Farrell Fixes #6898 Closes #7078
* tidy-up: make conditional checks more consistentDaniel Stenberg2021-04-221-21/+21
| | | | | | ... remove '== NULL' and '!= 0' Closes #6912
* libssh: fix "empty expression statement has no effect" warningsDaniel Stenberg2021-04-191-39/+63
| | | | | | | | | | ... by fixing macros to do-while constructs and moving out the calls to "break" outside of the actual macro. It also fixes the problem where the macro was used witin a loop and the break didn't do right. Reported-by: Emil Engler Fixes #6847 Closes #6909
* libssh: get rid of PATH_MAXEmil Engler2021-04-051-4/+3
| | | | | | | | This removes the last occurrence of PATH_MAX inside our libssh implementation by calculating the path length from the string length of the two components. Closes #6829
* ftp: add 'list_only' to the transfer state structDaniel Stenberg2021-02-091-1/+1
| | | | | | | | | and rename it from 'ftp_list_only' since it is also used for SSH and POP3. The state is updated internally for 'type=D' FTP URLs. Added test case 1570 to verify. Closes #6578
* ftp: never set data->set.ftp_append outside setoptDaniel Stenberg2021-02-081-1/+1
| | | | | | | | | | Since the set value then risks getting used like that when the easy handle is reused by the application. Also: renamed the struct field from 'ftp_append' to 'remote_append' since it is also used for SSH protocols. Closes #6579
* curl_path: remove conn->data useDaniel Stenberg2021-01-191-4/+2
| | | | Closes #6487
* lib: more conn->data cleanupsDaniel Stenberg2021-01-191-142/+143
| | | | Closes #6479
* libssh: avoid plain free() of libssh-memoryDaniel Stenberg2021-01-181-2/+2
| | | | | | | | | | | | | | | Since curl's own memory debugging system redefines free() calls to track and fiddle with memory, it cannot be used on memory allocated by 3rd party libraries. Third party libraries SHOULD NOT require free() to release allocated resources for this reason - and libs can use separate healp allocators on some systems (like Windows) so free() doesn't necessarily work anyway. Filed as an issue with libssh: https://bugs.libssh.org/T268 Closes #6481
* lib: pass in 'struct Curl_easy *' to most functionsDaniel Stenberg2021-01-171-97/+105
| | | | | | | | | | | | | | | | | | | | | ... in most cases instead of 'struct connectdata *' but in some cases in addition to. - We mostly operate on transfers and not connections. - We need the transfer handle to log, store data and more. Everything in libcurl is driven by a transfer (the CURL * in the public API). - This work clarifies and separates the transfers from the connections better. - We should avoid "conn->data". Since individual connections can be used by many transfers when multiplexing, making sure that conn->data points to the current and correct transfer at all times is difficult and has been notoriously error-prone over the years. The goal is to ultimately remove the conn->data pointer for this reason. Closes #6425
* language: s/behaviour/behavior/gEmil Engler2021-01-021-2/+2
| | | | | | | | We currently use both spellings the british "behaviour" and the american "behavior". However "behavior" is more used in the project so I think it's worth dropping the british name. Closes #6395
* urldata: remove 'void *protop' and create the union 'p'Daniel Stenberg2020-11-231-5/+5
| | | | | | | ... to avoid the use of 'void *' for the protocol specific structs done per transfer. Closes #6238
* curl.se: new homeDaniel Stenberg2020-11-041-1/+1
| | | | Closes #6172
* sendf: move the verbose-check into Curl_debugDaniel Stenberg2020-11-021-14/+7
| | | | | | Saves us from having the same check done everywhere. Closes #6159
* Curl_handler: add 'family' to each protocolDaniel Stenberg2020-09-211-0/+2
| | | | | | | Makes get_protocol_family() faster and it moves the knowledge about the "families" to each protocol handler, where it belongs. Closes #5986
* sftp: add new quote commands 'atime' and 'mtime'COFFEETALES2020-08-241-2/+32
| | | | Closes #5810
* libssh: avoid options override by configuration filesAnderson Toshiyuki Sasaki2020-04-251-14/+47
| | | | | | | | | | | | | | | Previously, options set explicitly through command line options could be overridden by the configuration files parsed automatically when ssh_connect() was called. By calling ssh_options_parse_config() explicitly, the configuration files are parsed before setting the options, avoiding the options override. Once the configuration files are parsed, the automatic configuration parsing is not executed. Fixes #4972 Closes #5283 Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
* libssh: Use new ECDSA key types to check known hostsAnderson Toshiyuki Sasaki2020-04-171-0/+8
| | | | | | | | | From libssh 0.9.0, ssh_key_type() returns different key types for ECDSA keys depending on the curve. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Fixes #5252 Closes #5253
* libssh: Fix matching user-specified MD5 hex keyJay Satiro2020-03-071-3/+17
| | | | | | | | | | | Prior to this change a match would never be successful because it was mistakenly coded to compare binary data from libssh to a user-specified hex string (ie CURLOPT_SSH_HOST_PUBLIC_KEY_MD5). Reported-by: fds242@users.noreply.github.com Fixes https://github.com/curl/curl/issues/4971 Closes https://github.com/curl/curl/pull/4974
* libssh: improve known hosts handlingAnderson Toshiyuki Sasaki2020-02-271-6/+92
| | | | | | | | | | | | | | | | Previously, it was not possible to get a known hosts file entry due to the lack of an API. ssh_session_get_known_hosts_entry(), introduced in libssh-0.9.0, allows libcurl to obtain such information and behave the same as when compiled with libssh2. This also tries to avoid the usage of deprecated functions when the replacements are available. The behaviour will not change if versions older than libssh-0.8.0 are used. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Fixes #4953 Closes #4962
* cleanup: comment typosDaniel Stenberg2020-02-211-2/+1
| | | | | | Spotted by 'codespell' Closes #4957
* lib: remove ASSIGNWITHINCONDITION exceptions, use our code styleDaniel Stenberg2019-12-171-3/+7
| | | | | | | | | | ... even for macros Reviewed-by: Daniel Gustafsson Reviewed-by: Jay Satiro Reported-by: Jay Satiro Fixes #4683 Closes #4722
* Revert "checksrc: fix regexp for ASSIGNWITHINCONDITION"Daniel Stenberg2019-12-161-0/+1
| | | | | | This reverts commit ba82673dac3e8d00a76aa5e3779a0cb80e7442af. Bug: #4683
* build: Disable Visual Studio warning "conditional expression is constant"Jay Satiro2019-12-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Disable warning C4127 "conditional expression is constant" globally in curl_setup.h for when building with Microsoft's compiler. This mainly affects building with the Visual Studio project files found in the projects dir. Prior to this change the cmake and winbuild build systems already disabled 4127 globally for when building with Microsoft's compiler. Also, 4127 was already disabled for all build systems in the limited circumstance of the WHILE_FALSE macro which disabled the warning specifically for while(0). This commit removes the WHILE_FALSE macro and all other cruft in favor of disabling globally in curl_setup. Background: We have various macros that cause 0 or 1 to be evaluated, which would cause warning C4127 in Visual Studio. For example this causes it: #define Curl_resolver_asynch() 1 Full behavior is not clearly defined and inconsistent across versions. However it is documented that since VS 2015 Update 3 Microsoft has addressed this somewhat but not entirely, not warning on while(true) for example. Prior to this change some C4127 warnings occurred when I built with Visual Studio using the generated projects in the projects dir. Closes https://github.com/curl/curl/pull/4658
* curl_setup_once: consistently use WHILE_FALSE in macrosDaniel Gustafsson2019-11-281-1/+1
| | | | | | | | | The WHILE_FALSE construction is used to avoid compiler warnings in macro constructions. This fixes a few instances where it was not used in order to keep the code consistent. Closes #4649 Reviewed-by: Daniel Stenberg <daniel@haxx.se>