1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00
Commit Graph

9796 Commits

Author SHA1 Message Date
Kamil Dudka
1605d93a7b nss: use PK11_CreateManagedGenericObject() if available
... so that the memory allocated by applications using libcurl does not
grow per each TLS connection.

Bug: https://bugzilla.redhat.com/1510247

Closes #2297
2018-02-15 10:18:34 +01:00
Björn Stenberg
b46cfbc068
TODO fixed: Detect when called from within callbacks
Closes #2302
2018-02-15 09:36:03 +01:00
Daniel Stenberg
40e22e5c0b
curl_gssapi: make sure this file too uses our *printf() 2018-02-13 22:55:29 +01:00
Patrick Monnerat
62cf2d180e smtp: fix processing of initial dot in data
RFC 5321 4.1.1.4 specifies the CRLF terminating the DATA command
should be taken into account when chasing the <CRLF>.<CRLF> end marker.
Thus a leading dot character in data is also subject to escaping.

Tests 911 and test server are adapted to this situation.
New tests 951 and 952 check proper handling of initial dot in data.

Closes #2304
2018-02-12 16:43:15 +01:00
Daniel Stenberg
3f6051f4ed
sha256: avoid redefine 2018-02-12 14:18:30 +01:00
Douglas Mencken
50c0033a6c
sha256: build with OpenSSL < 0.9.8 too
support for SHA-2 was introduced in OpenSSL 0.9.8

Closes #2305
2018-02-12 14:16:37 +01:00
Patrick Monnerat
155ea88184 http_chunks: don't write chunks twice with CURLOPT_HTTP_TRANSFER_DECODING on
Bug: #2303
Reported-By: Henry Roeland
2018-02-12 03:47:36 +01:00
Daniel Stenberg
23722c515f
get_posix_time: only check for overflows if they can happen! 2018-02-09 22:13:41 +01:00
Michael Kaufmann
1c680e35ab schannel: fix "no previous prototype" compiler warning 2018-02-09 20:10:25 +01:00
Mohammad AlSaleh
f886cbfe9c content_encoding: Add "none" alias to "identity"
Some servers return a "content-encoding" header with a non-standard
"none" value.

Add "none" as an alias to "identity" as a work-around, to avoid
unrecognised content encoding type errors.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>

Closes https://github.com/curl/curl/pull/2298
2018-02-09 03:11:18 -05:00
Michael Kaufmann
a64b002e3a schannel: fix compiler warnings
Closes #2296
2018-02-08 22:31:45 +01:00
Steve Holme
0fd6221f8c curl_addrinfo.c: Allow Unix Domain Sockets to compile under Windows
Windows 10.0.17061 SDK introduces support for Unix Domain Sockets.
Added the necessary include file to curl_addrinfo.c.

Note: The SDK (which is considered beta) has to be installed, VS 2017
project file has to be re-targeted for Windows 10.0.17061 and #define
enabled in config-win32.h.
2018-02-07 21:33:57 +00:00
Patrick Monnerat
a0984eae14 fnmatch: optimize processing of consecutive *s and ?s pattern characters
Reported-By: Daniel Stenberg
Fixes #2291
Closes #2293
2018-02-07 15:01:51 +01:00
Patrick Schlangen
dc85437736
openssl: Don't add verify locations when verifypeer==0
When peer verification is disabled, calling
SSL_CTX_load_verify_locations is not necessary. Only call it when
verification is enabled to save resources and increase performance.

Closes #2290
2018-02-06 10:48:03 +01:00
Daniel Stenberg
84ad1fd304
formdata: use the mime-content type function
Reduce code duplication by making Curl_mime_contenttype available and
used by the formdata function. This also makes the formdata function
recognize a set of more file extensions by default.

PR #2280 brought this to my attention.

Closes #2282
2018-02-05 13:50:30 +01:00
Daniel Stenberg
a19afaccfe
getdate: return -1 for out of range
...as that's how the function is documented to work.

Reported-by: Michael Kaufmann
Bug found in an autobuild with 32 bit time_t

