aboutsummaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2017-12-20curl_easy_reset: release mime-related data.Patrick Monnerat
Move curl_mime_initpart() and curl_mime_cleanpart() calls to lower-level functions dealing with UserDefined structure contents. This avoids memory leakages on curl-generated part mime headers. New test 2073 checks this using the cli tool --next option: it triggers a valgrind error if bug is present. Bug: https://curl.haxx.se/mail/lib-2017-12/0060.html Reported-by: Martin Galvan
2017-12-20content_encoding: rework zlib_inflatePatrick Monnerat
- When zlib version is < 1.2.0.4, process gzip trailer before considering extra data as an error. - Inflate with Z_BLOCK instead of Z_SYNC_FLUSH to maximize correct data and minimize corrupt data output. - Do not try to restart deflate decompression in raw mode if output has started or if the leading data is not available anymore. - New test 232 checks inflating raw-deflated content. Closes #2068
2017-12-20brotli: allow compiling with version 0.6.0.Patrick Monnerat
Some error codes were not yet defined in brotli 0.6.0: do not issue code for them in this case.
2017-12-13rand: add a clang-analyzer work-aroundDaniel Stenberg
scan-build would warn on a potential access of an uninitialized buffer. I deem it a false positive and had to add this somewhat ugly work-around to silence it.
2017-12-13krb5: fix a potential access of uninitialized memoryDaniel Stenberg
A scan-build warning.
2017-12-12conncache: fix a return code [regression]Daniel Stenberg
This broke in 07cb27c98e. Make sure to return 'result' properly. Pointed out by scan-build!
2017-12-12setopt: less *or equal* than INT_MAX/1000 should be fineDaniel Stenberg
... for the CURLOPT_TIMEOUT, CURLOPT_CONNECTTIMEOUT and CURLOPT_SERVER_RESPONSE_TIMEOUT range checks. Reported-by: Dominik Hölzl Bug: https://curl.haxx.se/mail/lib-2017-12/0037.html Closes #2173
2017-12-12vtls: replaced getenv() with curl_getenv()dmitrykos
Fixed undefined symbol of getenv() which does not exist when compiling for Windows 10 App (CURL_WINDOWS_APP). Replaced getenv() with curl_getenv() which is aware of getenv() absence when CURL_WINDOWS_APP is defined. Closes #2171
2017-12-10multi_done: prune DNS cacheDaniel Stenberg
Prune the DNS cache immediately after the dns entry is unlocked in multi_done. Timed out entries will then get discarded in a more orderly fashion. Test506 is updated Reported-by: Oleg Pudeyev Fixes #2169 Closes #2170
2017-12-10openssl: Disable file buffering for Win32 SSLKEYLOGFILEJay Satiro
Prior to this change SSLKEYLOGFILE used line buffering on WIN32 just like it does for other platforms. However, the Windows CRT does not actually support line buffering (_IOLBF) and will use full buffering (_IOFBF) instead. We can't use full buffering because multiple processes may be writing to the file and that could lead to corruption, and since full buffering is the only buffering available this commit disables buffering for Windows SSLKEYLOGFILE entirely (_IONBF). Ref: https://github.com/curl/curl/pull/1346#issuecomment-350530901
2017-12-10RESOLVE: output verbose text when trying to set a duplicate nameDaniel Stenberg
... to help users understand what is or isn't done!
2017-12-09sftp: allow quoted commands to use relative pathsJohn DeHelian
Closes #1900
2017-12-08curl: remove __EMX__ #ifdefsDaniel Stenberg
These are OS/2-specific things added to the code in the year 2000. They were always ugly. If there's any user left, they still don't need it done this way. Closes #2166
2017-12-08openssl: improve data-pending check for https proxyJay Satiro
- Allow proxy_ssl to be checked for pending data even when connssl does not yet have an SSL handle. This change is for posterity. Currently there doesn't seem to be a code path that will cause a pending data check when proxyssl could have pending data and the connssl handle doesn't yet exist [1]. [1]: Recall that an https proxy connection starts out in connssl but if the destination is also https then the proxy SSL backend data is moved from connssl to proxyssl, which means connssl handle is temporarily empty until an SSL handle for the destination can be created. Ref: https://github.com/curl/curl/commit/f4a6238#commitcomment-24396542 Closes https://github.com/curl/curl/pull/1916
2017-12-07CONNECT: keep close connection flag in http_connect_state structZachary Seguin
Fixes #2088 Closes #2157
2017-12-07include: get netinet/in.h before linux/tcp.hPer Malmberg
... to allow build on older Linux dists (specifically CentOS 4.8 on gcc 4.8.5) Closes #2160
2017-12-06openldap: fix checksrc nitsDaniel Stenberg
2017-12-06openldap: add commented out debug possibilitiesStepan Broz
... to aid debugging openldap library using its built-in debug messages. Closes #2159
2017-12-06URL: tolerate backslash after drive letter for FILE:Jan-E
... as in "file://c:\some\path\curl.out" Reviewed-by: Matthew Kerwin Closes #2154
2017-12-06configure: check for netinet/in6.hRandall S. Becker
Needed by HPE NonStop NSE and NSX systems Fixes #2146 Closes #2155
2017-12-05conncache: only allow multiplexing within same multi handleDaniel Stenberg
Connections that are used for HTTP/1.1 Pipelining or HTTP/2 multiplexing only get additional transfers added to them if the existing connection is held by the same multi or easy handle. libcurl does not support doing HTTP/2 streams in different threads using a shared connection. Closes #2152
2017-12-05conncache: fix several lock issuesDaniel Stenberg
If the lock is released before the dealings with the bundle is over, it may have changed by another thread in the mean time. Fixes #2132 Fixes #2151 Closes #2139
2017-12-05libssh: remove dead code in sftp_qouteDaniel Stenberg
... by removing a superfluous NULL pointer check that also confuses Coverity. Fixes #2143 Closes #2153
2017-12-05sasl_getmesssage: make sure we have a long enough string to passDaniel Stenberg
For pop3/imap/smtp, added test 891 to somewhat verify the pop3 case. For this, I enhanced the pingpong test server to be able to send back responses with LF-only instead of always using CRLF. Closes #2150
2017-12-04libssh2: remove dead code from SSH_SFTP_QUOTEDaniel Stenberg
Figured out while reviewing code in the libssh backend. The pointer was checked for NULL after having been dereferenced, so we know it would always equal true or it would've crashed. Pointed-out-by: Nikos Mavrogiannopoulos Bug #2143 Closes #2148
2017-12-04ssh-libssh.c: please checksrcDaniel Stenberg
2017-12-04libssh: fixed dereference in statvfs accessNikos Mavrogiannopoulos
The behavior is now equivalent to ssh.c when SSH_SFTP_QUOTE_STATVFS handling fails. Fixes #2142
2017-12-03libssh: corrected use of sftp_statvfs() in SSH_SFTP_QUOTE_STATVFSNikos Mavrogiannopoulos
The previous code was incorrectly following the libssh2 error detection for libssh2_sftp_statvfs, which is not correct for libssh's sftp_statvfs. Fixes #2142 Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-12-03libssh: no need to call sftp_get_error as ssh_get_error is sufficientNikos Mavrogiannopoulos
Fixes #2141 Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-12-02libssh: fix minor static code analyzer nitsDaniel Stenberg
- remove superfluous NULL check which otherwise tricks the static code analyzers to assume NULL pointer dereferences. - fix fallthrough in switch() - indent mistake
2017-12-02openssl: pkcs12 is supported by boringsslDaniel Stenberg
Removes another #ifdef for BoringSSL Pointed-out-by: David Benjamin Closes #2134
2017-12-01libssh: added SFTP supportNikos Mavrogiannopoulos
The SFTP back-end supports asynchronous reading only, limited to 32-bit file length. Writing is synchronous with no other limitations. This also brings keyboard-interactive authentication. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-12-01libssh2: return CURLE_UPLOAD_FAILED on failure to uploadNikos Mavrogiannopoulos
This brings its in sync with the error code returned by the libssh backend. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-12-01libssh2: send the correct CURLE error code on scp file not foundNikos Mavrogiannopoulos
That also updates tests to expect the right error code libssh2 back-end returns CURLE_SSH error if the remote file is not found. Expect instead CURLE_REMOTE_FILE_NOT_FOUND which is sent by the libssh backend. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
2017-12-01Added support for libssh SSH SCP back-endNikos Mavrogiannopoulos
libssh is an alternative library to libssh2. https://www.libssh.org/ That patch set also introduces support for ECDSA ed25519 keys, as well as gssapi authentication. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
2017-12-01lib: don't export all symbols, just everything curl_*W. Mark Kubacki
Absent any 'symbol map' or script to limit what gets exported, static linking of libraries previously resulted in a libcurl with curl's and those other symbols being (re-)exported. This did not happen if 'versioned symbols' were enabled (which is not the default) because then a version script is employed. This limits exports to everything starting in 'curl_*'., which is what "libcurl.vers" exports. This avoids strange side-effects such as with mixing methods from system libraries and those erroneously offered by libcurl. Closes #2127
2017-12-01SSL: Avoid magic allocation of SSL backend specific dataJohannes Schindelin
Originally, my idea was to allocate the two structures (or more precisely, the connectdata structure and the four SSL backend-specific strucutres required for ssl[0..1] and proxy_ssl[0..1]) in one go, so that they all could be free()d together. However, getting the alignment right is tricky. Too tricky. So let's just bite the bullet and allocate the SSL backend-specific data separately. As a consequence, we now have to be very careful to release the memory allocated for the SSL backend-specific data whenever we release any connectdata. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Closes #2119
2017-11-27openssl: fix boringssl build againDaniel Stenberg
commit d3ab7c5a21e broke the boringssl build since it doesn't have RSA_flags(), so we disable that code block for boringssl builds. Reported-by: W. Mark Kubacki Fixes #2117
2017-11-27curl_ntlm_core.c: use the limits.h's SIZE_T_MAX if providedDaniel Stenberg
2017-11-27global_init: ignore CURL_GLOBAL_SSL's absenseDaniel Stenberg
This bit is no longer used. It is not clear what it meant for users to "init the TLS" in a world with different TLS backends and since the introduction of multissl, libcurl didn't properly work if inited without this bit set. Not a single user responded to the call for users of it: https://curl.haxx.se/mail/lib-2017-11/0072.html Reported-by: Evgeny Grin Assisted-by: Jay Satiro Fixes #2089 Fixes #2083 Closes #2107
2017-11-27ntlm: avoid integer overflow for malloc sizeDaniel Stenberg
Reported-by: Alex Nichols Assisted-by: Kamil Dudka and Max Dymond CVE-2017-8816 Bug: https://curl.haxx.se/docs/adv_2017-11e7.html
2017-11-27wildcardmatch: fix heap buffer overflow in setcharsetDaniel Stenberg
The code would previous read beyond the end of the pattern string if the match pattern ends with an open bracket when the default pattern matching function is used. Detected by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4161 CVE-2017-8817 Bug: https://curl.haxx.se/docs/adv_2017-ae72.html
2017-11-27url: fix alignment of ssl_backend_data structJay Satiro
- Align the array of ssl_backend_data on a max 32 byte boundary. 8 is likely to be ok but I went with 32 for posterity should one of the ssl_backend_data structs change to contain a larger sized variable in the future. Prior to this change (since dev 70f1db3, release 7.56) the connectdata structure was undersized by 4 bytes in 32-bit builds with ssl enabled because long long * was mistakenly used for alignment instead of long long, with the intention being an 8 byte boundary. Also long long may not be an available type. The undersized connectdata could lead to oob read/write past the end in what was expected to be the last 4 bytes of the connection's secondary socket https proxy ssl_backend_data struct (the secondary socket in a connection is used by ftp, others?). Closes https://github.com/curl/curl/issues/2093 CVE-2017-8818 Bug: https://curl.haxx.se/docs/adv_2017-af0a.html
2017-11-25ssh: remove check for a NULL pointer (!)Daniel Stenberg
With this check present, scan-build warns that we might dereference this point in other places where it isn't first checked for NULL. Thus, if it *can* be NULL we have a problem on a few places. However, this pointer should not be possible to be NULL here so I remove the check and thus also three different scan-build warnings. Closes #2111
2017-11-24URL: update "file:" URL handlingMatthew Kerwin
* LOTS of comment updates * explicit error for SMB shares (e.g. "file:////share/path/file") * more strict handling of authority (i.e. "//localhost/") * now accepts dodgy old "C:|" drive letters * more precise handling of drive letters in and out of Windows (especially recognising both "file:c:/" and "file:/c:/") Closes #2110
2017-11-24connect: add support for new TCP Fast Open API on LinuxAlessandro Ghedini
The new API added in Linux 4.11 only requires setting a socket option before connecting, without the whole sento() machinery. Notably, this makes it possible to use TFO with SSL connections on Linux as well, without the need to mess around with OpenSSL (or whatever other SSL library) internals. Closes #2056
2017-11-23connect: improve the bind error messageJay Satiro
eg consider a non-existent interface eth8, curl --interface eth8 Before: curl: (45) Could not resolve host: eth8 After: curl: (45) Couldn't bind to 'eth8' Bug: https://github.com/curl/curl/issues/2104 Reported-by: Alfonso Martone
2017-11-22url: reject ASCII control characters and space in host namesDaniel Stenberg
Host names like "127.0.0.1 moo" would otherwise be accepted by some getaddrinfo() implementations. Updated test 1034 and 1035 accordingly. Fixes #2073 Closes #2092
2017-11-21Curl_open: fix OOM return error correctlyDaniel Stenberg
Closes #2098
2017-11-21http2: fix "Value stored to 'end' is never read" scan-build errorDaniel Stenberg