Closes #2278
2018-02-02 09:40:54 +01:00
Daniel Stenberg
ddd31dc5dd
time_t-fixes: remove typecasts to 'long' for info.filetime
They're now wrong.

Reported-by: Michael Kaufmann

Closes #2277
2018-02-01 07:50:59 +01:00
Daniel Stenberg
9409d0c26c
curl_setup: move the precautionary define of SIZEOF_TIME_T
... up to before it may be used for the TIME_T_MAX/MIN logic.

Reported-by: Michael Kaufmann
2018-01-31 23:01:01 +01:00
Daniel Stenberg
fcb9b63ee5
parsedate: s/#if/#ifdef
Reported-by: Michael Kaufmann
Bug: 1c39128d97 (commitcomment-27246479)
2018-01-31 22:56:36 +01:00
Patrick Monnerat
da5f4b1d84 fnmatch: pattern syntax can no longer fail
Whenever an expected pattern syntax rule cannot be matched, the
character starting the rule loses its special meaning and the parsing
is resumed:
- backslash at the end of pattern string matches itself.
- Error in [:keyword:] results in set containing :\[dekorwy.

Unit test 1307 updated for this new situation.

Closes #2273
2018-01-31 01:17:35 +01:00
Patrick Monnerat
fcaa1826bd fnmatch: accept an alphanum to be followed by a non-alphanum in char set
Also be more tolerant about set pattern syntax.
Update unit test 1307 accordingly.

Bug: https://curl.haxx.se/mail/lib-2018-01/0114.html
2018-01-31 01:17:35 +01:00
Patrick Monnerat
19abad095c fnmatch: do not match the empty string with a character set 2018-01-31 01:17:35 +01:00
Daniel Stenberg
0630bb21be
http2: set DEBUG_HTTP2 to enable more HTTP/2 logging
... instead of doing it unconditionally in debug builds. It cluttered up
the output a little too much.
2018-01-30 23:19:53 +01:00
Max Dymond
811d96e9e2
file: Check the return code from Curl_range and bail out on error 2018-01-30 17:23:35 +01:00
Max Dymond
3f8a727611
Curl_range: add check to ensure "from <= to" 2018-01-30 17:23:34 +01:00
Max Dymond
e04417d98f
Curl_range: commonize FTP and FILE range handling
Closes #2205
2018-01-30 17:23:26 +01:00
Daniel Stenberg
8f69a9f28a
time: support > year 2038 time stamps for system with 32bit long
... with the introduction of CURLOPT_TIMEVALUE_LARGE and
CURLINFO_FILETIME_T.

Fixes #2238
Closes #2264
2018-01-30 08:29:59 +01:00
Daniel Stenberg
9caa3e248d
curl_easy_reset: clear digest auth state
Bug: https://curl.haxx.se/mail/lib-2018-01/0074.html
Reported-by: Ruurd Beerstra
Fixes #2255
Closes #2272
2018-01-30 08:17:59 +01:00
Daniel Stenberg
4272a0b0fc
curl_ctype: private is*() type macros and functions
... since the libc provided one are locale dependent in a way we don't
want. Also, the "native" isalnum() (for example) works differently on
different platforms which caused test 1307 failures on macos only.

Closes #2269
2018-01-29 22:56:43 +01:00
5c497343d9
GSKit: restore pinnedpubkey functionality
inadvertently removed in 283babfaf8

Closes #2263
2018-01-25 23:16:14 +01:00
Dair Grant
f8475c6941
darwinssl: Don't import client certificates into Keychain on macOS
Closes #2085
2018-01-25 23:13:35 +01:00
Daniel Stenberg
1c39128d97
parsedate: fix date parsing for systems with 32 bit long
Make curl_getdate() handle dates before 1970 as well (returning negative
values).

Make test 517 test dates for 64 bit time_t.

This fixes bug (3) mentioned in #2238

Closes #2250
2018-01-25 22:20:52 +01:00
McDonough, Tim
1433e4645b
openssl: fix pinned public key build error in FIPS mode
Here is a version that should work with all versions of openssl 0.9.7
through 1.1.0.

Links to the docs:
https://www.openssl.org/docs/man1.0.2/crypto/EVP_DigestInit.html
https://www.openssl.org/docs/man1.1.0/crypto/EVP_DigestInit.html

At the very bottom of the 1.1.0 documentation there is a history section
that states, " stack allocated EVP_MD_CTXs are no longer supported."

If EVP_MD_CTX_create and EVP_MD_CTX_destroy are not defined, then a
simple mapping can be used as described here:
https://wiki.openssl.org/index.php/Talk:OpenSSL_1.1.0_Changes

Closes #2258
2018-01-25 22:16:24 +01:00
1c00519499
SChannel/WinSSL: Replace Curl_none_md5sum with Curl_schannel_md5sum 2018-01-25 22:14:40 +01:00
e178fbd40a
SChannel/WinSSL: Implement public key pinning
Closes #1429
2018-01-25 22:14:39 +01:00
Daniel Stenberg
4c46dfc398 cookies: remove verbose "cookie size:" output
It was once used for some debugging/verifying logic but should never have
ended up in git!
2018-01-25 17:33:35 +01:00
Gisle Vanem
fdaa8257ad
Fix small typo. 2018-01-24 13:27:19 +01:00
Daniel Stenberg
eb6e3c4f6e
CONNECT_TO: fail attempt to set an IPv6 numerical without IPv6 support
Bug: https://curl.haxx.se/mail/lib-2018-01/0087.html
Reported-by: John Hascall

Closes #2257
2018-01-23 08:01:04 +01:00
Daniel Stenberg
af32cd3859
http: prevent custom Authorization headers in redirects
... unless CURLOPT_UNRESTRICTED_AUTH is set to allow them. This matches how
curl already handles Authorization headers created internally.

Note: this changes behavior slightly, for the sake of reducing mistakes.

Added test 317 and 318 to verify.

Reported-by: Craig de Stigter
Bug: https://curl.haxx.se/docs/adv_2018-b3bf.html
2018-01-22 10:00:00 +01:00
Kartik Mahajan
a5e6d6ebcb
http2: don't close connection when single transfer is stopped
Fixes #2237
Closes #2249
2018-01-18 22:28:12 +01:00
Michael Gmelin
ddafd45af1 SSH: Fix state machine for ssh-agent authentication
In case an identity didn't match[0], the state machine would fail in
state SSH_AUTH_AGENT instead of progressing to the next identity in
ssh-agent. As a result, ssh-agent authentication only worked if the
identity required happened to be the first added to ssh-agent.

This was introduced as part of commit c4eb10e2f0, which
stated that the "else" statement was required to prevent getting stuck
in state SSH_AUTH_AGENT. Given the state machine's logic and libssh2's
interface I couldn't see how this could happen or reproduce it and I
also couldn't find a more detailed description of the problem which
would explain a test case to reproduce the problem this was supposed to
fix.

[0] libssh2_agent_userauth returning LIBSSH2_ERROR_AUTHENTICATION_FAILED

Closes #2248
2018-01-18 17:08:13 +01:00
Daniel Stenberg
9e4ad1e2af
openssl: fix potential memory leak in SSLKEYLOGFILE logic
Coverity CID 1427646.
2018-01-18 12:10:58 +01:00
Daniel Stenberg
ca9c93e3e1
openssl: fix the libressl build again
Follow-up to 84fcaa2e7. libressl does not have the API even if it says it is
late OpenSSL version...

Fixes #2246
Closes #2247

Reported-by: jungle-boogie on github
2018-01-18 09:07:23 +01:00
Daniel Stenberg
2a1b2b4ef5
curl_fnmatch: only allow 5 '*' sections in a single pattern
... to avoid excessive recursive calls. The number 5 is totally
arbitrary and could be modified if someone has a good motivation.
2018-01-17 11:13:29 +01:00
Daniel Stenberg
cb5accab9e
ftp-wildcard: fix matching an empty string with "*[^a]"
.... and avoid advancing the pointer to trigger an out of buffer read.

Detected by OSS-fuzz
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5251
Assisted-by: Max Dymond
2018-01-17 10:41:38 +01:00
Daniel Stenberg
25c40c9af9
SMB: fix numeric constant suffix and variable types
1. don't use "ULL" suffix since unsupported in older MSVC
2. use curl_off_t instead of custom long long ifdefs
3. make get_posix_time() not do unaligned data access

Fixes #2211
Closes #2240
Reported-by: Chester Liu
2018-01-16 22:21:59 +01:00
Daniel Stenberg
8dd4edeb90
smtp/pop3/imap_get_message: decrease the data length too...
Follow-up commit to 615edc1f73 which was incomplete.

Assisted-by: Max Dymond
Detected by OSS-fuzz
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=5206
2018-01-15 21:40:52 +01:00
Daniel Stenberg
84fcaa2e73
openssl: enable SSLKEYLOGFILE support by default
Fixes #2210
Closes #2236
2018-01-15 10:33:08 +01:00
Patrick Monnerat
e44ddfd477 mime: clone mime tree upon easy handle duplication.
A mime tree attached to an easy handle using CURLOPT_MIMEPOST is
strongly bound to the handle: there is a pointer to the easy handle in
each item of the mime tree and following the parent pointer list
of mime items ends in a dummy part stored within the handle.

Because of this binding, a mime tree cannot be shared between different
easy handles, thus it needs to be cloned upon easy handle duplication.

There is no way for the caller to get the duplicated mime tree
handle: it is then set to be automatically destroyed upon freeing the
new easy handle.

New test 654 checks proper mime structure duplication/release.

Add a warning note in curl_mime_data_cb() documentation about sharing
user data between duplicated handles.

Closes #2235
2018-01-14 19:43:12 +01:00
Daniel Stenberg
f68e672715
HTTP: bail out on negative Content-Length: values
... and make the max filesize check trigger if the value is too big.

Updates test 178.

Reported-by: Brad Spencer
Fixes #2212
Closes #2223
2018-01-13 22:49:04 +01:00
Jay Satiro
6fa10c8fa2 setopt: fix SSLVERSION to allow CURL_SSLVERSION_MAX_ values
Broken since f121575 (precedes 7.56.1).

Bug: https://github.com/curl/curl/issues/2225
Reported-by: cmfrolick@users.noreply.github.com

Closes https://github.com/curl/curl/pull/2227
2018-01-13 02:57:30 -05:00
Patrick Monnerat
3b548ffde9 setopt: reintroduce non-static Curl_vsetopt() for OS400 support
This also upgrades ILE/RPG bindings with latest setopt options.

Reported-By: jonrumsey on github
Fixes #2230
Closes #2233
2018-01-13 01:28:19 +01:00
Zhouyihai Ding
fa3dbb9a14 http2: fix incorrect trailer buffer size
Prior to this change the stored byte count of each trailer was
miscalculated and 1 less than required. It appears any trailer
after the first that was passed to Curl_client_write would be truncated
or corrupted as well as the size. Potentially the size of some
subsequent trailer could be erroneously extracted from the contents of
that trailer, and since that size is used by client write an
out-of-bounds read could occur and cause a crash or be otherwise
processed by client write.

The bug appears to have been born in 0761a51 (precedes 7.49.0).

Closes https://github.com/curl/curl/pull/2231
2018-01-11 02:33:24 -05:00
Basuke Suzuki
2a6dbb8155 easy: fix connection ownership in curl_easy_pause
Before calling Curl_client_chop_write(), change the owner of connection
to the current Curl_easy handle. This will fix the issue #2217.

Fixes https://github.com/curl/curl/issues/2217
Closes https://github.com/curl/curl/pull/2221
2018-01-09 02:50:18 -05:00
Daniel Stenberg
a8ce5efba9 progress: calculate transfer speed on milliseconds if possible
to increase accuracy for quick transfers

Fixes #2200
Closes #2206
2018-01-08 23:45:09 +13:00
Jay Satiro
d4e40f0690 scripts: allow all perl scripts to be run directly
- Enable execute permission (chmod +x)

- Change interpreter to /usr/bin/env perl

Closes https://github.com/curl/curl/pull/2222
2018-01-07 15:42:11 -05:00
Jay Satiro
908a9a6742 build: remove HAVE_LIMITS_H check
.. because limits.h presence isn't optional, it's required by C89.

Ref: http://port70.net/~nsz/c/c89/c89-draft.html#2.2.4.2

Closes https://github.com/curl/curl/pull/2215
2018-01-05 23:34:30 -05:00
Jay Satiro
129390a518 openssl: fix memory leak of SSLKEYLOGFILE filename
- Free the copy of SSLKEYLOGFILE env returned by curl_getenv during ossl
  initialization.

Caught by ASAN.
2018-01-03 15:22:41 -05:00
Mikalai Ananenka
58d7cd28a0 brotli: data at the end of content can be lost
Decoding loop implementation did not concern the case when all
received data is consumed by Brotli decoder and the size of decoded
data internally hold by Brotli decoder is greater than CURL_MAX_WRITE_SIZE.
For content with unencoded length greater than CURL_MAX_WRITE_SIZE this
can result in the loss of data at the end of content.

Closes #2194
2017-12-27 13:00:54 +01:00
Patrick Monnerat
f009bbe1f6 curl_easy_reset: release mime-related data.
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-20 19:33:50 +01:00
Patrick Monnerat
4acc9d3d1a content_encoding: rework zlib_inflate
- 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-20 16:02:42 +01:00
Patrick Monnerat
e639d4ca4d brotli: allow compiling with version 0.6.0.
Some error codes were not yet defined in brotli 0.6.0: do not issue code
for them in this case.
2017-12-20 15:30:35 +01:00
Daniel Stenberg
02f207a76b
rand: add a clang-analyzer work-around
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-13 00:45:42 +01:00
Daniel Stenberg
13ce373a5b
krb5: fix a potential access of uninitialized memory
A scan-build warning.
2017-12-13 00:36:39 +01:00
Daniel Stenberg
41982b6ac9
conncache: fix a return code [regression]
This broke in 07cb27c98e. Make sure to return 'result' properly. Pointed
out by scan-build!
2017-12-12 23:54:35 +01:00
Daniel Stenberg
9d7a59c8fa
setopt: less *or equal* than INT_MAX/1000 should be fine
... 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-12 08:02:17 +01:00
dmitrykos
2437dbbf12
vtls: replaced getenv() with curl_getenv()
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-12 08:02:07 +01:00
Daniel Stenberg
e959f16c5f
multi_done: prune DNS cache
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-10 14:51:47 +01:00
Jay Satiro
7ab4e7adb9 openssl: Disable file buffering for Win32 SSLKEYLOGFILE
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-10 02:48:41 -05:00
Daniel Stenberg
b1b94305d8
RESOLVE: output verbose text when trying to set a duplicate name
... to help users understand what is or isn't done!
2017-12-10 00:41:57 +01:00
John DeHelian
a4a56ec93e
sftp: allow quoted commands to use relative paths
Closes #1900
2017-12-09 13:38:38 +01:00
Daniel Stenberg
179ee78e86
curl: remove __EMX__ #ifdefs
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-08 23:45:16 +01:00
Jay Satiro
9dfb194833 openssl: improve data-pending check for https proxy
- 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-08 17:43:36 -05:00
Zachary Seguin
55e609890f
CONNECT: keep close connection flag in http_connect_state struct
Fixes #2088
Closes #2157
2017-12-07 09:48:33 +01:00
Per Malmberg
c103cac3c8
include: get netinet/in.h before linux/tcp.h
... to allow build on older Linux dists (specifically CentOS 4.8 on gcc
4.8.5)

Closes #2160
2017-12-07 08:15:44 +01:00
Daniel Stenberg
00cda0f9b3
openldap: fix checksrc nits 2017-12-06 14:58:26 +01:00
Stepan Broz
ff07f07cc8
openldap: add commented out debug possibilities
... to aid debugging openldap library using its built-in debug messages.

Closes #2159
2017-12-06 14:51:04 +01:00
Jan-E
b261c44e8c
URL: tolerate backslash after drive letter for FILE:
... as in "file://c:\some\path\curl.out"

Reviewed-by: Matthew Kerwin
Closes #2154
2017-12-06 00:53:20 +01:00
Randall S. Becker
76ebd54175
configure: check for netinet/in6.h
Needed by HPE NonStop NSE and NSX systems

Fixes #2146
Closes #2155
2017-12-06 00:19:09 +01:00
Daniel Stenberg
ea3a5d07dc
conncache: only allow multiplexing within same multi handle
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-05 23:36:08 +01:00
Daniel Stenberg
07cb27c98e
conncache: fix several lock issues
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-05 23:21:02 +01:00
Daniel Stenberg
85f0133ea1
libssh: remove dead code in sftp_qoute
... by removing a superfluous NULL pointer check that also confuses
Coverity.

Fixes #2143
Closes #2153
2017-12-05 17:08:08 +01:00
Daniel Stenberg
615edc1f73
sasl_getmesssage: make sure we have a long enough string to pass
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-05 17:05:44 +01:00
Daniel Stenberg
4401409468
libssh2: remove dead code from SSH_SFTP_QUOTE
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-04 13:23:12 +01:00
Daniel Stenberg
6401ddad44
ssh-libssh.c: please checksrc 2017-12-04 10:48:01 +01:00
Nikos Mavrogiannopoulos
9185307522 libssh: fixed dereference in statvfs access
The behavior is now equivalent to ssh.c when SSH_SFTP_QUOTE_STATVFS
handling fails.

Fixes #2142
2017-12-04 09:24:45 +01:00
Nikos Mavrogiannopoulos
a08f5a77cc libssh: corrected use of sftp_statvfs() in SSH_SFTP_QUOTE_STATVFS
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-03 12:35:44 +01:00
Nikos Mavrogiannopoulos
8843c0939e libssh: no need to call sftp_get_error as ssh_get_error is sufficient
Fixes #2141

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-12-03 12:34:39 +01:00
Daniel Stenberg
3cef6f22ea
libssh: fix minor static code analyzer nits
- remove superfluous NULL check which otherwise tricks the static code
analyzers to assume NULL pointer dereferences.

- fix fallthrough in switch()

- indent mistake
2017-12-02 23:36:07 +01:00
Daniel Stenberg
10bb0b4719
openssl: pkcs12 is supported by boringssl
Removes another #ifdef for BoringSSL

Pointed-out-by: David Benjamin

Closes #2134
2017-12-02 11:55:01 +01:00
Nikos Mavrogiannopoulos
a2f3966800
libssh: added SFTP support
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-01 17:38:37 +01:00
Nikos Mavrogiannopoulos
38aef6dc45
libssh2: return CURLE_UPLOAD_FAILED on failure to upload
This brings its in sync with the error code returned by the
libssh backend.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
2017-12-01 17:35:15 +01:00
Nikos Mavrogiannopoulos
75427291e5
libssh2: send the correct CURLE error code on scp file not found
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-01 17:35:15 +01:00
Nikos Mavrogiannopoulos
c92d2e14cf
Added support for libssh SSH SCP back-end
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-01 17:35:14 +01:00
W. Mark Kubacki
4b41424910
lib: don't export all symbols, just everything curl_*
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-01 10:32:28 +01:00
Johannes Schindelin
9194a9959b
SSL: Avoid magic allocation of SSL backend specific data
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-12-01 10:28:31 +01:00
Daniel Stenberg
cd276c3cca
openssl: fix boringssl build again
commit d3ab7c5a21 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-27 19:39:09 +01:00
Daniel Stenberg
014887c50a
curl_ntlm_core.c: use the limits.h's SIZE_T_MAX if provided 2017-11-27 10:40:31 +01:00
Daniel Stenberg
d661b0afb5
global_init: ignore CURL_GLOBAL_SSL's absense
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-27 08:50:33 +01:00
Daniel Stenberg
7f2a1df6f5
ntlm: avoid integer overflow for malloc size
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-27 08:19:34 +01:00